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 84e1f06b4e
commit 1c5bd0e1b3
2 changed files with 15 additions and 9 deletions

View File

@ -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):

View File

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