From 87c681cb3b3cdb4d64dd962827d8562b389c1987 Mon Sep 17 00:00:00 2001 From: noisymime Date: Tue, 13 May 2008 13:45:59 +0000 Subject: [PATCH] - More significant work on label_list and music playscreen --- modules/music_player/music_player.py | 4 +- modules/music_player/play_screen.py | 12 +++- modules/music_player/playlist.py | 4 ++ themeMgr.py | 4 +- themes/Pear/down.png | Bin 0 -> 1373 bytes themes/Pear/music.xml | 14 +++-- themes/Pear/music_play_screen.xml | 39 +++++++++++-- themes/Pear/up.png | Bin 0 -> 1357 bytes ui_elements/label_list.py | 81 +++++++++++++++++++-------- 9 files changed, 121 insertions(+), 37 deletions(-) create mode 100755 themes/Pear/down.png create mode 100755 themes/Pear/up.png diff --git a/modules/music_player/music_player.py b/modules/music_player/music_player.py index db582df..cdc6b42 100644 --- a/modules/music_player/music_player.py +++ b/modules/music_player/music_player.py @@ -138,7 +138,9 @@ class Module: elif self.current_context == self.CONTEXT_PLAY_SCR: if (event.keyval == clutter.keysyms.Escape): self.current_context = self.previous_context - self.play_screen.hide() + self.play_screen.undisplay() + else: + self.play_screen.on_key_press_event(stage, event) #Fills self.list2 with songs from an album def process_songlist_from_album(self, list_item, album): diff --git a/modules/music_player/play_screen.py b/modules/music_player/play_screen.py index be03d15..ce7bca8 100644 --- a/modules/music_player/play_screen.py +++ b/modules/music_player/play_screen.py @@ -26,6 +26,12 @@ class PlayScreen(clutter.Group): self.main_img_theme = self.glossMgr.themeMgr.get_imageFrame("music_playing_image") self.img_size = self.main_img_theme.img_size + def on_key_press_event(self, stage, event): + if (event.keyval == clutter.keysyms.Up): + self.song_list.input_queue.input(event) + elif (event.keyval == clutter.keysyms.Down): + self.song_list.input_queue.input(event) + def append_playlist(self, playlist): self.playlist.add_songs(playlist.songs) @@ -68,6 +74,7 @@ class PlayScreen(clutter.Group): self.song_list.add_item(song.name) self.opacity_behaviour.apply(self.song_list) self.song_list.set_opacity(0) + self.song_list.select_first() self.song_list.show() self.add(self.song_list) @@ -76,5 +83,6 @@ class PlayScreen(clutter.Group): self.timeline.start() - def hide(self): - pass \ No newline at end of file + def undisplay(self): + self.playlist.stop() + self.hide() \ No newline at end of file diff --git a/modules/music_player/playlist.py b/modules/music_player/playlist.py index 823ff10..d1f8be7 100644 --- a/modules/music_player/playlist.py +++ b/modules/music_player/playlist.py @@ -34,6 +34,10 @@ class Playlist: self.position += 1 self.play() + def stop(self): + if self.is_playing: + self.audio_controller.stop_audio() + def add_song(self, song): self.songs.append(song) diff --git a/themeMgr.py b/themeMgr.py index d1b2f23..5dcf780 100644 --- a/themeMgr.py +++ b/themeMgr.py @@ -339,7 +339,7 @@ class ThemeMgr: if not use_reflections is None: use_reflections = (use_reflections.upper() == "TRUE") else: - #Gotta have some default value. In reality if this is running, someone else has stuffed up by not providing the size in the theme + #Gotta have some default value. use_reflections = True quality = self.find_child_value(element, "quality") @@ -354,7 +354,7 @@ class ThemeMgr: #Default value quality = ImageFrame.QUALITY_NORMAL else: - #Gotta have some default value. In reality if this is running, someone else has stuffed up by not providing the size in the theme + #Gotta have some default value. quality = ImageFrame.QUALITY_NORMAL #Setup the pixbuf diff --git a/themes/Pear/down.png b/themes/Pear/down.png new file mode 100755 index 0000000000000000000000000000000000000000..1c3c00c7012f152588b41bcbc129f90040b343c3 GIT binary patch literal 1373 zcmV-j1)}004R^004l8008-<004k70040z008iK002YN000@UHgaFu00009 za7bBm000XT000XT0n*)m`~Uy|2XskIMF-Ua0Syi%kpy|80000nbVXQnMrmwiAWmUz zWdKDwTupg&XjE1pbZBL5Wpi9jd30!0Rx&U!HC%OYUu180ZZ2?hWC8Z5-2eap7<5Hg zbW?9;ba!ELWdK2BZ(?O2P-t&-Z*ypGa5T$~X8-^IA#_DpbXRg|bY*e?Q+04W7C39iRvP2c7}X)pHE$00Edm5dlSFSZSch+y-ob4Ac!MmiK|rfL9D(7TVDOCQzhG z2H<1h8-}x#E}{X91F{~NM9IpiNx<7Oo7AJsPNOK%qyc=S2P{_|NuM+TiykF4qnr@{ zo&KsL7!)@m!^VxsuyG?YY+M@=V~1<6fZB%&q)W`aU3#3Ooye)(ZofMRu=jP_7$H&L-X&z|@4i66>EiNwp914Zip63vhr{u$)@62ld@PBg_+Wc``zf6>(WGk;08=iPD<=|(xZCZX5d=Y#%v36s zq$r9HBaz5c+TRoJaw!o2VPUtJQk9r)b+yE|(9yUhnGG)>b#=be2nt z02s2_Y$+Ct?Kz#!nL$kerBX@q`FsI26PN8H^dthx1W=SDNpiVdc0myO%1otFIapp^ zei#mi^K@TMXX#l4z?4p>k0nWpJDtv1K@jfr@Eypqobvnqflw&)2fax^pCX{hlwz@1 z%;|L6tyb%$WXk38W1r6#*xcNFLU*%MJNgy@<(?_3vzfiy%*e9*SQN!TI2_K=p9Bm@ z1i+NZWQxgTQgXZ9vlffxcBjGBYBlBe`yXsZ5dc#vl`6&K@wm(7`d$!( zPg)IfxiXVw`FBwio0%At1ZW@vip-%T zNs`Cov0E&bI{?*cHLXgd7)&{xMH3NF%B--zzrVk*u<%2@UayFv7zhS~DPU~CzXj0H z0Y9Qm6G8{P^msh?0fNC`2IU`Hi-!5BmLg4>4UASRyFqcWj5pZups+0!xV8F`@x3XE=fHTMS;^gsn=w~dj}lF^~W{1;GZcDDaU zdHxw^G+tHfP};pkAd9-G2A~d{sK*I9zizlnngVs;36MjbtXh@QE#OlWAuS&8`r#j- fic(JJHlDo(TAYZ(riH9S00000NkvXXu0mjfcz9iR literal 0 HcmV?d00001 diff --git a/themes/Pear/music.xml b/themes/Pear/music.xml index eddc4b1..94418a9 100644 --- a/themes/Pear/music.xml +++ b/themes/Pear/music.xml @@ -29,8 +29,11 @@ 50% - 0 - 4 + + 1.00 @@ -65,8 +68,11 @@ 50% - 0 - 8 + + 1.00 diff --git a/themes/Pear/music_play_screen.xml b/themes/Pear/music_play_screen.xml index c034258..7d56cf1 100644 --- a/themes/Pear/music_play_screen.xml +++ b/themes/Pear/music_play_screen.xml @@ -14,12 +14,15 @@ 40% - 40% - 20% + 50% + 25% - 0 - 4 + + 1.00 @@ -44,7 +47,33 @@ 0 + + + up.png + + 3% + 3% + + + 0 + 0 + + + + + down.png + + 3% + 3% + + + 0 + 0 + + music/songlist_off.png + + @@ -59,7 +88,7 @@ 10% - 40% + 35% diff --git a/themes/Pear/up.png b/themes/Pear/up.png new file mode 100755 index 0000000000000000000000000000000000000000..c6a0454b0e3d0043323b4f53db3249cc05f8cfb7 GIT binary patch literal 1357 zcmV-T1+w~yP)004R^004l8008-<004k70040z008iK002YN000@UHgaFu00009 za7bBm000XT000XT0n*)m`~Uy|2XskIMF-Ua0Syiq$!s;U0000nbVXQnMrmwiAWmUz zWdKDwTupg&XjE1pbZBL5Wpi9jd30!0Rx&U!HC%OYUu180ZZ2?hWC8Z5-2eap7<5Hg zbW?9;ba!ELWdK2BZ(?O2P-t&-Z*ypGa5T$~X8-^IA#_DpbXRg|bY*e?Q+04#c2JV3J0|nSD zIzRwE0Dl610VRN;N(B*EK$8GXqF*Va$&915n0LU<5Srx-@C|TF|7D>bWwhom04GC$ z6_}+zn^Ggnz$oxe0Gw!988iv_*vy;)+9)-M5>?88SwQRPgN|NcaGOsm+4qU2bBDN|CFLA>sG6Eq1hWnQM3mFfkjnScM65VDezUBF+dkYt|UqN zHWrI*SgqEEnW)8JFxW$(&{8IoN#%06W7?PLNaP|I41T95%KF&YSksxPMHEGQFc@^D z(`mJX(X4HeE3eo4DiVpT+HAJPHh%bjh@$B5`~3^4RBESCD4fuGX4(?@;PrYZW3kxA z`1p9o5><>wqf?TkrBo`FEEEc7v^F%iEOO=d`(MW6@pY@!>S{UK1{e$mhb+r3RaH~@ ze7=>;v?Oxr@pxV;in3<2*_PUlwgI9jI(RGf6 zFqupf9*<`(nM|gN#o|BQpP9NMx68}Rvs+tRzgjGowjXxgVsv!$`O3=5&%3+3nZ3Qe zQ$Al1mg}`U-Twamc_0w@tyC&q_c+d`7#SJSA08f_Q>Po~fM2+O$$QHKY#Ox42=|X* zcV8L_h5$ov;^{t5`&#|RlSseuB+_p@iS!!+gZ;J&wAsm>09@0-v1Ky%7SO!T(hZgf2;H)|&{ugbgJIY{mejVEE{1_-uIaC91 z1Dv9*L7vgshH@{d3fusHph=Xf1+|!g=ao-GojQ*}8Ms6{aQ2p(gJ=H%T9!t8J#!~Y P00000NkvXXu0mjf&$wX& literal 0 HcmV?d00001 diff --git a/ui_elements/label_list.py b/ui_elements/label_list.py index fe58713..c7087e9 100644 --- a/ui_elements/label_list.py +++ b/ui_elements/label_list.py @@ -12,7 +12,7 @@ class LabelList(clutter.Group): #Default font font_string = "Tahoma 30" - item_gap = 0 + item_height_percent = 1.00 width = 0 def __init__(self, length): @@ -29,22 +29,28 @@ class LabelList(clutter.Group): self.displayMax = length self.displaySize = self.displayMax - self.displayMin + self.item_group = clutter.Group() + self.item_group.show() + self.inactive_item_background = None self.background_group = clutter.Group() self.background_group.show() self.add(self.background_group) + self.image_down = None + self.image_up = None + #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") #Quick check to make sure we found something if element is None: return None - self.item_gap = int(themeMgr.find_child_value(element, "item_gap")) - self.displayMax = int(themeMgr.find_child_value(element, "num_visible_elements")) + self.item_height_percent = float(themeMgr.find_child_value(element, "item_height_percent")) #Grab the font font_node = themeMgr.get_subnode(element, "font") @@ -62,18 +68,37 @@ 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) - print "Label List width: %s" % self.get_width() + #Set the up/down images + #This assumes images go in the bottom right corner, will add flexibility later + img_element_up = themeMgr.find_element(img_element, "id", "image_up") + img_element_down = themeMgr.find_element(img_element, "id", "image_down") + if not img_element_up is None: + img_element_up = img_element_up.childNodes + self.image_up = themeMgr.get_texture("image_up", self, element = img_element_up) + self.image_up.set_opacity(180) + self.image_up.set_position( self.width-self.image_up.get_width(), self.height+1) + self.image_up.show() + self.add(self.image_up) + if not img_element_down is None: + img_element_down = img_element_down.childNodes + self.image_down = themeMgr.get_texture("image_up", self, element = img_element_down) + self.image_down.set_opacity(180) + self.image_down.set_position( self.width-self.image_down.get_width()-self.image_up.get_width(), self.height+1) + self.image_down.show() + self.add(self.image_down) + - img_element = themeMgr.search_docs("label_list", id).getElementsByTagName("texture") - img_element = themeMgr.find_element(img_element, "id", "inactive_background") - if not img_element is None: - img_element = img_element.childNodes - self.inactive_item_background = themeMgr.get_texture("inactive_background", self, element = img_element) + self.item_group.set_clip(0, 0, self.width, self.height) + self.background_group.set_clip(0, 0, self.width, self.height) + + #Get the item background img + img_element_item = themeMgr.find_element(img_element, "id", "inactive_background") + if not img_element_item is None: + img_element_item = img_element_item.childNodes + self.inactive_item_background = themeMgr.get_texture("inactive_background", self, element = img_element_item) def on_key_press_event (self, event): self.input_queue.input(event) @@ -87,32 +112,42 @@ class LabelList(clutter.Group): tempLabel.set_text("S") self.label_height = tempLabel.get_height() + self.item_height = int(self.label_height * self.item_height_percent) + self.displayMax = self.height / self.label_height label_width = 0 + + #This has to go hear for layering purposes + if self.item_group.get_parent() is None: + self.add(self.item_group) - label_y = len(self.items) * (self.label_height + self.item_gap) + item_y = len(self.items) * self.item_height + label_y = item_y + ((self.item_height - self.label_height)/2) + label_y = int(label_y) #If a background pic is specified in the theme, clone it and add if not self.inactive_item_background is None: bg_img = clutter.CloneTexture(self.inactive_item_background) - bg_img.set_height(self.label_height) + bg_img.set_height(self.item_height) bg_img.set_width(self.width) - bg_img.set_position(0, label_y) - bg_img.show() + bg_img.set_position(0, item_y) self.background_group.add(bg_img) newItem = ListItem(self.font_string, itemLabel, label_list = self, max_width = self.width) newItem.set_position(0, label_y) - newItem.show() + if len(self.items) < self.displaySize: + newItem.show() + if not self.image_down is None: self.image_down.set_opacity(255) + if not self.inactive_item_background is None: bg_img.show() self.items.append(newItem) - self.add(newItem) + self.item_group.add(newItem) return newItem #Removes all items from the list def clear(self): for item in self.items: - self.remove(item) + self.item_group.remove(item) item = None self.items = [] self.selected = 0 @@ -121,7 +156,7 @@ class LabelList(clutter.Group): def display(self): if self.displayMax > len(self.items): self.displayMax = len(self.items) - self.displaySize = self.displayMax - self.displayMin + #self.displaySize = self.displayMax - self.displayMin #for i in range(self.displaySize): # self.menuItems[i].show() @@ -249,14 +284,14 @@ class LabelList(clutter.Group): (group_x, new_y )\ ) alpha = clutter.Alpha(timeline, clutter.ramp_inc_func) - self.behaviour1 = clutter.BehaviourPath(alpha, knots) - self.behaviour2 = clutter.BehaviourOpacity(opacity_start=outgoingMenuItem.get_opacity(), opacity_end=0, alpha=alpha) + self.behaviour_path = clutter.BehaviourPath(alpha, knots) + self.behaviour_opacity = clutter.BehaviourOpacity(opacity_start=outgoingMenuItem.get_opacity(), opacity_end=0, alpha=alpha) #print "Going to: "+ str(new_y) #print behaviour1.get_knots() - self.behaviour1.apply(self) - self.behaviour2.apply(outgoingMenuItem) + self.behaviour_path.apply(self.item_group) + self.behaviour_opacity.apply(outgoingMenuItem) import gobject class ListItem(clutter.Group):