Changeset 144:3c7d3b02a0be for src/mlx
- Timestamp:
- 05/01/12 17:36:39 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 3 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): -
src/mlx/i18n.py
r143 r144 306 306 self.add("fuel_get_busy", "Querying fuel information...") 307 307 self.add("fuel_pump_busy", "Pumping fuel...") 308 self.add("fuel_tank_tooltip", 309 "This part displays the current level of the fuel in the " 310 "compared to its capacity. The " 311 '<span color="turquoise">turquoise</span> ' 312 "slider shows the level that should be loaded into the tank " 313 "for the flight. You can click anywhere in the widget to " 314 "move the slider there. Or you can grab it by holding down " 315 "the left button of your mouse, and move the pointer up or " 316 "down. The scroll wheel on your mouse also increments or " 317 "decrements the amount of fuel by 10. If you hold down " 318 "the <b>Shift</b> key while scrolling, the steps will be " 319 "100, or with the <b>Control</b> key, 1.") 308 320 309 321 self.add("route_title", "Route") … … 831 843 self.add("fuel_get_busy", "Az üzemanyag lekérdezése...") 832 844 self.add("fuel_pump_busy", "Az üzemanyag pumpálása...") 845 self.add("fuel_tank_tooltip", 846 "Ez mutatja az üzemanyag szintjét a tartályban annak " 847 "kapacitásához mérve. A " 848 '<span color="turquoise">türkizkék</span> ' 849 "csúszka mutatja a repüléshez kívánt szintet. " 850 "Ha a bal gombbal bárhová kattintasz az ábrán, a csúszka " 851 "odaugrik. Ha a gombot lenyomva tartod, és az egérmutatót " 852 "föl-le mozgatod, a csúszka követi azt. Az egered görgőjével " 853 "is kezelheted a csúszkát. Alaphelyzetben az üzemanyag " 854 "mennyisége 10-zel nő, illetve csökken a görgetés irányától " 855 "függően. Ha a <b>Shift</b> billentyűt lenyomva tartod, " 856 "növekmény 100, a <b>Control</b> billentyűvel pedig 1 lesz.") 833 857 834 858 self.add("route_title", "Útvonal")
Note:
See TracChangeset
for help on using the changeset viewer.