Changeset 999:e096a5638b87 for src/mlx/gui/gui.py
- Timestamp:
- 07/04/19 18:54:23 (5 years ago)
- Branch:
- python3
- hg-Phase:
- (<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r997 r999 502 502 503 503 dialog = Gtk.MessageDialog(parent = self._mainWindow, 504 type = MESSAGETYPE_ERROR,504 type = Gtk.MessageType.ERROR, 505 505 message_format = xstr("conn_failed")) 506 506 … … 533 533 self._statusbar.updateConnection(self._connecting, self._connected) 534 534 535 dialog = Gtk.MessageDialog(type = MESSAGETYPE_ERROR,535 dialog = Gtk.MessageDialog(type = Gtk.MessageType.ERROR, 536 536 message_format = xstr("conn_broken"), 537 537 parent = self._mainWindow) … … 592 592 """Cancel the current file, if the user confirms it.""" 593 593 dialog = Gtk.MessageDialog(parent = self._mainWindow, 594 type = MESSAGETYPE_QUESTION,594 type = Gtk.MessageType.QUESTION, 595 595 message_format = xstr("cancelFlight_question")) 596 596 597 dialog.add_button(xstr("button_no"), RESPONSETYPE_NO)598 dialog.add_button(xstr("button_yes"), RESPONSETYPE_YES)597 dialog.add_button(xstr("button_no"), Gtk.ResponseType.NO) 598 dialog.add_button(xstr("button_yes"), Gtk.ResponseType.YES) 599 599 600 600 dialog.set_title(WINDOW_TITLE_BASE) … … 602 602 dialog.hide() 603 603 604 if result== RESPONSETYPE_YES:604 if result==Gtk.ResponseType.YES: 605 605 self.reset() 606 606 … … 741 741 iconified = Gdk.WindowState.ICONIFIED 742 742 743 if (event.changed_mask& WINDOW_STATE_WITHDRAWN)!=0:744 if (event.new_window_state& WINDOW_STATE_WITHDRAWN)!=0:743 if (event.changed_mask&Gdk.WindowState.WITHDRAWN)!=0: 744 if (event.new_window_state&Gdk.WindowState.WITHDRAWN)!=0: 745 745 self._statusIcon.mainWindowHidden() 746 746 else: 747 747 self._statusIcon.mainWindowShown() 748 748 749 if (event.changed_mask& WINDOW_STATE_ICONIFIED)!=0 and \750 (event.new_window_state& WINDOW_STATE_ICONIFIED)==0:749 if (event.changed_mask&Gdk.WindowState.ICONIFIED)!=0 and \ 750 (event.new_window_state&Gdk.WindowState.ICONIFIED)==0: 751 751 self._mainWindow.present() 752 752 … … 931 931 932 932 dialog = Gtk.MessageDialog(parent = self.mainWindow, 933 type = MESSAGETYPE_ERROR,933 type = Gtk.MessageType.ERROR, 934 934 message_format = xstr("fleet_failed")) 935 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)935 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 936 936 dialog.set_title(WINDOW_TITLE_BASE) 937 937 dialog.run() … … 976 976 else: 977 977 dialog = Gtk.MessageDialog(parent = self.mainWindow, 978 type = MESSAGETYPE_ERROR,978 type = Gtk.MessageType.ERROR, 979 979 message_format = xstr("fleet_update_failed")) 980 dialog.add_button(xstr("button_ok"), RESPONSETYPE_ACCEPT)980 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.ACCEPT) 981 981 dialog.set_title(WINDOW_TITLE_BASE) 982 982 dialog.run() … … 1077 1077 loadPIREPMenuItem.add_accelerator("activate", accelGroup, 1078 1078 ord(xstr("menu_file_loadPIREP_key")), 1079 CONTROL_MASK, ACCEL_VISIBLE) 1079 Gdk.ModifierType.CONTROL_MASK, 1080 Gtk.AccelFlags.VISIBLE) 1080 1081 loadPIREPMenuItem.connect("activate", self._loadPIREP) 1081 1082 fileMenu.append(loadPIREPMenuItem) … … 1088 1089 quitMenuItem.add_accelerator("activate", accelGroup, 1089 1090 ord(xstr("menu_file_quit_key")), 1090 CONTROL_MASK, ACCEL_VISIBLE) 1091 Gdk.ModifierType.CONTROL_MASK, 1092 Gtk.AccelFlags.VISIBLE) 1091 1093 quitMenuItem.connect("activate", self._quit) 1092 1094 fileMenu.append(quitMenuItem) … … 1103 1105 timetableMenuItem.add_accelerator("activate", accelGroup, 1104 1106 ord(xstr("menu_tools_timetable_key")), 1105 CONTROL_MASK, ACCEL_VISIBLE) 1107 Gdk.ModifierType.CONTROL_MASK, 1108 Gtk.AccelFlags.VISIBLE) 1106 1109 timetableMenuItem.connect("activate", self.showTimetable) 1107 1110 self._timetableMenuItem.set_sensitive(False) … … 1114 1117 flightsMenuItem.add_accelerator("activate", accelGroup, 1115 1118 ord(xstr("menu_tools_flights_key")), 1116 CONTROL_MASK, ACCEL_VISIBLE) 1119 Gdk.ModifierType.CONTROL_MASK, 1120 Gtk.AccelFlags.VISIBLE) 1117 1121 flightsMenuItem.connect("activate", self.showFlights) 1118 1122 self._flightsMenuItem.set_sensitive(False) … … 1124 1128 checklistMenuItem.add_accelerator("activate", accelGroup, 1125 1129 ord(xstr("menu_tools_chklst_key")), 1126 CONTROL_MASK, ACCEL_VISIBLE) 1130 Gdk.ModifierType.CONTROL_MASK, 1131 Gtk.AccelFlags.VISIBLE) 1127 1132 checklistMenuItem.connect("activate", self._editChecklist) 1128 1133 toolsMenu.append(checklistMenuItem) … … 1133 1138 approachCalloutsMenuItem.add_accelerator("activate", accelGroup, 1134 1139 ord(xstr("menu_tools_callouts_key")), 1135 CONTROL_MASK, ACCEL_VISIBLE) 1140 Gdk.ModifierType.CONTROL_MASK, 1141 Gtk.AccelFlags.VISIBLE) 1136 1142 approachCalloutsMenuItem.connect("activate", self._editApproachCallouts) 1137 1143 toolsMenu.append(approachCalloutsMenuItem) … … 1142 1148 prefsMenuItem.add_accelerator("activate", accelGroup, 1143 1149 ord(xstr("menu_tools_prefs_key")), 1144 CONTROL_MASK, ACCEL_VISIBLE) 1150 Gdk.ModifierType.CONTROL_MASK, 1151 Gtk.AccelFlags.VISIBLE) 1145 1152 prefsMenuItem.connect("activate", self._editPreferences) 1146 1153 toolsMenu.append(prefsMenuItem) … … 1153 1160 bugReportMenuItem.add_accelerator("activate", accelGroup, 1154 1161 ord(xstr("menu_tools_bugreport_key")), 1155 CONTROL_MASK, ACCEL_VISIBLE) 1162 Gdk.ModifierType.CONTROL_MASK, 1163 Gtk.AccelFlags.VISIBLE) 1156 1164 bugReportMenuItem.connect("activate", self._reportBug) 1157 1165 toolsMenu.append(bugReportMenuItem) … … 1168 1176 self._showMonitorMenuItem.add_accelerator("activate", accelGroup, 1169 1177 ord(xstr("menu_view_monitor_key")), 1170 CONTROL_MASK, ACCEL_VISIBLE) 1178 Gdk.ModifierType.CONTROL_MASK, 1179 Gtk.AccelFlags.VISIBLE) 1171 1180 self._showMonitorMenuItem.connect("toggled", self._toggleMonitorWindow) 1172 1181 viewMenu.append(self._showMonitorMenuItem) … … 1178 1187 showDebugMenuItem.add_accelerator("activate", accelGroup, 1179 1188 ord(xstr("menu_view_debug_key")), 1180 CONTROL_MASK, ACCEL_VISIBLE) 1189 Gdk.ModifierType.CONTROL_MASK, 1190 Gtk.AccelFlags.VISIBLE) 1181 1191 showDebugMenuItem.connect("toggled", self._toggleDebugLog) 1182 1192 viewMenu.append(showDebugMenuItem) … … 1192 1202 manualMenuItem.add_accelerator("activate", accelGroup, 1193 1203 ord(xstr("menu_help_manual_key")), 1194 CONTROL_MASK, ACCEL_VISIBLE) 1204 Gdk.ModifierType.CONTROL_MASK, 1205 Gtk.AccelFlags.VISIBLE) 1195 1206 manualMenuItem.connect("activate", self._showManual) 1196 1207 helpMenu.append(manualMenuItem) … … 1203 1214 aboutMenuItem.add_accelerator("activate", accelGroup, 1204 1215 ord(xstr("menu_help_about_key")), 1205 CONTROL_MASK, ACCEL_VISIBLE) 1216 Gdk.ModifierType.CONTROL_MASK, 1217 Gtk.AccelFlags.VISIBLE) 1206 1218 aboutMenuItem.connect("activate", self._showAbout) 1207 1219 helpMenu.append(aboutMenuItem) … … 1254 1266 """Quit from the application.""" 1255 1267 if force: 1256 result= RESPONSETYPE_YES1268 result=Gtk.ResponseType.YES 1257 1269 else: 1258 1270 dialog = Gtk.MessageDialog(parent = self._mainWindow, 1259 type = MESSAGETYPE_QUESTION,1271 type = Gtk.MessageType.QUESTION, 1260 1272 message_format = xstr("quit_question")) 1261 1273 1262 dialog.add_button(xstr("button_no"), RESPONSETYPE_NO)1263 dialog.add_button(xstr("button_yes"), RESPONSETYPE_YES)1274 dialog.add_button(xstr("button_no"), Gtk.ResponseType.NO) 1275 dialog.add_button(xstr("button_yes"), Gtk.ResponseType.YES) 1264 1276 1265 1277 dialog.set_title(WINDOW_TITLE_BASE) … … 1267 1279 dialog.hide() 1268 1280 1269 if result== RESPONSETYPE_YES:1281 if result==Gtk.ResponseType.YES: 1270 1282 self._statusIcon.destroy() 1271 1283 return Gtk.main_quit() … … 1324 1336 else: 1325 1337 dialog = Gtk.MessageDialog(parent = self.mainWindow, 1326 type = MESSAGETYPE_ERROR,1338 type = Gtk.MessageType.ERROR, 1327 1339 message_format = xstr("timetable_failed")) 1328 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1340 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1329 1341 dialog.set_title(WINDOW_TITLE_BASE) 1330 1342 dialog.run() … … 1354 1366 else: 1355 1367 dialog = Gtk.MessageDialog(parent = self.mainWindow, 1356 type = MESSAGETYPE_ERROR,1368 type = Gtk.MessageType.ERROR, 1357 1369 message_format = xstr("acceptedflt_failed")) 1358 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1370 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1359 1371 dialog.set_title(WINDOW_TITLE_BASE) 1360 1372 dialog.run() … … 1419 1431 self._pirepEditor.setPIREP(pirep) 1420 1432 self._pirepEditor.show_all() 1421 if self._pirepEditor.run()== RESPONSETYPE_OK:1433 if self._pirepEditor.run()==Gtk.ResponseType.OK: 1422 1434 self.beginBusy(xstr("pirepEdit_save_busy")) 1423 1435 self.webHandler.sendPIREP(self._pirepUpdatedCallback, pirep, … … 1434 1446 self.endBusy() 1435 1447 secondaryMarkup = None 1436 type = MESSAGETYPE_ERROR1448 type = Gtk.MessageType.ERROR 1437 1449 if returned: 1438 1450 if result.success: … … 1454 1466 dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 1455 1467 type = type, message_format = messageFormat) 1456 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1468 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1457 1469 dialog.set_title(WINDOW_TITLE_BASE) 1458 1470 if secondaryMarkup is not None: … … 1478 1490 dialog.hide() 1479 1491 1480 if result== RESPONSETYPE_OK:1492 if result==Gtk.ResponseType.OK: 1481 1493 self._lastLoadedPIREP = dialog.get_filename() 1482 1494 … … 1484 1496 if pirep is None: 1485 1497 dialog = Gtk.MessageDialog(parent = self._mainWindow, 1486 type = MESSAGETYPE_ERROR,1498 type = Gtk.MessageType.ERROR, 1487 1499 message_format = xstr("loadPIREP_failed")) 1488 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1500 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1489 1501 dialog.set_title(WINDOW_TITLE_BASE) 1490 1502 dialog.format_secondary_markup(xstr("loadPIREP_failed_sec")) … … 1497 1509 result = dialog.run() 1498 1510 1499 if result== RESPONSETYPE_OK:1511 if result==Gtk.ResponseType.OK: 1500 1512 self.sendPIREP(pirep) 1501 1513 elif result==1: … … 1513 1525 dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 1514 1526 xstr("loadPIREP_browser_title"), 1515 action = FILE_CHOOSER_ACTION_OPEN,1527 action = Gtk.FileChooserAction.OPEN, 1516 1528 buttons = (Gtk.STOCK_CANCEL, 1517 RESPONSETYPE_CANCEL,1518 Gtk.STOCK_OK, RESPONSETYPE_OK),1529 Gtk.ResponseType.CANCEL, 1530 Gtk.STOCK_OK, Gtk.ResponseType.OK), 1519 1531 parent = self._mainWindow) 1520 1532 dialog.set_modal(True) … … 1541 1553 xstr("loadPIREP_send_title"), 1542 1554 parent = self._mainWindow, 1543 flags = DIALOG_MODAL)1555 flags = Gtk.DialogFlags.MODAL) 1544 1556 1545 1557 contentArea = dialog.get_content_area() … … 1636 1648 table.attach(labelAlignment, 1, 2, 4, 5) 1637 1649 1638 dialog.add_button(xstr("button_cancel"), RESPONSETYPE_REJECT)1650 dialog.add_button(xstr("button_cancel"), Gtk.ResponseType.REJECT) 1639 1651 dialog.add_button(xstr("viewPIREP"), 1) 1640 dialog.add_button(xstr("sendPIREP"), RESPONSETYPE_OK)1652 dialog.add_button(xstr("sendPIREP"), Gtk.ResponseType.OK) 1641 1653 1642 1654 return dialog … … 1656 1668 self.endBusy() 1657 1669 secondaryMarkup = None 1658 type = MESSAGETYPE_ERROR1670 type = Gtk.MessageType.ERROR 1659 1671 if returned: 1660 1672 if result.success: 1661 type = MESSAGETYPE_INFO1673 type = Gtk.MessageType.INFO 1662 1674 messageFormat = xstr("sendPIREP_success") 1663 1675 secondaryMarkup = xstr("sendPIREP_success_sec") … … 1677 1689 dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 1678 1690 type = type, message_format = messageFormat) 1679 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1691 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1680 1692 dialog.set_title(WINDOW_TITLE_BASE) 1681 1693 if secondaryMarkup is not None: … … 1723 1735 self.endBusy() 1724 1736 secondaryMarkup = None 1725 type = MESSAGETYPE_ERROR1737 type = Gtk.MessageType.ERROR 1726 1738 if returned: 1727 1739 if result.success: 1728 type = MESSAGETYPE_INFO1740 type = Gtk.MessageType.INFO 1729 1741 messageFormat = xstr("sendBugReport_success") % (result.ticketID,) 1730 1742 secondaryMarkup = xstr("sendBugReport_success_sec") … … 1738 1750 dialog = Gtk.MessageDialog(parent = self._wizard.gui._bugReportDialog, 1739 1751 type = type, message_format = messageFormat) 1740 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1752 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1741 1753 dialog.set_title(WINDOW_TITLE_BASE) 1742 1754 if secondaryMarkup is not None: … … 1815 1827 1816 1828 logoPath = os.path.join(self._programDirectory, "logo.png") 1817 logo = pixbuf_new_from_file(logoPath)1829 logo = GdkPixbuf.Pixbuf.new_from_file(logoPath) 1818 1830 dialog.set_logo(logo) 1819 1831 … … 1887 1899 response = dialog.run() 1888 1900 1889 if response== RESPONSETYPE_OK:1901 if response==Gtk.ResponseType.OK: 1890 1902 self._credentialsUserName = dialog.userName 1891 1903 self._credentialsPassword = dialog.password … … 1915 1927 if not self.config.pilotID and not self.config.password: 1916 1928 dialog = Gtk.MessageDialog(parent = self._mainWindow, 1917 type = MESSAGETYPE_QUESTION,1929 type = Gtk.MessageType.QUESTION, 1918 1930 message_format = xstr("register_ask")) 1919 1931
Note:
See TracChangeset
for help on using the changeset viewer.