From 1c5bd0e1b39b9a29b5a2426e09fcf82d14bbb02e Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Sat, 29 Apr 2006 15:44:44 +0000 Subject: [PATCH] Fix style editor color picker (Bug #0000065) svn: r6495 --- src/PluginUtils/_StyleEditor.py | 20 +++++++++++++------- src/glade/gramps.glade | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/PluginUtils/_StyleEditor.py b/src/PluginUtils/_StyleEditor.py index cb2de16a6..5baddb292 100644 --- a/src/PluginUtils/_StyleEditor.py +++ b/src/PluginUtils/_StyleEditor.py @@ -43,6 +43,7 @@ log = logging.getLogger(".") # #------------------------------------------------------------------------ import gtk +from gtk.gdk import Color import gtk.glade #------------------------------------------------------------------------ @@ -255,20 +256,25 @@ class StyleEditor: self.top.get_widget("lborder").set_active(p.get_left_border()) self.top.get_widget("rborder").set_active(p.get_right_border()) self.top.get_widget("bborder").set_active(p.get_bottom_border()) + self.fg_color = font.get_color() - self.top.get_widget("color").set_i8(self.fg_color[0],self.fg_color[1],self.fg_color[2],0) + c = Color(self.fg_color[0],self.fg_color[1],self.fg_color[2]) + self.top.get_widget("color").set_color(c) self.top.get_widget('color_code').set_text("#%02X%02X%02X" % self.fg_color) - + self.bg_color = p.get_background_color() - self.top.get_widget("bgcolor").set_i8(self.bg_color[0],self.bg_color[1],self.bg_color[2],0) + c = Color(self.bg_color[0],self.bg_color[1],self.bg_color[2]) + self.top.get_widget("bgcolor").set_color(c) self.top.get_widget('bgcolor_code').set_text("#%02X%02X%02X" % self.bg_color) - def bg_color_set(self,x,r,g,b,a): - self.bg_color = (r >> 8, g >> 8, b >> 8) + def bg_color_set(self,x): + c = x.get_color() + self.bg_color = (c.red >> 8, c.green >> 8, c.blue >> 8) self.top.get_widget('bgcolor_code').set_text("#%02X%02X%02X" % self.bg_color) - def fg_color_set(self,x,r,g,b,a): - self.fg_color = (r >> 8, g >> 8, b >> 8) + def fg_color_set(self,x): + c = x.get_color() + self.fg_color = (c.red >> 8, c.green >> 8, c.blue >> 8) self.top.get_widget('color_code').set_text("#%02X%02X%02X" % self.fg_color) def save_paragraph(self,p): diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index 021a9345e..024547cd2 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -4971,7 +4971,7 @@ Text Beside Icons - + True True False @@ -5843,7 +5843,7 @@ Text Beside Icons - + True True False