From 4da7455001b47b7bbb0879dfed12b170d578a13a Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 20 Mar 2004 12:13:43 +0000 Subject: [PATCH] Stop themes from overriding the display of the colour-picker buttons in the options box (Rene Ejury). git-svn-id: https://rox.svn.sourceforge.net/svnroot/rox/trunk/ROX-Lib2@3393 66de3db3-b00d-0410-b41b-f4738ad19bea --- Help/Changes | 5 +++++ python/rox/OptionsBox.py | 24 +++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Help/Changes b/Help/Changes index ffef391..5744822 100644 --- a/Help/Changes +++ b/Help/Changes @@ -3,6 +3,11 @@ by Thomas Leonard http://rox.sourceforge.net +20-Mar-2004 +~~~~~~~~~~~ +Stop themes from overriding the display of the colour-picker buttons in +the options box (Rene Ejury). + 17-Mar-2004 ~~~~~~~~~~~ Warn about old versions of findrox.py. diff --git a/python/rox/OptionsBox.py b/python/rox/OptionsBox.py index ebc25b2..9e89cd8 100644 --- a/python/rox/OptionsBox.py +++ b/python/rox/OptionsBox.py @@ -627,22 +627,32 @@ class FontButton(g.Button): class ColourButton(g.Button): def __init__(self, option_box, option, title): g.Button.__init__(self) + self.c_box = g.EventBox() + self.add(self.c_box) self.option_box = option_box self.option = option self.title = title - self.set_size_request(64, 12) + self.set_size_request(64, 14) self.dialog = None self.connect('clicked', self.clicked) - + self.connect('expose-event', self.expose) + + def expose(self, widget, event): + # Some themes draw images and stuff here, so we have to + # override it manually. + self.c_box.window.draw_rectangle( + self.c_box.style.bg_gc[g.STATE_NORMAL], True, + 0, 0, + self.c_box.allocation.width, + self.c_box.allocation.height) + def set(self, c = None): if c is None: c = g.gdk.color_parse(self.option.value) - self.modify_bg(g.STATE_NORMAL, c) - self.modify_bg(g.STATE_PRELIGHT, c) - self.modify_bg(g.STATE_ACTIVE, c) - + self.c_box.modify_bg(g.STATE_NORMAL, c) + def get(self): - c = self.get_style().bg[g.STATE_NORMAL] + c = self.c_box.get_style().bg[g.STATE_NORMAL] return '#%04x%04x%04x' % (c.red, c.green, c.blue) def clicked(self, button): -- 2.11.4.GIT