Changeset 277:33fbad0ca891 for src/mlx
- Timestamp:
- 07/07/12 09:23:28 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/common.py
r276 r277 65 65 SORT_ASCENDING = gtk.SORT_ASCENDING 66 66 SORT_DESCENDING = gtk.SORT_DESCENDING 67 68 EVENT_BUTTON_PRESS = gdk.BUTTON_PRESS 67 69 68 70 pixbuf_new_from_file = gdk.pixbuf_new_from_file … … 128 130 SORT_DESCENDING = gtk.SortType.DESCENDING 129 131 132 EVENT_BUTTON_PRESS = gdk.EventType.BUTTON_PRESS 133 130 134 pixbuf_new_from_file = gdkPixbuf.Pixbuf.new_from_file 131 135 -
src/mlx/gui/flight.py
r275 r277 381 381 column.set_expand(True) 382 382 self._flightList.append_column(column) 383 self._flightList.connect("row-activated", self._rowActivated) 384 self._flightList.connect("button-press-event", self._listButtonPressed) 385 386 self._flightListPopupMenu = None 383 387 384 388 flightSelection = self._flightList.get_selection() 385 flightSelection.connect("changed", self._selectionChanged) 389 flightSelection.connect("changed", self._selectionChanged) 386 390 387 391 scrolledWindow = gtk.ScrolledWindow() … … 454 458 def _saveClicked(self, button): 455 459 """Called when the Save flight button is clicked.""" 460 self._saveSelected() 461 462 def _saveSelected(self): 463 """Save the selected flight.""" 456 464 flight = self._getSelectedFlight() 457 465 date = flight.departureTime.date() … … 533 541 self._wizard.jumpPage(self._nextDistance, finalize = False) 534 542 else: 535 flight = self._getSelectedFlight() 536 self._wizard._bookedFlight = flight 537 self._wizard.gui.enableFlightInfo() 538 539 self._updateDepartureGate() 543 self._flightSelected() 544 545 def _rowActivated(self, flightList, path, column): 546 """Called when a row is activated.""" 547 if not self._completed: 548 self._flightSelected() 549 550 def _flightSelected(self): 551 """Called when a flight has been selected.""" 552 flight = self._getSelectedFlight() 553 self._wizard._bookedFlight = flight 554 self._wizard.gui.enableFlightInfo() 555 556 self._updateDepartureGate() 540 557 541 558 def _getSelectedFlight(self): … … 547 564 548 565 return self._flights[index] 566 567 def _listButtonPressed(self, widget, event): 568 """Called when a mouse button is pressed on the flight list.""" 569 if event.type!=EVENT_BUTTON_PRESS or event.button!=3: 570 return 571 572 (path, _, _, _) = self._flightList.get_path_at_pos(int(event.x), 573 int(event.y)) 574 selection = self._flightList.get_selection() 575 selection.unselect_all() 576 selection.select_path(path) 577 578 menu = self._getListPopupMenu() 579 if pygobject: 580 menu.popup(None, None, None, None, event.button, event.time) 581 else: 582 menu.popup(None, None, None, event.button, event.time) 549 583 550 584 def _updateDepartureGate(self): … … 645 679 646 680 return dialog 681 682 def _getListPopupMenu(self): 683 """Get the flight list popup menu.""" 684 if self._flightListPopupMenu is None: 685 menu = gtk.Menu() 686 687 menuItem = gtk.MenuItem() 688 menuItem.set_label(xstr("flightsel_popup_select")) 689 menuItem.set_use_underline(True) 690 menuItem.connect("activate", self._popupSelect) 691 menuItem.show() 692 693 menu.append(menuItem) 694 695 menuItem = gtk.MenuItem() 696 menuItem.set_label(xstr("flightsel_popup_save")) 697 menuItem.set_use_underline(True) 698 menuItem.connect("activate", self._popupSave) 699 menuItem.show() 700 701 menu.append(menuItem) 702 703 self._flightListPopupMenu = menu 704 705 return self._flightListPopupMenu 706 707 def _popupSelect(self, menuItem): 708 """Called when the Select menu item is activated in the popup menu.""" 709 if not self._completed: 710 self._flightSelected() 711 712 def _popupSave(self, menuItem): 713 """Called when the Save menu item is activated in the popup menu.""" 714 if not self._completed: 715 self._saveSelected() 647 716 648 717 #-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.