diff --git a/modules/music_player/music_player.py b/modules/music_player/music_player.py index bb27072..da4ec66 100644 --- a/modules/music_player/music_player.py +++ b/modules/music_player/music_player.py @@ -140,12 +140,7 @@ class Module: artist = self.artistImageRow.get_current_object() songs = self.backend.get_songs_by_artistID(artist.artistID) self.query_playlist_add(songs) - self.playlist.play() - - #self.play_screen.append_playlist(self.playlist) - self.play_screen.display(self.artistImageRow.get_current_texture())#.get_texture()) - - self.current_context = self.CONTEXT_PLAY_SCR + self.previous_context = self.CONTEXT_ROW elif (event.keyval == clutter.keysyms.Escape): return True @@ -188,25 +183,40 @@ class Module: #If the current playlist is empty, its a no brainer: if self.playlist.num_songs() == 0: self.playlist.append_songs(songs) + self.playlist.play() + self.current_context = self.CONTEXT_PLAY_SCR + self.play_screen.display(self.artistImageRow.get_current_texture()) return option_dialog = OptionDialog(self.glossMgr) - opt1 = option_dialog.add_item("Append to current playlist") - opt2 = option_dialog.add_item("Append to current playlist and play next") - opt3 = option_dialog.add_item("Replace the current playlist") + self.query_options = [] + self.query_options.append(option_dialog.add_item("Append to current playlist")) + self.query_options.append(option_dialog.add_item("Append to current playlist and play next")) + self.query_options.append(option_dialog.add_item("Replace the current playlist")) - result = option_dialog.display("What would you like to do with these songs?") + option_dialog.connect("option-selected", self.option_dialog_cb, songs) + option_dialog.display("What would you like to do with these songs?") + + + def option_dialog_cb(self, data, result, songs): print "result: %s" % result #Handle options - if result == opt1: + if result == self.query_options[0]: self.playlist.append_songs(songs) - if result == opt2: + if result == self.query_options[1]: self.playlist.insert_songs(self.playlist.position, songs) - if result == opt3: + if result == self.query_options[2]: self.playlist.stop() self.playlist.clear() self.paylist.append_songs(songs) + + self.playlist.play() + + #self.play_screen.append_playlist(self.playlist) + self.current_context = self.CONTEXT_PLAY_SCR + self.play_screen.display(self.artistImageRow.get_current_texture())#.get_texture()) + #Fills self.list2 with songs from an album def process_songlist_from_album(self, list_item, album): diff --git a/multimedia/progress_bar.py b/multimedia/progress_bar.py index 456dd10..72a665a 100644 --- a/multimedia/progress_bar.py +++ b/multimedia/progress_bar.py @@ -43,11 +43,11 @@ class ProgressBar(clutter.Group): #self.bg.show() #self.add(self.bg) - self.fg = RoundedRectangle(20, self.height) + self.fg = clutter.Rectangle() #RoundedRectangle(20, self.height) self.fg.set_color(fgColour) self.fg.show() self.add(self.fg) - #self.fg.set_size(20, self.height) + self.fg.set_size(0, self.height) def display(self): self.displayed = True diff --git a/themes/Pear/main.xml b/themes/Pear/main.xml index 7a8435d..7f087cd 100644 --- a/themes/Pear/main.xml +++ b/themes/Pear/main.xml @@ -90,30 +90,31 @@ 50% 25% + Tahoma - 30 - 38 + 20 + 28 30 25 - - 40% - 40% + + 80% + 80% - - 50% - 25% + + 10% + 10% - 1.00 + 1.20 @@ -166,4 +167,5 @@ + diff --git a/ui_elements/label_list.py b/ui_elements/label_list.py index d5b5d33..0fbe4d4 100644 --- a/ui_elements/label_list.py +++ b/ui_elements/label_list.py @@ -56,9 +56,11 @@ class LabelList(clutter.Group): #Selector bar image, moves with selections to show current item self.selector_bar = None - def setup_from_theme_id(self, themeMgr, id): - element = themeMgr.search_docs("label_list", id).childNodes - img_element = themeMgr.search_docs("label_list", id).getElementsByTagName("texture") + def setup_from_theme_id(self, themeMgr, id, parent=None): + context = "label_list" + + element = themeMgr.search_docs(context, id).childNodes + img_element = themeMgr.search_docs(context, id).getElementsByTagName("texture") #Quick check to make sure we found something if element is None: return None @@ -81,8 +83,9 @@ class LabelList(clutter.Group): self.fps = int(themeMgr.find_child_value(element, "transition_fps")) self.frames = int(themeMgr.find_child_value(element, "transition_frames")) - themeMgr.setup_actor(self, element, themeMgr.stage) - (self.width, self.height) = themeMgr.get_dimensions(element, themeMgr.stage) + if parent is None: parent = themeMgr.stage + themeMgr.setup_actor(self, element, parent) + (self.width, self.height) = themeMgr.get_dimensions(element, parent) #Set the up/down images #This assumes images go in the bottom right corner, will add flexibility later @@ -120,6 +123,8 @@ class LabelList(clutter.Group): self.roll_point_min = 1 self.roll_point_max = self.displayMax + return True + def on_key_press_event (self, event): self.input_queue.input(event) return self.timeline diff --git a/ui_elements/option_dialog.py b/ui_elements/option_dialog.py index 928b180..846f88e 100644 --- a/ui_elements/option_dialog.py +++ b/ui_elements/option_dialog.py @@ -1,5 +1,6 @@ import clutter import pango +import gobject from threading import Semaphore from ui_elements.label_list import LabelList from ui_elements.rounded_rectangle import RoundedRectangle @@ -7,7 +8,7 @@ from ui_elements.rounded_rectangle import RoundedRectangle class OptionDialog(clutter.Group): #Setup signals __gsignals__ = { - "option_selected": ( + "option-selected": ( gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_INT,)) } @@ -21,7 +22,6 @@ class OptionDialog(clutter.Group): clutter.Group.__init__(self) self.glossMgr = glossMgr self.stage = glossMgr.stage - self.lock = Semaphore() self.backdrop = clutter.Rectangle() self.backdrop.set_color(clutter.color_parse('Black')) @@ -59,7 +59,7 @@ class OptionDialog(clutter.Group): def setup(self): themeMgr = self.glossMgr.themeMgr themeMgr.get_group("option_dialog", group = self) - self.label_list.setup_from_theme_id(themeMgr, "option_dialog_list") + result = self.label_list.setup_from_theme_id(themeMgr, "option_dialog_list", parent = self) def add_item(self, text): tmpItem = self.label_list.add_item(text) @@ -92,7 +92,7 @@ class OptionDialog(clutter.Group): self.behaviour_backdrop.apply(self.backdrop) self.timeline.start() - return self.label_list.get_current_item().get_data() + #return self.label_list.get_current_item().get_data() def hide(self): self.active = False @@ -114,6 +114,6 @@ class OptionDialog(clutter.Group): if event.keyval == clutter.keysyms.Up or event.keyval == clutter.keysyms.Down: self.label_list.on_key_press_event elif event.keyval == clutter.keysyms.Return: - self.lock.release() + self.emit("option_selected", self.label_list.selected) self.hide() self.glossMgr.ui_overide = None \ No newline at end of file diff --git a/utils/themeMgr.py b/utils/themeMgr.py index 50f528b..8dd31ad 100644 --- a/utils/themeMgr.py +++ b/utils/themeMgr.py @@ -441,10 +441,10 @@ class ThemeMgr: if parent is None: parent = self.stage - print self.find_child_value(element, "dimensions.width") - print self.get_dimensions(element, parent) + #print self.find_child_value(element, "dimensions.width") + #print self.get_dimensions(element, parent) self.setup_actor(group, element, parent) (group.width, group.height) = self.get_dimensions(element, parent) - print group.width + #print group.width return group \ No newline at end of file