Changeset 227:50c3ae93007d for src/mlx/gui/gui.py
- Timestamp:
- 06/05/12 18:20:01 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r226 r227 1 1 # The main file for the GUI 2 # -*- coding: utf-8 -*- 2 3 3 4 from statusicon import StatusIcon … … 21 22 import mlx.web as web 22 23 import mlx.singleton as singleton 23 from mlx.i18n import xstr 24 from mlx.i18n import xstr, getLanguage 24 25 from mlx.pirep import PIREP 25 26 … … 28 29 import sys 29 30 import datetime 31 import webbrowser 30 32 31 33 #------------------------------------------------------------------------------ … … 33 35 class GUI(fs.ConnectionListener): 34 36 """The main GUI class.""" 37 _authors = [ ("Váradi", "István", "prog_test"), 38 ("Galyassy", "Tamás", "negotiation"), 39 ("Petrovszki", "Gábor", "test"), 40 ("Zsebényi-Loksa", "Gergely", "test"), 41 ("Kurják", "Ákos", "test"), 42 ("Radó", "Iván", "test") ] 43 35 44 def __init__(self, programDirectory, config): 36 45 """Construct the GUI.""" … … 158 167 self._pilotHotkeyIndex = None 159 168 self._checklistHotkeyIndex = None 169 170 self._aboutDialog = None 160 171 161 172 @property … … 872 883 showDebugMenuItem.connect("toggled", self._toggleDebugLog) 873 884 viewMenu.append(showDebugMenuItem) 885 886 helpMenuItem = gtk.MenuItem(xstr("menu_help")) 887 helpMenu = gtk.Menu() 888 helpMenuItem.set_submenu(helpMenu) 889 menuBar.append(helpMenuItem) 890 891 manualMenuItem = gtk.ImageMenuItem(gtk.STOCK_HELP) 892 manualMenuItem.set_use_stock(True) 893 manualMenuItem.set_label(xstr("menu_help_manual")) 894 manualMenuItem.add_accelerator("activate", accelGroup, 895 ord(xstr("menu_help_manual_key")), 896 CONTROL_MASK, ACCEL_VISIBLE) 897 manualMenuItem.connect("activate", self._showManual) 898 helpMenu.append(manualMenuItem) 899 900 helpMenu.append(gtk.SeparatorMenuItem()) 901 902 aboutMenuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT) 903 aboutMenuItem.set_use_stock(True) 904 aboutMenuItem.set_label(xstr("menu_help_about")) 905 aboutMenuItem.add_accelerator("activate", accelGroup, 906 ord(xstr("menu_help_about_key")), 907 CONTROL_MASK, ACCEL_VISIBLE) 908 aboutMenuItem.connect("activate", self._showAbout) 909 helpMenu.append(aboutMenuItem) 874 910 875 911 return menuBar … … 1232 1268 else: 1233 1269 print "gui.GUI._handleHotkeys: unhandled hotkey index:", index 1270 1271 def _showManual(self, menuitem): 1272 """Show the user's manual.""" 1273 webbrowser.open(url ="file://" + 1274 os.path.join(self._programDirectory, "doc", "manual", 1275 getLanguage(), "index.html"), 1276 new = 1) 1277 1278 def _showAbout(self, menuitem): 1279 """Show the about dialog.""" 1280 dialog = self._getAboutDialog() 1281 dialog.show_all() 1282 dialog.run() 1283 dialog.hide() 1284 1285 def _getAboutDialog(self): 1286 """Get the about dialog. 1287 1288 If it does not exist yet, it will be created.""" 1289 if self._aboutDialog is None: 1290 self._aboutDialog = dialog = gtk.AboutDialog() 1291 dialog.set_transient_for(self._mainWindow) 1292 dialog.set_modal(True) 1293 1294 logoPath = os.path.join(self._programDirectory, "logo.png") 1295 logo = pixbuf_new_from_file(logoPath) 1296 dialog.set_logo(logo) 1297 1298 dialog.set_program_name(PROGRAM_NAME) 1299 dialog.set_version(const.VERSION) 1300 dialog.set_copyright("(c) 2012 by István Váradi") 1301 1302 isHungarian = getLanguage()=="hu" 1303 authors = [] 1304 for (familyName, firstName, role) in GUI._authors: 1305 authors.append("%s %s (%s)" % \ 1306 (familyName if isHungarian else firstName, 1307 firstName if isHungarian else familyName, 1308 xstr("about_role_" + role))) 1309 dialog.set_authors(authors) 1310 1311 dialog.set_license(xstr("about_license")) 1312 1313 return self._aboutDialog
Note:
See TracChangeset
for help on using the changeset viewer.