Permalink
Browse files

Changed the popup module to support configurable colors:

 - Config options for
    use-custom-colours : default False
    fg-colour : default #ffffff
    bg-colour : default #131313

The softer bg colour thanks to
the NotifyOSD wiki page here:
https://wiki.ubuntu.com/NotifyOSD
  • Loading branch information...
1 parent cf594f8 commit 791748f183b686e75664a6311a8f511087ea57da Colin Shea committed with Apr 13, 2009
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/modules/Popup.py
View
@@ -13,6 +13,9 @@ class Popup(NoteoModule):
'xOffset': 'integer(default=0)',
'yOffset': 'integer(default=30)',
'verticalSpacing': 'integer(default=2)',
+ 'use-custom-colours': 'boolean(default=False)',
+ 'fg-colour': 'string(default=\'#ffffff\')',
+ 'bg-colour': 'string(default=\'#131313\')',
}
def init(self):
self.noteo.gtk_required()
@@ -54,18 +57,19 @@ def create_popup(self, summary, content, icon):
popup = gtk.Window(gtk.WINDOW_POPUP)
max_chars = self.config['maxCharsPerLine']
+ popup.set_opacity(self.config['opacity'])
summary_label = gtk.Label()
summary_label.set_markup(summary)
- summary_label.show()
summary_label.set_line_wrap(True)
summary_label.set_width_chars(max_chars)
+ summary_label.show()
content_label = gtk.Label()
content_label.set_markup(content)
- content_label.show()
content_label.set_line_wrap(True)
content_label.set_width_chars(max_chars)
+ content_label.show()
vbox = gtk.VBox()
vbox.pack_start(summary_label)
@@ -74,9 +78,13 @@ def create_popup(self, summary, content, icon):
hbox = gtk.HBox()
hbox.pack_start(gtk.image_new_from_pixbuf(icon))
hbox.pack_start(vbox)
-
+
+ if self.config['use-custom-colours']:
+ popup.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.config['bg-colour']))
+ summary_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.config['fg-colour']))
+ content_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.config['fg-colour']))
+
popup.add(hbox)
- popup.set_opacity(self.config['opacity'])
popup.show_all()
return popup

0 comments on commit 791748f

Please sign in to comment.