From f83270c7ae6fde54870169438a1ec1988758d329 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristoffer=20Gr=C3=B6nlund?= Date: Tue, 5 Jan 2010 09:08:09 +0100 Subject: [PATCH] Started work on trying to conform to hildon style guidelines --- jamaui/colors.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ jamaui/playerwindow.py | 11 ++++++---- jamaui/playlists.py | 1 + 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 jamaui/colors.py diff --git a/jamaui/colors.py b/jamaui/colors.py new file mode 100644 index 0000000..c17dbc9 --- /dev/null +++ b/jamaui/colors.py @@ -0,0 +1,56 @@ +# hildon colors + +import gtk +import hildon + +# See the Fremantle Master Layout Guide for more information: +# http://tinyurl.com/fremantle-master-layout-guide + +logical_font_names = ( + 'SystemFont', + 'EmpSystemFont', + 'SmallSystemFont', # Used for secondary text in buttons/TreeViews + 'EmpSmallSystemFont', + 'LargeSystemFont', # Used for empty TreeView text + 'X-LargeSystemFont', + 'XX-LargeSystemFont', + 'XXX-LargeSystemFont', + 'HomeSystemFont', +) + +logical_color_names = ( + 'ButtonTextColor', + 'ButtonTextPressedColor', + 'ButtonTextDisabledColor', + 'ActiveTextColor', # Used for Button values, etc.. + 'SecondaryTextColor', # Used for additional/secondary information +) + +def get_font_desc(logicalfontname): + settings = gtk.settings_get_default() + font_style = gtk.rc_get_style_by_paths(settings, logicalfontname, \ + None, None) + font_desc = font_style.font_desc + return font_desc + +def get_color(logicalcolorname): + settings = gtk.settings_get_default() + color_style = gtk.rc_get_style_by_paths(settings, 'GtkButton', \ + 'osso-logical-colors', gtk.Button) + return color_style.lookup_color(logicalcolorname) + +def font(name): + return get_font_desc(name).to_string() + + +def color(name): + return get_color('SecondaryTextColor').to_string() + +import sys +current_module = sys.modules[__name__] + +for fnt in logical_font_names: + setattr(current_module, fnt, font(fnt)) + +for clr in logical_color_names: + setattr(current_module, clr, color(clr)) diff --git a/jamaui/playerwindow.py b/jamaui/playerwindow.py index 2bb6598..c9b965b 100644 --- a/jamaui/playerwindow.py +++ b/jamaui/playerwindow.py @@ -35,6 +35,7 @@ import cgi from songposition import SongPosition from listbox import ListDialog +import colors log = logging.getLogger(__name__) class PlayerWindow(hildon.StackableWindow): @@ -169,6 +170,7 @@ class PlayerWindow(hildon.StackableWindow): def add_stock_button(self, btns, stock, cb): btn = hildon.GtkButton(gtk.HILDON_SIZE_FINGER_HEIGHT) btn.set_relief(gtk.RELIEF_NONE) + btn.set_focus_on_click(False) sz = gtk.ICON_SIZE_BUTTON btn.set_image(gtk.image_new_from_stock(stock, sz)) btn.connect('clicked', cb) @@ -199,14 +201,15 @@ class PlayerWindow(hildon.StackableWindow): self.playbtn.set_data('state', 'play') def set_labels(self, track, artist, album, playlist_pos, playlist_size): + if self.playlist.radio_mode: ppstr = 'Radio: %s'%(cgi.escape(self.playlist.radio_name)) else: - ppstr = 'Track %s of %s'%(int(playlist_pos)+1, playlist_size) + ppstr = 'Track %s of %s'%(colors.SmallSystemFont, colors.SecondaryTextColor, int(playlist_pos)+1, playlist_size) self.playlist_pos.set_markup(ppstr) - self.track.set_markup('%s'%(cgi.escape(track))) - self.artist.set_markup('%s'%(cgi.escape(artist))) - self.album.set_markup('%s'%(cgi.escape(album))) + self.track.set_markup('%s'%(colors.LargeSystemFont, cgi.escape(track))) + self.artist.set_markup('%s'%(cgi.escape(artist))) + self.album.set_markup('%s'%(colors.SecondaryTextColor, cgi.escape(album))) def show_banner(self, message, timeout = 2000): banner = hildon.hildon_banner_show_information(self, '', message) diff --git a/jamaui/playlists.py b/jamaui/playlists.py index 714ec55..ece1527 100644 --- a/jamaui/playlists.py +++ b/jamaui/playlists.py @@ -113,6 +113,7 @@ class PlaylistsWindow(hildon.StackableWindow): col = gtk.TreeViewColumn('Info') self.treeview.append_column(col) cell = gtk.CellRendererText() + cell.set_property('xalign', 1.0) col.pack_start(cell, True) col.add_attribute(cell, 'text', self.COL_INFO) -- 1.7.9.5