r7104 - in bigboard/trunk: . bigboard bigboard/stocks/self
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7104 - in bigboard/trunk: . bigboard bigboard/stocks/self
- Date: Thu, 20 Dec 2007 12:55:10 -0600 (CST)
Author: walters
Date: 2007-12-20 12:55:09 -0600 (Thu, 20 Dec 2007)
New Revision: 7104
Modified:
bigboard/trunk/bigboard.schemas.in
bigboard/trunk/bigboard/big_widgets.py
bigboard/trunk/bigboard/stocks/self/portfoliomanager.py
bigboard/trunk/main.py
Log:
Implement theme switcher in portfolio manager.
Make theme switching work better.
Modified: bigboard/trunk/bigboard/big_widgets.py
===================================================================
--- bigboard/trunk/bigboard/big_widgets.py 2007-12-20 18:01:59 UTC (rev 7103)
+++ bigboard/trunk/bigboard/big_widgets.py 2007-12-20 18:55:09 UTC (rev 7104)
@@ -10,6 +10,7 @@
from libgimmie import DockWindow
from libbig.imagecache import URLImageCache
+from bigboard.libbig.logutil import log_except
import libbig, stock, globals, bigboard
from bigboard.libbig.signalobject import SignalObject
from bigboard.libbig.singletonmixin import Singleton
@@ -62,10 +63,11 @@
def get_theme(self):
return self.__theme
+ @log_except(_logger)
def __sync_theme(self, *args):
_logger.debug("doing theme sync")
themename = gconf.client_get_default().get_string('/apps/bigboard/theme')
- if themename == 'fedora':
+ if themename == 'Fedora':
from bigboard.themes.fedora import FedoraTheme
self.__theme = FedoraTheme.getInstance()
else:
@@ -110,6 +112,12 @@
super(CanvasCheckbox, self).__init__()
self.checkbox = gtk.CheckButton(label)
self.set_property('widget', self.checkbox)
+
+class CanvasCombo(hippo.CanvasWidget):
+ def __init__(self, model):
+ super(CanvasCombo, self).__init__()
+ self.combo = gtk.ComboBox(model)
+ self.set_property('widget', self.combo)
class CanvasTable(hippo.CanvasBox):
def __init__(self, column_spacing=0, row_spacing=0, **kwargs):
Modified: bigboard/trunk/bigboard/stocks/self/portfoliomanager.py
===================================================================
--- bigboard/trunk/bigboard/stocks/self/portfoliomanager.py 2007-12-20 18:01:59 UTC (rev 7103)
+++ bigboard/trunk/bigboard/stocks/self/portfoliomanager.py 2007-12-20 18:55:09 UTC (rev 7104)
@@ -8,7 +8,8 @@
import bigboard.globals
import bigboard.libbig as libbig
from bigboard.libbig.logutil import log_except
-from bigboard.big_widgets import CanvasMugshotURLImage, CanvasHBox, CanvasVBox, ActionLink, PrelightingCanvasBox, Button, CanvasCheckbox, CanvasURLImage
+from bigboard.big_widgets import CanvasMugshotURLImage, CanvasHBox, CanvasVBox, CanvasCombo
+from bigboard.big_widgets import ActionLink, PrelightingCanvasBox, Button, CanvasCheckbox, CanvasURLImage
from bigboard.overview_table import OverviewTable
_logger = logging.getLogger("bigboard.PortfolioManager")
@@ -21,6 +22,7 @@
}
GCONF_KEY_VISIBLE = '/apps/bigboard/visible'
+GCONF_KEY_THEME = '/apps/bigboard/theme'
class StockPreview(CanvasVBox):
__gsignals__ = {
@@ -227,6 +229,23 @@
self.__on_minimize_key_changed()
minimized_box.append(self.__minimized_check)
self.__left_box.append(minimized_box)
+
+ theme_box = CanvasHBox()
+ theme_box.append(hippo.CanvasText(text='Theme: ', font='12px'))
+ model = gtk.ListStore(gobject.TYPE_STRING)
+ model.append(['Milky'])
+ model.append(['Fedora'])
+ self.__theme_combo = CanvasCombo(model)
+ theme_box.append(self.__theme_combo, hippo.PACK_EXPAND)
+ textrender = gtk.CellRendererText()
+ self.__theme_combo.combo.pack_start(textrender, True)
+ self.__theme_combo.combo.add_attribute(textrender, 'text', 0)
+ self.__theme_combo.combo.connect('notify::active', self.__on_active_theme_changed)
+ gconf.client_get_default().notify_add(GCONF_KEY_THEME, self.__on_theme_key_changed)
+ self.__on_theme_key_changed()
+
+ self.__left_box.append(theme_box)
+
gadget_box = CanvasHBox()
gadget_box.append(hippo.CanvasText(text='Widget Link: ', font="12px"))
self.__google_gadget_entry = hippo.CanvasEntry()
@@ -329,12 +348,49 @@
_logger.debug("minimize toggled")
new_visible = not self.__minimized_check.checkbox.get_active()
old_visible = gconf.client_get_default().get_bool(GCONF_KEY_VISIBLE)
+ if old_visible == new_visible:
+ return
+ gconf.client_get_default().set_bool(GCONF_KEY_VISIBLE, new_visible)
+
+ def __findobj(self, model, obj, colidx=0):
+ iter = model.get_iter_first()
+ while iter:
+ val = model.get_value(iter, colidx)
+ if val == obj:
+ return iter
+ iter = model.iter_next(iter)
+
+ @log_except(_logger)
+ def __on_theme_key_changed(self, *args):
+ _logger.debug("theme key changed")
+ newtheme = gconf.client_get_default().get_string(GCONF_KEY_THEME)
+ iter = self.__findobj(self.__theme_combo.combo.get_property('model'), newtheme)
+ if not iter:
+ return
+ self.__theme_combo.combo.set_active_iter(iter)
+
+ def __on_active_theme_changed(self, *args):
+ iter = self.__theme_combo.combo.get_active_iter()
+ _logger.debug("theme iter changed to %r", iter)
+ prevtheme = gconf.client_get_default().get_string(GCONF_KEY_THEME)
+ if iter:
+ themename = self.__theme_combo.combo.get_property('model').get_value(iter, 0)
+ else:
+ themename = ''
+ if prevtheme == themename:
+ return
+ gconf.client_get_default().set_string(GCONF_KEY_THEME, themename)
+
+ @log_except(_logger)
+ def __on_minimize_toggled(self, *args):
+ _logger.debug("minimize toggled")
+ new_visible = not self.__minimized_check.checkbox.get_active()
+ old_visible = gconf.client_get_default().get_bool(GCONF_KEY_VISIBLE)
if old_visible != new_visible:
- gconf.client_get_default().set_bool(GCONF_KEY_VISIBLE, new_visible)
+ gconf.client_get_default().set_bool(GCONF_KEY_VISIBLE, new_visible)
@log_except(_logger)
def __on_listings_change(self, *args):
_logger.debug("got listings change")
if self.__preview:
self.__set_profile_stock(self.__preview.metainfo.srcurl)
-
\ No newline at end of file
Modified: bigboard/trunk/bigboard.schemas.in
===================================================================
--- bigboard/trunk/bigboard.schemas.in 2007-12-20 18:01:59 UTC (rev 7103)
+++ bigboard/trunk/bigboard.schemas.in 2007-12-20 18:55:09 UTC (rev 7104)
@@ -6,7 +6,7 @@
<applyto>/apps/bigboard/theme</applyto>
<owner>bigboard</owner>
<type>string</type>
- <default>default</default>
+ <default>Milky</default>
<locale name="C">
<short>Graphical theme used for display</short>
</locale>
Modified: bigboard/trunk/main.py
===================================================================
--- bigboard/trunk/main.py 2007-12-20 18:01:59 UTC (rev 7103)
+++ bigboard/trunk/main.py 2007-12-20 18:55:09 UTC (rev 7104)
@@ -322,17 +322,12 @@
self.append(self.__ticker_container)
self.__stockbox = hippo.CanvasBox()
self.append(self.__stockbox)
- self._on_theme_change()
if pymodule:
pymodule.connect('visible', self.__render_pymodule)
self.__render_pymodule()
else:
self.__render_google_gadget()
- def _on_theme_change(self, *args):
- theme = self.get_theme()
- self.set_property('background-color', theme.background)
-
def on_delisted(self):
_logger.debug("on_delisted exchange %s" % (str(self)))
self.__unrender_pymodule()
@@ -594,12 +589,14 @@
def __sync_theme(self, *args):
theme = self.__theme_mgr.get_theme()
+ _logger.debug("syncing with theme %r", theme)
if self.__compositing:
self._dw.realize()
+ self._dw.set_opacity(1.0)
self._dw.set_opacity(theme.opacity)
self._canvas.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#%6X" % (theme.background >> 8,)))
- self._canvas.queue_draw_area(0,0,-1,-1)
-
+ self._dw.queue_draw_area(0,0,-1,-1)
+
def get_theme(self):
return self.__theme
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]