Changeset 144:3c7d3b02a0be for src/mlx/gui
- Timestamp:
- 05/01/12 17:36:39 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/common.py
r132 r144 35 35 JUSTIFY_CENTER = gtk.JUSTIFY_CENTER 36 36 37 CONTROL_MASK = gdk.CONTROL_MASK 38 SHIFT_MASK = gdk.SHIFT_MASK 39 BUTTON1_MASK = gdk.BUTTON1_MASK 40 41 SCROLL_UP = gdk.SCROLL_UP 42 SCROLL_DOWN = gdk.SCROLL_DOWN 43 44 SPIN_USER_DEFINED = gtk.SPIN_USER_DEFINED 45 37 46 def text2unicode(text): 38 47 """Convert the given text, returned by a Gtk widget, to Unicode.""" … … 61 70 WRAP_WORD = gtk.WrapMode.WORD 62 71 JUSTIFY_CENTER = gtk.Justification.CENTER 72 73 CONTROL_MASK = gdk.ModifierType.CONTROL_MASK 74 SHIFT_MASK = gdk.ModifierType.SHIFT_MASK 75 BUTTON1_MASK = gdk.ModifierType.BUTTON1_MASK 76 77 SCROLL_UP = gdk.ScrollDirection.UP 78 SCROLL_DOWN = gdk.ScrollDirection.DOWN 79 80 SPIN_USER_DEFINED = gtk.SpinType.USER_DEFINED 63 81 64 82 import codecs -
src/mlx/gui/flight.py
r142 r144 1009 1009 self._tankFigure.set_size_request(38, -1) 1010 1010 self._tankFigure.set_visible_window(False) 1011 self._tankFigure.set_tooltip_markup(xstr("fuel_tank_tooltip")) 1011 1012 1012 1013 if pygobject: … … 1014 1015 else: 1015 1016 self._tankFigure.connect("expose_event", self._drawTankFigure) 1016 1017 self._tankFigure.connect("button_press_event", self._buttonPressed) 1018 self._tankFigure.connect("motion_notify_event", self._motionNotify) 1019 self._tankFigure.connect("scroll-event", self._scrolled) 1020 1017 1021 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 1018 1022 xscale = 0.0, yscale = 1.0) … … 1081 1085 rectangleInnerLeft = rectangleX0 + rectangleLineWidth 1082 1086 rectangleInnerRight = rectangleX1 - rectangleLineWidth 1083 rectangleInnerTop= rectangleY0 + rectangleLineWidth1084 rectangleInnerBottom = rectangleY1 - rectangleLineWidth1087 self._rectangleInnerTop = rectangleInnerTop = rectangleY0 + rectangleLineWidth 1088 self._rectangleInnerBottom = rectangleInnerBottom = rectangleY1 - rectangleLineWidth 1085 1089 1086 1090 rectangleInnerWidth = rectangleInnerRight - rectangleInnerLeft … … 1121 1125 return True 1122 1126 1127 def _setExpectedFromY(self, y): 1128 """Set the expected weight from the given Y-coordinate.""" 1129 level = (self._rectangleInnerBottom - y) / \ 1130 (self._rectangleInnerBottom - self._rectangleInnerTop) 1131 level = min(1.0, max(0.0, level)) 1132 self._expectedButton.set_value(level * self.capacity) 1133 1134 def _buttonPressed(self, tankFigure, event): 1135 """Called when a button is pressed in the figure. 1136 1137 The expected level will be set there.""" 1138 if event.button==1: 1139 self._setExpectedFromY(event.y) 1140 1141 def _motionNotify(self, tankFigure, event): 1142 """Called when the mouse pointer moves within the area of a tank figure.""" 1143 if event.state==BUTTON1_MASK: 1144 self._setExpectedFromY(event.y) 1145 1146 def _scrolled(self, tankFigure, event): 1147 """Called when a scroll event is received.""" 1148 increment = 1 if event.state==CONTROL_MASK \ 1149 else 100 if event.state==SHIFT_MASK \ 1150 else 10 if event.state==0 else 0 1151 if increment!=0: 1152 if event.direction==SCROLL_DOWN: 1153 increment *= -1 1154 self._expectedButton.spin(SPIN_USER_DEFINED, increment) 1155 1123 1156 def _expectedChanged(self, spinButton): 1124 1157 """Called when the expected value has changed.""" … … 1153 1186 self._pumpIndex = 0 1154 1187 1155 def activate(self):1156 """Activate the page."""1157 gui = self._wizard.gui1158 1159 self._setupTanks(gui.flight.aircraft.fuelTanks,1160 self._wizard._fuelData)1188 # def activate(self): 1189 # """Activate the page.""" 1190 # gui = self._wizard.gui 1191 1192 # self._setupTanks(gui.flight.aircraft.fuelTanks, 1193 # self._wizard._fuelData) 1161 1194 1162 1195 def finalize(self): … … 2520 2553 page.reset() 2521 2554 2522 self.setCurrentPage( 0)2555 self.setCurrentPage(6) 2523 2556 2524 2557 def getFleet(self, callback, force = False):
Note:
See TracChangeset
for help on using the changeset viewer.