Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
MILWidget: Set color when prefs change
Browse files Browse the repository at this point in the history
  • Loading branch information
benvm committed Mar 13, 2011
1 parent b6087b2 commit 7dd3ddf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions garmon/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ def __post_init__(self):
self._pref_cbs.append(('mil.off-color', cb_id))

self.connect('notify::on', self._notify_cb)
self.connect('notify::on-color', self._notify_cb)
self.connect('notify::off-color', self._notify_cb)
self.notify('on')
self.command.connect('notify::data', self._data_changed_cb)

def _notify_cb(self, o, pspec):
if pspec.name == 'on':
self._update_color()

def _update_color(self):
if self.on:
self.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.on_color))
else:
Expand All @@ -82,6 +84,7 @@ def _notify_prefs_cb(self, pname, pvalue, args):
self.on_color = pvalue
elif pname == 'mil.off-color':
self.off_color = pvalue
self._update_color()


def _data_changed_cb(self, command, pspec):
Expand Down

0 comments on commit 7dd3ddf

Please sign in to comment.