Changeset 620:bcbc2bc37909 for src/mlx
- Timestamp:
- 04/04/15 07:50:45 (10 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/faultexplain.py
r617 r620 132 132 return alignment.get_children()[0] 133 133 134 def __init__(self ):134 def __init__(self, gui): 135 135 gtk.Frame.__init__(self) 136 137 self._gui = gui 136 138 self.set_label(xstr("info_faults")) 137 139 label = self.get_label_widget() … … 141 143 xscale = 1.0, yscale = 1.0) 142 144 alignment.set_padding(padding_top = 4, padding_bottom = 4, 143 padding_left = 8, padding_right = 8) 145 padding_left = 4, padding_right = 4) 146 147 self._outerBox = outerBox = gtk.EventBox() 148 outerBox.add(alignment) 149 150 self._innerBox = innerBox = gtk.EventBox() 151 alignment.add(self._innerBox) 152 153 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 154 xscale = 1.0, yscale = 1.0) 155 alignment.set_padding(padding_top = 0, padding_bottom = 0, 156 padding_left = 0, padding_right = 0) 157 158 innerBox.add(alignment) 144 159 145 160 scroller = gtk.ScrolledWindow() 146 161 scroller.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) 162 scroller.set_shadow_type(SHADOW_NONE) 147 163 148 164 self._faults = gtk.VBox() … … 150 166 scroller.add_with_viewport(self._faults) 151 167 168 alignment.add(scroller) 169 152 170 self._faultWidgets = {} 153 171 154 alignment.add(scroller)155 self. add(alignment)172 self.add(outerBox) 173 self.show_all() 156 174 157 175 self._numFaults = 0 … … 226 244 self._faultWidgets = {} 227 245 self._numFaults = self._numExplanations = 0 246 self._setColor() 247 248 def set_sensitive(self, sensitive): 249 """Set the sensitiviy of the widget. 250 251 The outer event box's sensitivity is changed only.""" 252 self._outerBox.set_sensitive(sensitive) 228 253 229 254 def _updateStats(self, numFaults = None, numExplanations = None): … … 246 271 247 272 if before!=after: 273 self._setColor() 248 274 self.emit("explanations-changed", after) 249 275 … … 253 279 (1 if hasExplanation else -1))) 254 280 281 def _setColor(self): 282 """Set the color to indicate if an unexplained fault is present or 283 not.""" 284 allExplained = self._numExplanations >= self._numFaults 285 if pygobject: 286 styleContext = self.get_style_context() 287 if allExplained: 288 outerColour = innerColour = gdk.RGBA(red = 0.0, green=0.0, 289 blue=0.0, alpha=0.0) 290 else: 291 outerColour = \ 292 styleContext.get_background_color(gtk.StateFlags.SELECTED) 293 innerColour = self._gui.backgroundColour 294 295 self._outerBox.override_background_color(gtk.StateFlags.NORMAL, 296 outerColour) 297 self._innerBox.override_background_color(gtk.StateFlags.NORMAL, 298 innerColour) 299 else: 300 style = self.rc_get_style() 301 self._outerBox.modify_bg(0, style.bg[0 if allExplained else 3]) 302 255 303 #------------------------------------------------------------------------------- 256 304 -
src/mlx/gui/gui.py
r609 r620 170 170 171 171 window.show_all() 172 172 173 self._wizard.grabDefault() 173 174 self._weightHelp.reset() … … 413 414 user.""" 414 415 return self._flightInfo.faultsFullyExplained 416 417 if pygobject: 418 @property 419 def backgroundColour(self): 420 """Get the background colour of the main window.""" 421 return self._mainWindow.get_style_context().\ 422 get_background_color(gtk.StateFlags.NORMAL) 415 423 416 424 def run(self): -
src/mlx/gui/info.py
r605 r620 68 68 self._comments.get_buffer().connect("changed", self._commentsChanged) 69 69 70 self._faultExplainWidget = FaultExplainWidget( )70 self._faultExplainWidget = FaultExplainWidget(gui) 71 71 self._faultExplainWidget.connect("explanations-changed", 72 72 self._faultExplanationsChanged)
Note:
See TracChangeset
for help on using the changeset viewer.