r7144 - in bigboard/trunk/bigboard: . themes



Author: walters
Date: 2008-01-07 16:18:10 -0600 (Mon, 07 Jan 2008)
New Revision: 7144

Modified:
   bigboard/trunk/bigboard/big_widgets.py
   bigboard/trunk/bigboard/themes/default.py
   bigboard/trunk/bigboard/themes/fedora.py
Log:
Fix singleton inheritance which had odd side effects (b.m.o #1360).



Modified: bigboard/trunk/bigboard/big_widgets.py
===================================================================
--- bigboard/trunk/bigboard/big_widgets.py	2008-01-07 22:14:21 UTC (rev 7143)
+++ bigboard/trunk/bigboard/big_widgets.py	2008-01-07 22:18:10 UTC (rev 7144)
@@ -66,13 +66,14 @@
     @log_except(_logger)
     def __sync_theme(self, *args):
         themename = gconf.client_get_default().get_string('/apps/bigboard/theme')
-        _logger.debug("doing theme sync: %r", themename)        
+        _logger.debug("doing theme sync: <THEMENAME>%r</THEMENAME>", themename)        
         if themename == 'Fedora':
-            from bigboard.themes.fedora import FedoraTheme
-            self.__theme = FedoraTheme.getInstance()
+            from bigboard.themes.fedora import getInstance as FedoraTheme
+            self.__theme = FedoraTheme()
         else:
-            from bigboard.themes.default import DefaultTheme
-            self.__theme = DefaultTheme.getInstance()        
+            from bigboard.themes.default import getInstance as DefaultTheme
+            self.__theme = DefaultTheme()        
+        _logger.debug("new target theme: <THEME>%r</THEME>", self.__theme)             
         self.emit('theme-changed')            
          
 class ThemedWidgetMixin(object):

Modified: bigboard/trunk/bigboard/themes/default.py
===================================================================
--- bigboard/trunk/bigboard/themes/default.py	2008-01-07 22:14:21 UTC (rev 7143)
+++ bigboard/trunk/bigboard/themes/default.py	2008-01-07 22:18:10 UTC (rev 7144)
@@ -5,7 +5,7 @@
 from bigboard.libbig.singletonmixin import Singleton
 from bigboard.big_widgets import ThemedWidgetMixin
 
-class DefaultTheme(Singleton):
+class DefaultTheme(object):
     def __init__(self):
         super(DefaultTheme, self).__init__()
         
@@ -102,5 +102,9 @@
             else:
                 widget.set_properties(color=self.foreground)
         
+_instance = None
 def getInstance():
-    return DefaultTheme.getInstance()
\ No newline at end of file
+    global _instance
+    if _instance is None:
+        _instance = DefaultTheme()
+    return _instance

Modified: bigboard/trunk/bigboard/themes/fedora.py
===================================================================
--- bigboard/trunk/bigboard/themes/fedora.py	2008-01-07 22:14:21 UTC (rev 7143)
+++ bigboard/trunk/bigboard/themes/fedora.py	2008-01-07 22:18:10 UTC (rev 7144)
@@ -62,6 +62,10 @@
             widget.set_properties(color=self.foreground)
         else:
             super(FedoraTheme, self).set_theme_properties(widget)
-        
+   
+_instance = None
 def getInstance():
-    return FedoraTheme.getInstance()
+    global _instance
+    if _instance is None:
+        _instance = FedoraTheme()
+    return _instance



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