r7042 - in bigboard/trunk: . bigboard/themes
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7042 - in bigboard/trunk: . bigboard/themes
- Date: Wed, 12 Dec 2007 14:09:13 -0600 (CST)
Author: walters
Date: 2007-12-12 14:09:13 -0600 (Wed, 12 Dec 2007)
New Revision: 7042
Modified:
bigboard/trunk/bigboard/themes/default.py
bigboard/trunk/bigboard/themes/fedora.py
bigboard/trunk/main.py
Log:
Draw more button.
Modified: bigboard/trunk/bigboard/themes/default.py
===================================================================
--- bigboard/trunk/bigboard/themes/default.py 2007-12-12 18:58:01 UTC (rev 7041)
+++ bigboard/trunk/bigboard/themes/default.py 2007-12-12 20:09:13 UTC (rev 7042)
@@ -1,6 +1,6 @@
import sys
-import hippo, cairo
+import hippo, cairo, pangocairo, pango
from bigboard.libbig.singletonmixin import Singleton
@@ -12,10 +12,13 @@
self.foreground = 0x000000FF
self.subforeground = 0x666666FF
- self.header_top = self._rgba_to_cairo(self.foreground)
- self.header_start = self._rgb_to_cairo(0xC7C7C7)
- self.header_end = self._rgb_to_cairo(0xF4F4F4)
- self.header_bottom = self._rgba_to_cairo(self.foreground)
+ self.header_fg = self._rgba_to_cairo(self.foreground)
+ self.header_top = self._rgb_to_cairo(0x9EA3A5)
+ self.header_top2 = self._rgb_to_cairo(0xFFFFFF)
+ self.header_start = self._rgb_to_cairo(0xdEE6EB)
+ self.header_end = self._rgb_to_cairo(0xFFFFFF)
+ self.more_1 = self._rgb_to_cairo(0xFFFFFF)
+ self.more_2 = self._rgba_to_cairo(0xBBBFC299)
def _rgba_to_cairo(self, color):
return map(lambda c: c/255.0,
@@ -34,7 +37,10 @@
cr.set_source_rgba(*self.header_top)
cr.rectangle(area.x, area.y, area.width, 1)
cr.fill()
- gradient_y_start = area.y+1
+ cr.set_source_rgba(*self.header_top2)
+ cr.rectangle(area.x, area.y+1, area.width, 1)
+ cr.fill()
+ gradient_y_start = area.y+2
gradient_y_height = gradient_y_start+area.height-1
pat = cairo.LinearGradient(area.x, gradient_y_start,
area.x, gradient_y_height)
@@ -43,10 +49,27 @@
cr.set_source(pat)
cr.rectangle(area.x, gradient_y_start, area.width, gradient_y_height)
cr.fill()
- cr.set_source_rgba(*self.header_bottom)
- cr.rectangle(area.x, gradient_y_height, area.width, 1)
- cr.fill()
+ def draw_more_button(self, cr, area):
+ y = area.y+2
+ height = area.height-2
+ cr.set_source_rgb(*self.more_1)
+ cr.rectangle(area.x, y, 1, height)
+ cr.fill()
+ cr.set_source_rgba(*self.more_2)
+ 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)
+ cr.set_source_rgba(*self.header_fg)
+ ctx.update_layout(layout)
+ ctx.show_layout(layout)
+
def set_properties(self, widget):
if isinstance(widget, hippo.CanvasText) or \
isinstance(widget, hippo.CanvasLink):
Modified: bigboard/trunk/bigboard/themes/fedora.py
===================================================================
--- bigboard/trunk/bigboard/themes/fedora.py 2007-12-12 18:58:01 UTC (rev 7041)
+++ bigboard/trunk/bigboard/themes/fedora.py 2007-12-12 20:09:13 UTC (rev 7042)
@@ -14,7 +14,24 @@
self.header_start = self._rgb_to_cairo(0x436A85)
self.header_end = self._rgb_to_cairo(0x59809C)
self.header_bottom = self._rgba_to_cairo(0x244155FF)
- self.prelight = 0x59809CFF
+ self.prelight = 0x59809CFF
+ def draw_header(self, cr, area):
+ cr.set_source_rgba(*self.header_top)
+ cr.rectangle(area.x, area.y, area.width, 1)
+ cr.fill()
+ gradient_y_start = area.y+1
+ gradient_y_height = gradient_y_start+area.height-1
+ pat = cairo.LinearGradient(area.x, gradient_y_start,
+ area.x, gradient_y_height)
+ pat.add_color_stop_rgb(0.0, *self.header_start)
+ pat.add_color_stop_rgb(1.0, *self.header_end)
+ cr.set_source(pat)
+ cr.rectangle(area.x, gradient_y_start, area.width, gradient_y_height)
+ cr.fill()
+ cr.set_source_rgba(*self.header_bottom)
+ cr.rectangle(area.x, gradient_y_height, area.width, 1)
+ cr.fill()
+
def getInstance():
return FedoraTheme.getInstance()
\ No newline at end of file
Modified: bigboard/trunk/main.py
===================================================================
--- bigboard/trunk/main.py 2007-12-12 18:58:01 UTC (rev 7041)
+++ bigboard/trunk/main.py 2007-12-12 20:09:13 UTC (rev 7042)
@@ -275,15 +275,28 @@
self.widget.show_all()
self.set_property('widget', self.widget)
-class ThemedGradient(hippo.CanvasBox, ThemedWidgetMixin):
+class Header(hippo.CanvasBox, ThemedWidgetMixin):
def __init__(self):
- super(ThemedGradient, self).__init__(orientation=hippo.ORIENTATION_HORIZONTAL,
- background_color=0xFF0000FF)
+ super(Header, self).__init__(orientation=hippo.ORIENTATION_HORIZONTAL,
+ background_color=0xFF0000FF)
def do_paint_below_children(self, cr, dmgbox):
area = self.get_background_area()
self.get_theme().draw_header(cr, area)
-gobject.type_register(ThemedGradient)
+gobject.type_register(Header)
+
+class HeaderButton(hippo.CanvasBox, ThemedWidgetMixin):
+ def __init__(self):
+ hippo.CanvasBox.__init__(self, box_width=40, xalign=hippo.ALIGNMENT_END,
+ background_color=0x00000001)
+ self.set_clickable(True)
+ ThemedWidgetMixin.__init__(self, theme_hints=['header-text'])
+ self.append(hippo.CanvasText(text=" "))
+
+ def do_paint_below_children(self, cr, dmgbox):
+ area = self.get_background_area()
+ self.get_theme().draw_more_button(cr, area)
+gobject.type_register(HeaderButton)
class Exchange(hippo.CanvasBox, ThemedWidgetMixin):
"""A renderer for stocks."""
@@ -304,20 +317,15 @@
self.append(self.__sep)
self.__expanded = True
if not is_notitle:
- self.__ticker_container = ThemedGradient()
+ self.__ticker_container = Header()
self.__ticker_text = ThemedText(text=metainfo.title, font="14px Bold", xalign=hippo.ALIGNMENT_START, padding_left=8)
self.__ticker_text.connect("button-press-event", lambda text, event: self.__toggle_expanded())
self.__ticker_container.append(self.__ticker_text, hippo.PACK_EXPAND)
if pymodule and pymodule.has_more_button():
- more_button = Button(label='More', label_ypadding=-2)
- more_button.set_property('yalign', hippo.ALIGNMENT_CENTER)
+ more_button = HeaderButton()
more_button.connect("activated", lambda l: pymodule.on_more_clicked())
self.__ticker_container.append(more_button)
- self.__mini_more_button = Button(label='More', label_ypadding=-1)
- self.__mini_more_button.set_property('yalign', hippo.ALIGNMENT_CENTER)
- self.__mini_more_button.connect("activated", lambda l: pymodule.on_more_clicked())
- self.append(self.__mini_more_button)
self.append(self.__ticker_container)
self.__stockbox = hippo.CanvasBox()
@@ -414,7 +422,7 @@
self._main_box = hippo.CanvasBox(border_right=1, border_color=0x999999FF, padding_bottom=4)
self._canvas.set_root(self._main_box)
- self._header_box = ThemedGradient()
+ self._header_box = Header()
self._header_box.connect("button-press-event", self.__on_header_buttonpress)
self.__unpopout_button = Button(label='Hide', label_ypadding=-2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]