f7cee7ea1bbbd48e91749942087e96c6be520183
[wifi-assistant] / package / src / wifi_assistant / gui / about_dialog.py
1 #!/usr/bin/python2.5
2 import gtk, hildon
3
4 def _(str):
5     return str
6
7 class AboutDialog():
8     
9     BUG_BUTTON = 1
10     DONATE_BUTTON = 2
11     CLOSE_BUTTON = 3
12     
13     BUG_URL = 'http://wifi-assistant.garage.maemo.org/bugs/'
14     DONATE_URL = 'http://wifi-assistant.garage.maemo.org/donate/'
15
16     def __init__(self, launcher, parent_window):
17         self._launcher = launcher
18         self._parent_window = parent_window
19
20
21     def show(self):
22         dialog = gtk.Dialog(_('About Wifi Jail Brekaout Assistant'), self._parent_window)
23         text = "I got tired of not being able to connect easily to networks guarded by a login page, " + \
24             "so I created this app to scratch that itch. It's free to use, inspect, adapt and share, " + \
25             "licensed under a BSD type license.\nI hope you enjoy it!"
26
27         about_label = gtk.Label(_(text))
28         about_label.set_line_wrap(True)
29         dialog.vbox.add(about_label)
30         
31         dialog.add_button(_('File a bug'), AboutDialog.BUG_BUTTON)
32         dialog.add_button(_('Donate'), AboutDialog.DONATE_BUTTON)
33         dialog.add_button(_('Close'), AboutDialog.CLOSE_BUTTON)
34         
35         dialog.show_all()
36         result = self._runDialog(dialog)
37         dialog.hide()
38         
39         if result == AboutDialog.BUG_BUTTON:
40             self._launcher.openUrl(_(AboutDialog.BUG_URL))
41         if result == AboutDialog.DONATE_BUTTON:
42             self._launcher.openUrl(_(AboutDialog.DONATE_URL))
43     
44
45     def _runDialog(self, dialog):
46         result = dialog.run()
47         return result