bigboard r7354 - in trunk: . bigboard bigboard/stocks/apps



Author: marco
Date: Wed Jun 11 15:01:44 2008
New Revision: 7354
URL: http://svn.gnome.org/viewvc/bigboard?rev=7354&view=rev

Log:
Support for stock stylesheet. Start using it in the apps stock

Modified:
   trunk/bigboard/Makefile.am
   trunk/bigboard/big_widgets.py
   trunk/bigboard/stock.py
   trunk/bigboard/stocks/apps/apps_widgets.py
   trunk/main.py

Modified: trunk/bigboard/Makefile.am
==============================================================================
--- trunk/bigboard/Makefile.am	(original)
+++ trunk/bigboard/Makefile.am	Wed Jun 11 15:01:44 2008
@@ -36,7 +36,7 @@
 EXTRA_DIST += $(stocks_DATA)
 
 appstockdir=$(stocksdir)/apps
-appstock_PYTHON = stocks/apps/*.py stocks/apps/*.png
+appstock_PYTHON = stocks/apps/*.py stocks/apps/*.png stocks/apps/stock.css
 
 calendarstockdir=$(stocksdir)/google_calendar
 calendarstock_PYTHON = stocks/google_calendar/*.py stocks/google_calendar/*.png

Modified: trunk/bigboard/big_widgets.py
==============================================================================
--- trunk/bigboard/big_widgets.py	(original)
+++ trunk/bigboard/big_widgets.py	Wed Jun 11 15:01:44 2008
@@ -80,6 +80,11 @@
             self.__default_theme = theme
 
         return theme
+
+    def make_stock_theme(self, application_stylesheet):
+        return hippo.CanvasTheme(theme_engine = self.__theme.props.theme_engine,
+                                 theme_stylesheet = self.__theme.props.theme_stylesheet,
+                                 application_stylesheet = application_stylesheet)
         
     def get_theme(self):
         return self.__theme

Modified: trunk/bigboard/stock.py
==============================================================================
--- trunk/bigboard/stock.py	(original)
+++ trunk/bigboard/stock.py	Wed Jun 11 15:01:44 2008
@@ -132,6 +132,23 @@
 
         self.__cursize = None
         self.__box = hippo.CanvasBox()
+        self.__stylesheet = None
+
+        from bigboard.big_widgets import ThemeManager
+
+        self.__theme_mgr = ThemeManager.getInstance()
+        self.__theme_mgr.connect('theme-changed', self.__sync_theme)
+
+    def set_stylesheet(self, stylesheet):
+        self.__stylesheet = stylesheet
+        self.__sync_theme()
+
+    def __sync_theme(self, *args):
+        if self.__stylesheet:
+            theme = self.__theme_mgr.make_stock_theme(self.__stylesheet)
+            self.__box.set_theme(theme)
+        else:
+            self.__box.set_theme(None)
 
     def __sync_content(self):
         self.__box.remove_all()        

Modified: trunk/bigboard/stocks/apps/apps_widgets.py
==============================================================================
--- trunk/bigboard/stocks/apps/apps_widgets.py	(original)
+++ trunk/bigboard/stocks/apps/apps_widgets.py	Wed Jun 11 15:01:44 2008
@@ -30,13 +30,12 @@
             sub_kwargs['color'] = kwargs['color']
 
         title_kwargs = dict(sub_kwargs)
-        title_kwargs.update({'font': '14px',
-                             'xalign': hippo.ALIGNMENT_START, 
+        title_kwargs.update({'xalign': hippo.ALIGNMENT_START, 
                              'size-mode': hippo.CANVAS_SIZE_ELLIPSIZE_END
                            })
         self.__title = ActionLink(**title_kwargs)
         self.__title.connect("activated", lambda t: self.emit("title-clicked"))
-        subtitle_kwargs = {'font': '10px',
+        subtitle_kwargs = {'classes': 'app-subtitle',
                            'xalign': hippo.ALIGNMENT_START, 
                            'size-mode': hippo.CANVAS_SIZE_ELLIPSIZE_END                           
                            }

Modified: trunk/main.py
==============================================================================
--- trunk/main.py	(original)
+++ trunk/main.py	Wed Jun 11 15:01:44 2008
@@ -258,6 +258,11 @@
             else:
                 title = metainfo.title
             stock = class_constructor(metainfo, title=title, panel=panel)
+
+            stylesheet = os.path.join(dirpath, 'stock.css')
+            if os.path.exists(stylesheet):
+                stock.set_stylesheet(stylesheet)
+
             return stock                  
         except:
             _logger.exception("failed to add stock %s", classname)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]