Changeset 281:c9e392a0a8b1 for src
- Timestamp:
- 07/07/12 12:23:21 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r276 r281 141 141 mainVBox.pack_start(gtk.HSeparator(), False, False, 0) 142 142 143 self._statusbar = Statusbar( )143 self._statusbar = Statusbar(iconDirectory) 144 144 mainVBox.pack_start(self._statusbar, False, False, 0) 145 145 -
src/mlx/gui/statusbar.py
r116 r281 15 15 class Statusbar(gtk.Frame, FlightStatusHandler): 16 16 """A status bar for the logger.""" 17 def __init__(self ):17 def __init__(self, iconDirectory): 18 18 """Construct the status bar.""" 19 19 gtk.Frame.__init__(self) … … 35 35 frameAlignment.add(statusBox) 36 36 37 iconPath = os.path.join(iconDirectory, "conn_grey.png") 38 self._connGreyIcon = pixbuf_new_from_file(iconPath) 39 40 iconPath = os.path.join(iconDirectory, "conn_red.png") 41 self._connRedIcon = pixbuf_new_from_file(iconPath) 42 43 iconPath = os.path.join(iconDirectory, "conn_green.png") 44 self._connGreenIcon = pixbuf_new_from_file(iconPath) 45 37 46 self._connStateArea = gtk.DrawingArea() 38 self._connStateArea.set_size_request(1 6, 16)47 self._connStateArea.set_size_request(18, 18) 39 48 self._connStateArea.set_tooltip_markup(xstr("statusbar_conn_tooltip")) 40 49 … … 105 114 106 115 def _drawConnState(self, connStateArea, eventOrContext): 107 """Draw the connection state.""" 108 context = eventOrContext if pygobject else connStateArea.window.cairo_create() 109 116 """Draw the connection state.""" 110 117 if self._connecting: 111 118 if self._connected: 112 context.set_source_rgb(0.0, 1.0, 0.0)119 icon = self._connGreenIcon 113 120 else: 114 context.set_source_rgb(1.0, 0.0, 0.0)121 icon = self._connRedIcon 115 122 else: 116 context.set_source_rgb(0.75, 0.75, 0.75)123 icon = self._connGreyIcon 117 124 118 width = connStateArea.get_allocated_width() if pygobject \119 else connStateArea.allocation.width120 height = connStateArea.get_allocated_height() if pygobject \121 else connStateArea.allocation.height122 context.arc(width/2, height/2, width/2, 0, 2*math.pi)123 124 context.fill()125 if pygobject: 126 gdk.cairo_set_source_pixbuf(eventOrContext, icon, 0, 0) 127 eventOrContext.paint() 128 else: 129 gc = connStateArea.get_style().fg_gc[gtk.STATE_NORMAL] 130 drawable = connStateArea.get_window() 131 drawable.draw_pixbuf(gc, icon, 0, 0, 0, 0) 125 132 126 133 def _updateFlightStatus(self):
Note:
See TracChangeset
for help on using the changeset viewer.