r7077 - in bigboard/trunk: . bigboard/stocks/files bigboard/themes



Author: walters
Date: 2007-12-18 14:43:37 -0600 (Tue, 18 Dec 2007)
New Revision: 7077

Modified:
   bigboard/trunk/bigboard/stocks/files/FilesStock.py
   bigboard/trunk/bigboard/themes/default.py
   bigboard/trunk/main.py
Log:
Center "More".  Fixes for headers, in particular FileStock header.



Modified: bigboard/trunk/bigboard/stocks/files/FilesStock.py
===================================================================
--- bigboard/trunk/bigboard/stocks/files/FilesStock.py	2007-12-18 17:59:38 UTC (rev 7076)
+++ bigboard/trunk/bigboard/stocks/files/FilesStock.py	2007-12-18 20:43:37 UTC (rev 7077)
@@ -280,7 +280,7 @@
         vbox = CanvasVBox(border_color=0x0000000ff, spacing=4)
         self.get_root().append(vbox)
         self.__header = Header()
-        text = ThemedText(text=fobj.get_name(), font="14px Bold", xalign=hippo.ALIGNMENT_START)
+        text = ThemedText(theme_hints=['header'], text=fobj.get_name(), font="14px Bold", xalign=hippo.ALIGNMENT_START)
         self.__header.append(text, hippo.PACK_EXPAND)        
         vbox.append(self.__header)
         

Modified: bigboard/trunk/bigboard/themes/default.py
===================================================================
--- bigboard/trunk/bigboard/themes/default.py	2007-12-18 17:59:38 UTC (rev 7076)
+++ bigboard/trunk/bigboard/themes/default.py	2007-12-18 20:43:37 UTC (rev 7077)
@@ -70,12 +70,17 @@
         cr.rectangle(area.x+1, area.y, 1, area.height)
         cr.fill()
         cr.set_source_rgb(0.0, 0.0, 0.0)
-        cr.translate(4, 0)
         ctx = pangocairo.CairoContext(cr)
         layout = ctx.create_layout()
         layout.set_text('More')
-        desc = pango.FontDescription('Sans 12')
-        layout.set_font_description(desc)
+        desc = pango.FontDescription('Sans 10')
+        layout.set_font_description(desc)        
+        (more_w, more_h) = map(lambda x: x/pango.SCALE, layout.get_size())
+        more_xspace = area.width - more_w
+        if more_xspace < 0: more_xspace = 0
+        more_yspace = area.height - more_h
+        if more_yspace < 0: more_yspace = 0
+        cr.translate(more_xspace/2 + 1, more_yspace/2)
         cr.set_source_rgba(*self.header_fg)
         ctx.update_layout(layout)
         ctx.show_layout(layout)
@@ -84,6 +89,8 @@
         if isinstance(widget, ThemedWidgetMixin) \
            and isinstance(widget, hippo.CanvasText):
             hints = widget.get_theme_hints()
+            if 'header' in hints:
+                widget.set_properties(padding_left=8, padding_top=4, padding_bottom=2)
             if 'subforeground' in hints:
                 widget.set_properties(color=self.subforeground)
             else:

Modified: bigboard/trunk/main.py
===================================================================
--- bigboard/trunk/main.py	2007-12-18 17:59:38 UTC (rev 7076)
+++ bigboard/trunk/main.py	2007-12-18 20:43:37 UTC (rev 7077)
@@ -310,7 +310,7 @@
         self.__expanded = True
         if not is_notitle:
             self.__ticker_container = Header()
-            self.__ticker_text = ThemedText(text=metainfo.title, font="14px Bold", xalign=hippo.ALIGNMENT_START, padding_left=8)
+            self.__ticker_text = ThemedText(theme_hints=['header'], text=metainfo.title, font="14px Bold", xalign=hippo.ALIGNMENT_START)
             self.__ticker_text.connect("button-press-event", lambda text, event: self.__toggle_expanded())  
             self.__ticker_container.append(self.__ticker_text, hippo.PACK_EXPAND)
             



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