r7046 - in bigboard/trunk/bigboard: . stocks/apps stocks/files stocks/self themes
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r7046 - in bigboard/trunk/bigboard: . stocks/apps stocks/files stocks/self themes
- Date: Wed, 12 Dec 2007 17:32:59 -0600 (CST)
Author: walters
Date: 2007-12-12 17:32:58 -0600 (Wed, 12 Dec 2007)
New Revision: 7046
Modified:
bigboard/trunk/bigboard/big_widgets.py
bigboard/trunk/bigboard/stocks/apps/appbrowser.py
bigboard/trunk/bigboard/stocks/apps/apps_widgets.py
bigboard/trunk/bigboard/stocks/files/FilesStock.py
bigboard/trunk/bigboard/stocks/self/SelfStock.py
bigboard/trunk/bigboard/themes/default.py
bigboard/trunk/bigboard/themes/fedora.py
Log:
More work on Fedora theme.
Currently we're manually specifying certain widgets as
themed or not; longer term we probably want to either
theme everything or e.g. switch to GTK+ for dialogs.
Modified: bigboard/trunk/bigboard/big_widgets.py
===================================================================
--- bigboard/trunk/bigboard/big_widgets.py 2007-12-12 23:01:36 UTC (rev 7045)
+++ bigboard/trunk/bigboard/big_widgets.py 2007-12-12 23:32:58 UTC (rev 7046)
@@ -128,7 +128,7 @@
self.__layout.set_row_expand(row, expand)
-class GradientHeader(hippo.CanvasGradient, ThemedWidgetMixin):
+class GradientHeader(hippo.CanvasGradient):
def __init__(self, **kwargs):
hippo.CanvasGradient.__init__(self,
orientation=hippo.ORIENTATION_HORIZONTAL,
@@ -137,12 +137,11 @@
padding_left=4,
color=0x333333FF, **kwargs)
-class ActionLink(hippo.CanvasLink, ThemedWidgetMixin):
+class ActionLink(hippo.CanvasLink):
def __init__(self, underline=pango.UNDERLINE_NONE, **kwargs):
if not kwargs.has_key('color'):
kwargs['color'] = 0x0066DDFF
hippo.CanvasLink.__init__(self, **kwargs)
- ThemedWidgetMixin.__init__(self)
self.set_underline(underline)
def set_underline(self, underline):
@@ -154,7 +153,12 @@
attrs = self.get_property("attributes") and self.get_property("attributes") or pango.AttrList()
attrs.insert(pango.AttrUnderline(underline, end_index=len(self.get_property('text'))))
if len(attrs.get_iterator().get_attrs()) == 1:
- self.set_property("attributes", attrs)
+ self.set_property("attributes", attrs)
+
+class ThemedLink(ActionLink, ThemedWidgetMixin):
+ def __init__(self, **kwargs):
+ ActionLink.__init__(self, **kwargs)
+ ThemedWidgetMixin.__init__(self)
class ButtonLabel(gtk.Label):
def __init__(self, ypadding=0):
@@ -282,10 +286,11 @@
class PrelightingCanvasBox(hippo.CanvasBox, ThemedWidgetMixin):
"""A box with a background that changes color on mouse hover."""
- def __init__(self, **kwargs):
+ def __init__(self, enable_theme=False, **kwargs):
self.__hovered = False
self.__force_prelight = False
- self._prelighted = False
+ self._prelighted = False
+ self.__enable_theme = enable_theme
hippo.CanvasBox.__init__(self, **kwargs)
ThemedWidgetMixin.__init__(self)
self.connect('motion-notify-event', lambda self, event: self.__handle_motion(event))
@@ -298,20 +303,29 @@
self.sync_prelight_color()
+ def set_themed(self):
+ self.__enable_theme = True
+ self._on_theme_changed(self.get_theme())
+
def set_force_prelight(self, force):
self.__force_prelight = force
self.sync_prelight_color()
def _on_theme_changed(self, theme):
+ if self.__enable_theme:
+ self.__prelight = theme.prelight
+ else:
+ self.__prelight = 0xE2E2E2FF
+ self.__background = 0x00000000
self.sync_prelight_color()
# protected
def sync_prelight_color(self):
if self.__force_prelight or (self.__hovered and self.do_prelight()):
- self.set_property('background-color', self.get_theme().prelight)
+ self.set_property('background-color', self.__prelight)
self._prelighted = True
else:
- self.set_property('background-color', self.get_theme().background)
+ self.set_property('background-color', self.__background)
self._prelighted = False
# protected
@@ -373,15 +387,25 @@
self.__cb(self._prelighted)
class IconLink(PrelightingCanvasBox):
- def __init__(self, text="", prelight=True, img_scale_width=20, img_scale_height=20, spacing=4, underline=pango.UNDERLINE_NONE, **kwargs):
+ def __init__(self, text="", prelight=True, img_scale_width=20, img_scale_height=20, spacing=4, underline=pango.UNDERLINE_NONE,
+ themed=False,
+ **kwargs):
PrelightingCanvasBox.__init__(self,
orientation=hippo.ORIENTATION_HORIZONTAL,
spacing=spacing, **kwargs)
self.img = hippo.CanvasImage(scale_width=img_scale_width, scale_height=img_scale_height, xalign=hippo.ALIGNMENT_CENTER, yalign=hippo.ALIGNMENT_CENTER)
self.append(self.img)
- self.link = ActionLink(text=text, underline=underline, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END,)
+ link_kwargs = {'text': text,
+ 'underline': underline,
+ 'size_mode': hippo.CANVAS_SIZE_ELLIPSIZE_END}
+ if themed:
+ self.link = ThemedLink(**link_kwargs)
+ else:
+ self.link = ActionLink(**link_kwargs)
self.append(self.link)
self.__prelight = prelight
+ if themed:
+ self.set_themed()
# override
def do_prelight(self):
Modified: bigboard/trunk/bigboard/stocks/apps/appbrowser.py
===================================================================
--- bigboard/trunk/bigboard/stocks/apps/appbrowser.py 2007-12-12 23:01:36 UTC (rev 7045)
+++ bigboard/trunk/bigboard/stocks/apps/appbrowser.py 2007-12-12 23:32:58 UTC (rev 7046)
@@ -1,4 +1,4 @@
-import logging, time, urlparse, urllib, time
+import logging, time, urlparse, urllib, time, sys
import gobject, pango, gtk
import hippo, gconf
@@ -429,7 +429,7 @@
appsource = cat_used_apps
else:
appsource = categories[catname]
- for app in appsource:
+ for app in appsource:
overview = apps_widgets.AppDisplay(apps_widgets.AppLocation.APP_BROWSER, app)
overview.connect("button-press-event", self.__on_overview_click)
self.__table.add_column_item(section_key, overview)
Modified: bigboard/trunk/bigboard/stocks/apps/apps_widgets.py
===================================================================
--- bigboard/trunk/bigboard/stocks/apps/apps_widgets.py 2007-12-12 23:01:36 UTC (rev 7045)
+++ bigboard/trunk/bigboard/stocks/apps/apps_widgets.py 2007-12-12 23:32:58 UTC (rev 7046)
@@ -1,11 +1,12 @@
-import logging, time
+import logging, time, sys, os
import gmenu, gobject, pango, gnomedesktop
import hippo
import bigboard.globals as globals
import bigboard.apps_directory as apps_directory
-from bigboard.big_widgets import CanvasMugshotURLImage, PhotoContentItem, CanvasHBox, CanvasVBox, ActionLink, ThemedText
+from bigboard.big_widgets import CanvasMugshotURLImage, PhotoContentItem, CanvasHBox
+from bigboard.big_widgets import CanvasVBox, ActionLink, ThemedText, ThemedLink
class AppLocation:
(STOCK, APP_BROWSER, DESCRIPTION_HEADER) = range(3)
@@ -15,6 +16,8 @@
"title-clicked" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
}
def __init__(self, app_location, app=None, **kwargs):
+ if app_location == AppLocation.STOCK:
+ kwargs['enable_theme'] = True
PhotoContentItem.__init__(self, border_right=6, **kwargs)
self.__app = None
@@ -29,9 +32,24 @@
if kwargs.has_key('color'):
sub_kwargs['color'] = kwargs['color']
- self.__title = ActionLink(font="14px",xalign=hippo.ALIGNMENT_START, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END, **sub_kwargs)
+ title_kwargs = dict(sub_kwargs)
+ title_kwargs.update({'font': '14px',
+ 'xalign': hippo.ALIGNMENT_START,
+ 'size-mode': hippo.CANVAS_SIZE_ELLIPSIZE_END
+ })
+ if app_location == AppLocation.STOCK:
+ self.__title = ThemedLink(**title_kwargs)
+ else:
+ self.__title = ActionLink(**title_kwargs)
self.__title.connect("activated", lambda t: self.emit("title-clicked"))
- self.__subtitle = ThemedText(theme_hints=['subforeground'], font="10px",xalign=hippo.ALIGNMENT_START, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END)
+ subtitle_kwargs = {'font': '10px',
+ 'xalign': hippo.ALIGNMENT_START,
+ 'size-mode': hippo.CANVAS_SIZE_ELLIPSIZE_END
+ }
+ if app_location == AppLocation.STOCK:
+ self.__subtitle = ThemedText(theme_hints=['subforeground'], **subtitle_kwargs)
+ else:
+ self.__subtitle = hippo.CanvasText(**subtitle_kwargs)
self.__box.append(self.__title)
self.__box.append(self.__subtitle)
Modified: bigboard/trunk/bigboard/stocks/files/FilesStock.py
===================================================================
--- bigboard/trunk/bigboard/stocks/files/FilesStock.py 2007-12-12 23:01:36 UTC (rev 7045)
+++ bigboard/trunk/bigboard/stocks/files/FilesStock.py 2007-12-12 23:32:58 UTC (rev 7046)
@@ -77,8 +77,8 @@
def get_source_key(self):
return self._source_key
- def create_icon_link(self):
- link = IconLink(self.get_name())
+ def create_icon_link(self, themed=False):
+ link = IconLink(self.get_name(), themed=themed)
link.img.set_property('image-name', self.get_image_name())
link.link.connect("activated", lambda *args: self.emit('activated', link))
link.link.set_property("tooltip", self.get_full_name())
@@ -454,7 +454,7 @@
for a_file in self.__files:
if i >= self.__display_limit: break
if a_file.is_valid():
- link = a_file.create_icon_link()
+ link = a_file.create_icon_link(themed=True)
self._recentbox.append(link)
i += 1
Modified: bigboard/trunk/bigboard/stocks/self/SelfStock.py
===================================================================
--- bigboard/trunk/bigboard/stocks/self/SelfStock.py 2007-12-12 23:01:36 UTC (rev 7045)
+++ bigboard/trunk/bigboard/stocks/self/SelfStock.py 2007-12-12 23:32:58 UTC (rev 7046)
@@ -14,7 +14,7 @@
from bigboard.workboard import WorkBoard
from bigboard.stock import Stock, AbstractMugshotStock
from bigboard.big_widgets import CanvasMugshotURLImage, PhotoContentItem, CanvasVBox, CanvasHBox
-from bigboard.big_widgets import ActionLink, IconLink, Separator, ThemedText
+from bigboard.big_widgets import ActionLink, IconLink, Separator, ThemedText, ThemedLink
import bigboard.google
import portfoliomanager
@@ -249,6 +249,7 @@
self._box = hippo.CanvasBox(orientation=hippo.ORIENTATION_VERTICAL, spacing=4, padding_top=2)
self._namephoto_box = PhotoContentItem()
+ self._namephoto_box.set_themed()
self._namephoto_box.set_clickable(True)
self._namephoto_box.set_sync_prelight_callback(self.__on_sync_prelight)
self._namephoto_box.connect("button-press-event", lambda button, event: self.__on_activate())
@@ -275,7 +276,7 @@
self._box.append(self._whereim_box)
- self._signin = ActionLink(text="Enable Online Desktop")
+ self._signin = ThemedLink(text="Enable Online Desktop")
self._box.append(self._signin)
self._signin.connect("button-press-event", lambda signin, event: self.__do_account())
Modified: bigboard/trunk/bigboard/themes/default.py
===================================================================
--- bigboard/trunk/bigboard/themes/default.py 2007-12-12 23:01:36 UTC (rev 7045)
+++ bigboard/trunk/bigboard/themes/default.py 2007-12-12 23:32:58 UTC (rev 7046)
@@ -3,6 +3,7 @@
import hippo, cairo, pangocairo, pango
from bigboard.libbig.singletonmixin import Singleton
+from bigboard.big_widgets import ThemedWidgetMixin
class DefaultTheme(Singleton):
def __init__(self):
@@ -71,8 +72,8 @@
ctx.show_layout(layout)
def set_properties(self, widget):
- if isinstance(widget, hippo.CanvasText) or \
- isinstance(widget, hippo.CanvasLink):
+ if isinstance(widget, ThemedWidgetMixin) \
+ and isinstance(widget, hippo.CanvasText):
hints = widget.get_theme_hints()
if 'subforeground' in hints:
widget.set_properties(color=self.subforeground)
Modified: bigboard/trunk/bigboard/themes/fedora.py
===================================================================
--- bigboard/trunk/bigboard/themes/fedora.py 2007-12-12 23:01:36 UTC (rev 7045)
+++ bigboard/trunk/bigboard/themes/fedora.py 2007-12-12 23:32:58 UTC (rev 7046)
@@ -1,6 +1,6 @@
import os,sys
-import gtk
+import gtk,cairo
from bigboard.themes.default import DefaultTheme
@@ -9,12 +9,17 @@
super(FedoraTheme, self).__init__()
self.background = 0x345B75FF
self.foreground = 0xFFFFFFFF
+ self.header_fg = self._rgba_to_cairo(self.foreground)
self.subforeground = 0x95A9B6FF
self.header_top = self._rgba_to_cairo(0xCBD5DCFF)
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
+ self.more_1 = self._rgb_to_cairo(0x496D87)
+ self.more_2 = self._rgba_to_cairo(0xA9BCCA99)
+ self.more_start = self._rgb_to_cairo(0x66859C)
+ self.more_end = self._rgb_to_cairo(0x8BA6BA)
def draw_header(self, cr, area):
cr.set_source_rgba(*self.header_top)
@@ -33,5 +38,17 @@
cr.rectangle(area.x, gradient_y_height, area.width, 1)
cr.fill()
+ def draw_more_button(self, cr, area):
+ gradient_y_start = area.y+1
+ gradient_y_height = gradient_y_start+area.height-2
+ pat = cairo.LinearGradient(area.x, gradient_y_start,
+ area.x, gradient_y_height)
+ pat.add_color_stop_rgb(0.0, *self.more_start)
+ pat.add_color_stop_rgb(1.0, *self.more_end)
+ cr.set_source(pat)
+ cr.rectangle(area.x, gradient_y_start, area.width, gradient_y_height)
+ cr.fill()
+ super(FedoraTheme, self).draw_more_button(cr, area)
+
def getInstance():
return FedoraTheme.getInstance()
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]