r6978 - in bigboard/trunk: . bigboard bigboard/themes data
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r6978 - in bigboard/trunk: . bigboard bigboard/themes data
- Date: Wed, 5 Dec 2007 16:57:54 -0600 (CST)
Author: walters
Date: 2007-12-05 16:57:52 -0600 (Wed, 05 Dec 2007)
New Revision: 6978
Added:
bigboard/trunk/bigboard/themes/
bigboard/trunk/bigboard/themes/__init__.py
bigboard/trunk/bigboard/themes/default.py
bigboard/trunk/bigboard/themes/fedora.py
Modified:
bigboard/trunk/bigboard.schemas.in
bigboard/trunk/bigboard/Makefile.am
bigboard/trunk/data/Makefile.am
bigboard/trunk/main.py
Log:
Initial theming infrastructure.
Modified: bigboard/trunk/bigboard/Makefile.am
===================================================================
--- bigboard/trunk/bigboard/Makefile.am 2007-12-05 22:48:52 UTC (rev 6977)
+++ bigboard/trunk/bigboard/Makefile.am 2007-12-05 22:57:52 UTC (rev 6978)
@@ -26,6 +26,9 @@
libbigbardir=$(bigboarddir)/bigbar
libbigbar_PYTHON = bigbar/*.py
+themesdir=$(bigboarddir)/themes
+themes_PYTHON = themes/*.py
+
httplibdir=$(bigboarddir)/httplib2
httplib_PYTHON = httplib2/__init__.py \
httplib2/iri2uri.py
Added: bigboard/trunk/bigboard/themes/__init__.py
===================================================================
Added: bigboard/trunk/bigboard/themes/default.py
===================================================================
--- bigboard/trunk/bigboard/themes/default.py 2007-12-05 22:48:52 UTC (rev 6977)
+++ bigboard/trunk/bigboard/themes/default.py 2007-12-05 22:57:52 UTC (rev 6978)
@@ -0,0 +1,16 @@
+
+from bigboard.libbig.singletonmixin import Singleton
+
+class DefaultTheme(Singleton):
+ def __init__(self):
+ super(DefaultTheme, self).__init__()
+ self.background = 0xFFFFFFFF
+ self.foreground = 0x000000FF
+
+ def draw_header(self, cr, area):
+ cr.set_source_rgb(1.0, 1.0, 1.0)
+ cr.rectangle(area.x, area.y, area.width, area.height)
+ cr.fill()
+
+def getInstance():
+ return DefaultTheme.getInstance()
\ No newline at end of file
Added: bigboard/trunk/bigboard/themes/fedora.py
===================================================================
--- bigboard/trunk/bigboard/themes/fedora.py 2007-12-05 22:48:52 UTC (rev 6977)
+++ bigboard/trunk/bigboard/themes/fedora.py 2007-12-05 22:57:52 UTC (rev 6978)
@@ -0,0 +1,18 @@
+
+import gtk
+
+from bigboard.themes.default import DefaultTheme
+
+class FedoraTheme(DefaultTheme):
+ def __init__(self):
+ super(DefaultTheme, self).__init__()
+ self.background = 0x345B75FF
+ self.foreground = 0xFFFFFFFF
+
+ def draw_header(self, cr, area):
+ cr.set_source_rgb(1.0, 1.0, 1.0)
+ cr.rectangle(area.x, area.y, area.width, area.height)
+ cr.fill()
+
+def getInstance():
+ return FedoraTheme.getInstance()
\ No newline at end of file
Modified: bigboard/trunk/bigboard.schemas.in
===================================================================
--- bigboard/trunk/bigboard.schemas.in 2007-12-05 22:48:52 UTC (rev 6977)
+++ bigboard/trunk/bigboard.schemas.in 2007-12-05 22:57:52 UTC (rev 6978)
@@ -2,6 +2,16 @@
<gconfschemafile>
<schemalist>
<schema>
+ <key>/schemas/apps/bigboard/theme</key>
+ <applyto>/apps/bigboard/theme</applyto>
+ <owner>bigboard</owner>
+ <type>string</type>
+ <default>fedora</default>
+ <locale name="C">
+ <short>Graphical theme used for display</short>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/apps/bigboard/focus_key</key>
<applyto>/apps/bigboard/focus_key</applyto>
<owner>bigboard</owner>
Modified: bigboard/trunk/data/Makefile.am
===================================================================
--- bigboard/trunk/data/Makefile.am 2007-12-05 22:48:52 UTC (rev 6977)
+++ bigboard/trunk/data/Makefile.am 2007-12-05 22:57:52 UTC (rev 6978)
@@ -1,5 +1,8 @@
icon_DATA = bigboard-bulb.png bigboard-bulb-bw.png bigboard-collapse.png bigboard-document.png bigboard-down-arrow-disabled.png bigboard-down-arrow-enabled.png bigboard-expand.png bigboard-left-button.png bigboard-music.png bigboard-presentation.png bigboard-right-button.png bigboard-spreadsheet.png bigboard-today-disabled.png bigboard-today-enabled.png bigboard-up-arrow-disabled.png bigboard-up-arrow-enabled.png windows_key.png ctrl_esc_keys.png
icondir = $(datadir)/bigboard
-EXTRA_DIST= $(icon_DATA)
+theme_DATA = theme-fedora.xml
+themedir = $(datadir)/bigboard
+EXTRA_DIST= $(icon_DATA) $(theme_DATA)
+
Modified: bigboard/trunk/main.py
===================================================================
--- bigboard/trunk/main.py 2007-12-05 22:48:52 UTC (rev 6977)
+++ bigboard/trunk/main.py 2007-12-05 22:57:52 UTC (rev 6978)
@@ -1,7 +1,7 @@
#!/usr/bin/python
import os, sys, threading, getopt, logging, StringIO, stat, signal
-import xml.dom.minidom, urllib2, urlparse, subprocess
+import xml.dom.minidom, urllib2, urlparse, subprocess, weakref
import gobject, gtk, pango
import gnome.ui, gconf
@@ -222,7 +222,7 @@
pymodule = self.__load_builtin(module, **kwargs)
if not pymodule:
return None
- return Exchange(module, self.__widget_environ, pymodule=pymodule, is_notitle=(module.srcurl in self.__hardcoded_urls))
+ return Exchange(module, self.__widget_environ, pymodule=pymodule, is_notitle=(module.srcurl in self.__hardcoded_urls), panel=kwargs['panel'])
def render_url(self, url, **kwargs):
return self.render(self.load_metainfo(url), **kwargs)
@@ -272,12 +272,12 @@
from pyonlinedesktop import ggadget
self.widget = ggadget.Gadget(metainfo, env)
self.widget.show_all()
- self.set_property('widget', self.widget)
+ self.set_property('widget', self.widget)
class Exchange(hippo.CanvasBox):
"""A renderer for stocks."""
- def __init__(self, metainfo, env, pymodule=None, is_notitle=False):
+ def __init__(self, metainfo, env, pymodule=None, is_notitle=False, panel=None):
hippo.CanvasBox.__init__(self,
orientation=hippo.ORIENTATION_VERTICAL,
spacing=4)
@@ -285,6 +285,9 @@
self.__metainfo = metainfo
self.__env = env
self.__pymodule = pymodule
+ self.__panel = panel
+ self.__themehandler = self.__sync_theme
+ self.__panel.add_theme_listener(self.__themehandler)
self.__ticker_text = None
self.__ticker_container = None
self.__mini_more_button = None
@@ -310,12 +313,17 @@
self.append(self.__ticker_container)
self.__stockbox = hippo.CanvasBox()
self.append(self.__stockbox)
+ self.__sync_theme()
if pymodule:
pymodule.connect('visible', self.__render_pymodule)
self.__render_pymodule()
else:
self.__render_google_gadget()
+ def __sync_theme(self, *args):
+ theme = self.__panel.get_theme()
+ self.set_property('background-color', theme.background)
+
def on_delisted(self):
_logger.debug("on_delisted exchange %s" % (str(self)))
self.__unrender_pymodule()
@@ -393,7 +401,6 @@
self._canvas = hippo.Canvas()
self._dw.get_content().add(self._canvas)
- self._canvas.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(65535,65535,65535))
self._main_box = hippo.CanvasBox(border_right=1, border_color=0x999999FF, padding_bottom=4)
self._canvas.set_root(self._main_box)
@@ -417,6 +424,10 @@
self._stocks_box = hippo.CanvasBox(spacing=4)
self._main_box.append(self._stocks_box)
+
+ gconf_client.notify_add(GCONF_PREFIX + 'theme', self.__sync_theme)
+ self.__theme_listeners = []
+ self.__sync_theme()
gconf_client.notify_add(GCONF_PREFIX + 'expand', self._sync_size)
self._sync_size()
@@ -545,6 +556,29 @@
_logger.debug("queuing strut")
self.__queue_strut()
_logger.debug("queuing strut complete")
+
+ def __sync_theme(self, *args):
+ _logger.debug("doing theme sync")
+ themename = gconf.client_get_default().get_string(GCONF_PREFIX + 'theme')
+ if themename == 'fedora':
+ from bigboard.themes.fedora import FedoraTheme
+ self.__theme = FedoraTheme.getInstance()
+ else:
+ from bigboard.themes.default import DefaultTheme
+ self.__theme = DefaultTheme.getInstance()
+
+ self._canvas.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#%6X" % (self.__theme.background >> 8,)))
+ for ref in self.__theme_listeners:
+ listener = ref()
+ if listener:
+ listener()
+
+ # We have manual signals here because we can't subclass GObject
+ def add_theme_listener(self, listener):
+ self.__theme_listeners.append(weakref.ref(listener))
+
+ def get_theme(self):
+ return self.__theme
@log_except()
def __idle_do_strut(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]