[kupfer] browser: Fix text mode text color
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] browser: Fix text mode text color
- Date: Tue, 18 Aug 2009 23:08:31 +0000 (UTC)
commit 2826c8727a4b1b1344e6b7a9532e72b41e8a129c
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Aug 19 01:07:59 2009 +0200
browser: Fix text mode text color
A line slipped in where we hardcode the text to black, which is of
course not desired. Look up the theme text color, save it, and use it.
kupfer/browser.py | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/kupfer/browser.py b/kupfer/browser.py
index 102ba6d..9b2349a 100644
--- a/kupfer/browser.py
+++ b/kupfer/browser.py
@@ -703,8 +703,8 @@ class Interface (gobject.GObject):
self._key_press_time = None
self._key_press_interval = 0.8
self._key_pressed = None
- self._theme_entry_bg = self.entry.style.bg[gtk.STATE_NORMAL]
- self._theme_entry_text = self.entry.style.text[gtk.STATE_NORMAL]
+ self._theme_colors = {}
+ self.entry.set_size_request(0, 0)
self.entry.connect("map-event", self._map_entry)
from pango import ELLIPSIZE_END
@@ -775,8 +775,9 @@ class Interface (gobject.GObject):
def _map_entry(self, widget, event):
"""When Interface's widget is mapped and shown on the screen"""
# Now we can read the style from the real theme
- self._theme_entry_bg = self.entry.style.bg[gtk.STATE_NORMAL]
- self._theme_entry_text = self.entry.style.text[gtk.STATE_NORMAL]
+ if not self._theme_colors:
+ self._theme_colors["bg"] = self.entry.style.bg[gtk.STATE_NORMAL]
+ self._theme_colors["text"] = self.entry.style.text[gtk.STATE_NORMAL]
self.update_text_mode()
def _pane_button_press(self, widget, event):
@@ -937,19 +938,22 @@ class Interface (gobject.GObject):
def update_text_mode(self):
"""update appearance to whether text mode enabled or not"""
+ if not self._theme_colors:
+ return
if self._is_text_mode:
self.entry.set_size_request(-1,-1)
self.entry.set_property("has-frame", True)
bgcolor = gtk.gdk.color_parse("light goldenrod yellow")
- self.entry.modify_text(gtk.STATE_NORMAL, self._theme_entry_text)
- self.entry.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse("black"))
+ theme_entry_text = self._theme_colors["text"]
+ self.entry.modify_text(gtk.STATE_NORMAL, theme_entry_text)
self.entry.modify_base(gtk.STATE_NORMAL, bgcolor)
self.current.set_state(gtk.STATE_ACTIVE)
else:
self.entry.set_size_request(0,0)
self.entry.set_property("has-frame", False)
- self.entry.modify_text(gtk.STATE_NORMAL, self._theme_entry_bg)
- self.entry.modify_base(gtk.STATE_NORMAL, self._theme_entry_bg)
+ theme_entry_bg = self._theme_colors["bg"]
+ self.entry.modify_text(gtk.STATE_NORMAL, theme_entry_bg)
+ self.entry.modify_base(gtk.STATE_NORMAL, theme_entry_bg)
self.current.set_state(gtk.STATE_SELECTED)
self._size_window_optimally()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]