Changeset 864:b154a5d879cb for src
- Timestamp:
- 06/18/17 17:59:30 (7 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r863 r864 492 492 flightButtonWidthBox.pack_start(self._printButton, True, True, 4) 493 493 494 self._deleteButton = gtk.Button(xstr("flightsel_delete")) 495 self._deleteButton.set_use_underline(True) 496 self._deleteButton.set_sensitive(False) 497 self._deleteButton.set_tooltip_text(xstr("flightsel_delete_tooltip")) 498 self._deleteButton.connect("clicked", self._deleteClicked) 499 500 flightButtonWidthBox.pack_start(self._deleteButton, True, True, 4) 494 501 495 502 flightButtonWidthAlignment.add(flightButtonWidthBox) … … 648 655 def _printClicked(self, button): 649 656 """Called when the Print briefing button is clicked.""" 657 self._printSelected() 658 659 def _printSelected(self): 660 """Print the briefing for the selected flight.""" 650 661 wizard = self._wizard 651 662 flight = self._getSelectedFlight() … … 843 854 cr.stroke() 844 855 856 def _deleteClicked(self, button): 857 """Called when the Delete flight button is clicked.""" 858 self._deleteSelected() 859 860 def _deleteSelected(self): 861 """Delete the selected flight.""" 862 if askYesNo(xstr("flightsel_delete_confirm"), 863 parent = self._wizard.gui.mainWindow): 864 flight = self._getSelectedFlight() 865 gui = self._wizard.gui 866 gui.beginBusy(xstr("flightsel_delete_busy")) 867 868 gui.webHandler.deleteFlights(self._deleteResultCallback, 869 [flight.id]) 870 871 def _deleteResultCallback(self, returned, result): 872 """Called when the deletion result is available.""" 873 gobject.idle_add(self._handleDeleteResult, returned, result) 874 875 def _handleDeleteResult(self, returned, result): 876 """Handle the delete result.""" 877 gui = self._wizard.gui 878 gui.endBusy() 879 880 if returned: 881 indexes = self._flightList.selectedIndexes 882 883 flights = [self._flights[index] for index in indexes] 884 885 self._flightList.removeFlights(indexes) 886 for index in indexes[::-1]: 887 del self._flights[index] 888 else: 889 communicationErrorDialog() 890 891 845 892 def _refreshClicked(self, button): 846 893 """Called when the refresh button is clicked.""" … … 858 905 self._saveButton.set_sensitive(len(indexes)==1) 859 906 self._printButton.set_sensitive(len(indexes)==1) 907 self._deleteButton.set_sensitive(len(indexes)==1) 860 908 self._updateNextButton() 861 909 … … 1042 1090 menu.append(menuItem) 1043 1091 1092 menuItem = gtk.MenuItem() 1093 menuItem.set_label(xstr("flightsel_popup_delete")) 1094 menuItem.set_use_underline(True) 1095 menuItem.connect("activate", self._popupDelete) 1096 menuItem.show() 1097 1098 menu.append(menuItem) 1099 1044 1100 return menu 1045 1101 … … 1053 1109 if not self._completed: 1054 1110 self._saveSelected() 1111 1112 def _popupDelete(self, menuItem): 1113 """Called when the Delete menu item is activated in the popup menu.""" 1114 if not self._completed: 1115 self._deleteSelected() 1055 1116 1056 1117 #-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.