Changeset 142:4fe5a65e7c37 for src
- Timestamp:
- 05/01/12 15:35:26 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r141 r142 1006 1006 self.pack_start(label, False, False, 4) 1007 1007 1008 self._tankFigure = gtk. DrawingArea()1008 self._tankFigure = gtk.EventBox() 1009 1009 self._tankFigure.set_size_request(38, -1) 1010 self._tankFigure.set_visible_window(False) 1010 1011 1011 1012 if pygobject: … … 1016 1017 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 1017 1018 xscale = 0.0, yscale = 1.0) 1018 alignment.add(self._tankFigure) 1019 alignment.add(self._tankFigure) 1019 1020 1020 1021 self.pack_start(alignment, True, True, 4) … … 1051 1052 self._tankFigure.queue_draw() 1052 1053 1053 def _drawTankFigure(self, connStateArea, eventOrContext):1054 def _drawTankFigure(self, tankFigure, eventOrContext): 1054 1055 """Draw the tank figure.""" 1055 1056 triangleSize = 5 1056 1057 context = eventOrContext if pygobject else connStateArea.window.cairo_create() 1058 1059 width = connStateArea.get_allocated_width() if pygobject \ 1060 else connStateArea.allocation.width 1061 height = connStateArea.get_allocated_height() if pygobject \ 1062 else connStateArea.allocation.height 1057 1058 context = eventOrContext if pygobject else tankFigure.window.cairo_create() 1059 (xOffset, yOffset) = (0, 0) if pygobject \ 1060 else (tankFigure.allocation.x, tankFigure.allocation.y) 1061 1062 width = tankFigure.get_allocated_width() if pygobject \ 1063 else tankFigure.allocation.width 1064 height = tankFigure.get_allocated_height() if pygobject \ 1065 else tankFigure.allocation.height 1063 1066 1064 1067 rectangleX0 = triangleSize … … 1070 1073 context.set_source_rgb(0.0, 0.0, 0.0) 1071 1074 context.set_line_width(rectangleLineWidth) 1072 context.rectangle( rectangleX0 + rectangleLineWidth/2,1073 rectangleY0 + rectangleLineWidth/2,1075 context.rectangle(xOffset + rectangleX0 + rectangleLineWidth/2, 1076 yOffset + rectangleY0 + rectangleLineWidth/2, 1074 1077 rectangleX1 - rectangleX0 - rectangleLineWidth, 1075 1078 rectangleY1 - rectangleY0 - rectangleLineWidth) … … 1087 1090 currentHeight = self.currentWeight * rectangleInnerHeight / self.capacity 1088 1091 currentX = rectangleInnerTop + rectangleInnerHeight - currentHeight 1089 context.rectangle(rectangleInnerLeft, 1090 rectangleInnerTop + rectangleInnerHeight - currentHeight, 1092 context.rectangle(xOffset + rectangleInnerLeft, 1093 yOffset + rectangleInnerTop + 1094 rectangleInnerHeight - currentHeight, 1091 1095 rectangleInnerWidth, currentHeight) 1092 1096 context.fill() … … 1097 1101 context.set_line_width(1.5) 1098 1102 context.set_source_rgb(0.0, 0.85, 0.85) 1099 context.move_to( rectangleX0,expectedY)1100 context.line_to( rectangleX1,expectedY)1103 context.move_to(xOffset + rectangleX0, yOffset + expectedY) 1104 context.line_to(xOffset + rectangleX1, yOffset + expectedY) 1101 1105 context.stroke() 1102 1106 1103 1107 context.set_line_width(0.0) 1104 context.move_to( 0,expectedY - triangleSize)1105 context.line_to( 0,expectedY + triangleSize)1106 context.line_to( rectangleX0 + 1,expectedY)1107 context.line_to( 0,expectedY - triangleSize)1108 context.move_to(xOffset + 0, yOffset + expectedY - triangleSize) 1109 context.line_to(xOffset + 0, yOffset + expectedY + triangleSize) 1110 context.line_to(xOffset + rectangleX0 + 1, yOffset + expectedY) 1111 context.line_to(xOffset + 0, yOffset + expectedY - triangleSize) 1108 1112 context.fill() 1109 1113 1110 1114 context.set_line_width(0.0) 1111 context.move_to( width,expectedY - triangleSize)1112 context.line_to( width,expectedY + triangleSize)1113 context.line_to( rectangleX1 - 1,expectedY)1114 context.line_to( width,expectedY - triangleSize)1115 context.move_to(xOffset + width, yOffset + expectedY - triangleSize) 1116 context.line_to(xOffset + width, yOffset + expectedY + triangleSize) 1117 context.line_to(xOffset + rectangleX1 - 1, yOffset + expectedY) 1118 context.line_to(xOffset + width, yOffset + expectedY - triangleSize) 1115 1119 context.fill() 1120 1121 return True 1116 1122 1117 1123 def _expectedChanged(self, spinButton): -
src/mlx/gui/gui.py
r139 r142 88 88 self._notebook = gtk.Notebook() 89 89 mainVBox.pack_start(self._notebook, True, True, 4) 90 90 91 91 self._wizard = Wizard(self) 92 92 label = gtk.Label(xstr("tab_flight"))
Note:
See TracChangeset
for help on using the changeset viewer.