Fix style editor color picker (Bug #0000065)

svn: r6495
This commit is contained in:
Brian Matherly 2006-04-29 15:44:44 +00:00
parent 0c2e17e0d2
commit 139bfe5b1e
2 changed files with 15 additions and 9 deletions

View File

@ -43,6 +43,7 @@ log = logging.getLogger(".")
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import gtk import gtk
from gtk.gdk import Color
import gtk.glade import gtk.glade
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -255,20 +256,25 @@ class StyleEditor:
self.top.get_widget("lborder").set_active(p.get_left_border()) 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("rborder").set_active(p.get_right_border())
self.top.get_widget("bborder").set_active(p.get_bottom_border()) self.top.get_widget("bborder").set_active(p.get_bottom_border())
self.fg_color = font.get_color() 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.top.get_widget('color_code').set_text("#%02X%02X%02X" % self.fg_color)
self.bg_color = p.get_background_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) self.top.get_widget('bgcolor_code').set_text("#%02X%02X%02X" % self.bg_color)
def bg_color_set(self,x,r,g,b,a): def bg_color_set(self,x):
self.bg_color = (r >> 8, g >> 8, b >> 8) 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) self.top.get_widget('bgcolor_code').set_text("#%02X%02X%02X" % self.bg_color)
def fg_color_set(self,x,r,g,b,a): def fg_color_set(self,x):
self.fg_color = (r >> 8, g >> 8, b >> 8) 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) self.top.get_widget('color_code').set_text("#%02X%02X%02X" % self.fg_color)
def save_paragraph(self,p): def save_paragraph(self,p):

View File

@ -4971,7 +4971,7 @@ Text Beside Icons</property>
</child> </child>
<child> <child>
<widget class="GtkColorButton" id="colorbutton1"> <widget class="GtkColorButton" id="color">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="use_alpha">False</property> <property name="use_alpha">False</property>
@ -5843,7 +5843,7 @@ Text Beside Icons</property>
</child> </child>
<child> <child>
<widget class="GtkColorButton" id="colorbutton2"> <widget class="GtkColorButton" id="bgcolor">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="use_alpha">False</property> <property name="use_alpha">False</property>