From: epage Date: Wed, 23 Jun 2010 00:16:40 +0000 (+0000) Subject: Tweaking the UI based on feedback from Addison X-Git-Url: https://vcs.maemo.org/git/?p=nqaap;a=commitdiff_plain;h=2f98395b05d60dfd3560cc9ef55809b606566ff2 Tweaking the UI based on feedback from Addison * Bigger book name * Improved the display of all the playback control buttons Also * Added chapter name * Improved spacing * Improved previous/next buttons on some systems git-svn-id: file:///svnroot/nqaap/trunk@39 00ff6f12-f5ab-46b1-af0e-967c86d3154f --- diff --git a/src/opt/Nqa-Audiobook-player/Gui.py b/src/opt/Nqa-Audiobook-player/Gui.py index 2806a7f..8e63f95 100644 --- a/src/opt/Nqa-Audiobook-player/Gui.py +++ b/src/opt/Nqa-Audiobook-player/Gui.py @@ -64,8 +64,12 @@ class Gui(object): # Controls: # Label that hold the title of the book,and maybe the chapter - self.title = gtk.Label("Select a book to start listening") + self.title = gtk.Label() self.title.set_justify(gtk.JUSTIFY_CENTER) + self._set_display_title("Select a book to start listening") + + self.chapter = gtk.Label() + self.chapter.set_justify(gtk.JUSTIFY_CENTER) # Seekbar if hildonize.IS_FREMANTLE_SUPPORTED: @@ -84,18 +88,18 @@ class Gui(object): # Pause button if hildonize.IS_FREMANTLE_SUPPORTED: self.backButton = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL) - image = gtk.image_new_from_stock(gtk.STOCK_GO_BACK, gtk.HILDON_SIZE_FINGER_HEIGHT) + image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PREVIOUS, gtk.HILDON_SIZE_FINGER_HEIGHT) self.backButton.set_image(image) self.button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL) self.forwardButton = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL) - image = gtk.image_new_from_stock(gtk.STOCK_GO_FORWARD, gtk.HILDON_SIZE_FINGER_HEIGHT) + image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_NEXT, gtk.HILDON_SIZE_FINGER_HEIGHT) self.forwardButton.set_image(image) else: - self.backButton = gtk.Button(stock=gtk.STOCK_GO_BACK) + self.backButton = gtk.Button(stock=gtk.STOCK_MEDIA_PREVIOUS) self.button = gtk.Button() - self.forwardButton = gtk.Button(stock=gtk.STOCK_GO_FORWARD) + self.forwardButton = gtk.Button(stock=gtk.STOCK_MEDIA_NEXT) self.set_button_text("Play", "Start playing the audiobook") self.backButton.connect('clicked', self._on_previous_chapter) self.button.connect('clicked', self.play_pressed) # event @@ -108,8 +112,11 @@ class Gui(object): # Box to hold the controls: self._controlLayout = gtk.VBox() - self._controlLayout.pack_start(self.title, True, True, 0) - self._controlLayout.pack_start(self.seek, True, True, 0) + self._controlLayout.pack_start(gtk.Label(), True, True, 0) + self._controlLayout.pack_start(self.title, False, True, 0) + self._controlLayout.pack_start(self.chapter, False, True, 0) + self._controlLayout.pack_start(gtk.Label(), True, True, 0) + self._controlLayout.pack_start(self.seek, False, True, 0) self._controlLayout.pack_start(self._toolbar, False, True, 0) #Box that divides the layout in two: cover on the lefta @@ -529,7 +536,7 @@ class Gui(object): if hildonize.IS_FREMANTLE_SUPPORTED: self.button.set_text(title, text) else: - self.button.set_label("%s - %s" % (title, text)) + self.button.set_label("%s" % (title, )) def set_books(self, books): _moduleLogger.debug("new books") @@ -542,7 +549,7 @@ class Gui(object): bookName = self.__format_name(bookPath) self.set_button_text("Play", "Start playing the audiobook") # reset button - self.title.set_text(bookName) + self._set_display_title(bookName) if hildonize.IS_FREMANTLE_SUPPORTED: self.book_button.set_text("Audiobook", bookName) else: @@ -557,6 +564,7 @@ class Gui(object): chapter parameter is supposed to be the index for the chapter, not the name ''' self.auto_chapter_selected = True + self._set_display_chapter(str(chapterIndex + 1)) if hildonize.IS_FREMANTLE_SUPPORTED: self.chapter_button.set_text("Chapter", str(chapterIndex)) else: @@ -575,6 +583,12 @@ class Gui(object): i = button.get_selector().get_model(0).index[value] # get index of value from list button.set_active(i) # set active index to that index + def _set_display_title(self, title): + self.title.set_markup("%s" % title) + + def _set_display_chapter(self, chapter): + self.chapter.set_markup("Chapter %s" % chapter) + def _old_timeout_add_seconds(timeout, callback): return gobject.timeout_add(timeout * 1000, callback)