- More significant work on label_list and music playscreen
This commit is contained in:
parent
3a5822db37
commit
87c681cb3b
|
@ -138,7 +138,9 @@ class Module:
|
||||||
elif self.current_context == self.CONTEXT_PLAY_SCR:
|
elif self.current_context == self.CONTEXT_PLAY_SCR:
|
||||||
if (event.keyval == clutter.keysyms.Escape):
|
if (event.keyval == clutter.keysyms.Escape):
|
||||||
self.current_context = self.previous_context
|
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
|
#Fills self.list2 with songs from an album
|
||||||
def process_songlist_from_album(self, list_item, album):
|
def process_songlist_from_album(self, list_item, album):
|
||||||
|
|
|
@ -26,6 +26,12 @@ class PlayScreen(clutter.Group):
|
||||||
self.main_img_theme = self.glossMgr.themeMgr.get_imageFrame("music_playing_image")
|
self.main_img_theme = self.glossMgr.themeMgr.get_imageFrame("music_playing_image")
|
||||||
self.img_size = self.main_img_theme.img_size
|
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):
|
def append_playlist(self, playlist):
|
||||||
self.playlist.add_songs(playlist.songs)
|
self.playlist.add_songs(playlist.songs)
|
||||||
|
|
||||||
|
@ -68,6 +74,7 @@ class PlayScreen(clutter.Group):
|
||||||
self.song_list.add_item(song.name)
|
self.song_list.add_item(song.name)
|
||||||
self.opacity_behaviour.apply(self.song_list)
|
self.opacity_behaviour.apply(self.song_list)
|
||||||
self.song_list.set_opacity(0)
|
self.song_list.set_opacity(0)
|
||||||
|
self.song_list.select_first()
|
||||||
self.song_list.show()
|
self.song_list.show()
|
||||||
self.add(self.song_list)
|
self.add(self.song_list)
|
||||||
|
|
||||||
|
@ -76,5 +83,6 @@ class PlayScreen(clutter.Group):
|
||||||
|
|
||||||
self.timeline.start()
|
self.timeline.start()
|
||||||
|
|
||||||
def hide(self):
|
def undisplay(self):
|
||||||
pass
|
self.playlist.stop()
|
||||||
|
self.hide()
|
|
@ -34,6 +34,10 @@ class Playlist:
|
||||||
self.position += 1
|
self.position += 1
|
||||||
self.play()
|
self.play()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
if self.is_playing:
|
||||||
|
self.audio_controller.stop_audio()
|
||||||
|
|
||||||
def add_song(self, song):
|
def add_song(self, song):
|
||||||
self.songs.append(song)
|
self.songs.append(song)
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,7 @@ class ThemeMgr:
|
||||||
if not use_reflections is None:
|
if not use_reflections is None:
|
||||||
use_reflections = (use_reflections.upper() == "TRUE")
|
use_reflections = (use_reflections.upper() == "TRUE")
|
||||||
else:
|
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
|
use_reflections = True
|
||||||
|
|
||||||
quality = self.find_child_value(element, "quality")
|
quality = self.find_child_value(element, "quality")
|
||||||
|
@ -354,7 +354,7 @@ class ThemeMgr:
|
||||||
#Default value
|
#Default value
|
||||||
quality = ImageFrame.QUALITY_NORMAL
|
quality = ImageFrame.QUALITY_NORMAL
|
||||||
else:
|
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
|
quality = ImageFrame.QUALITY_NORMAL
|
||||||
|
|
||||||
#Setup the pixbuf
|
#Setup the pixbuf
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -29,8 +29,11 @@
|
||||||
<y>50%</y>
|
<y>50%</y>
|
||||||
</position>
|
</position>
|
||||||
|
|
||||||
<item_gap>0</item_gap>
|
<!-- This determines the height of each item based on a percentage of the font size.
|
||||||
<num_visible_elements>4</num_visible_elements>
|
Eg: 1.00 means that each item will be the same height as the font,
|
||||||
|
1.50 means that the item will be 1.x times the height as the font etc
|
||||||
|
-->
|
||||||
|
<item_height_percent>1.00</item_height_percent>
|
||||||
|
|
||||||
<!-- These are the opacity and scale values for the 3 possible steps in the menu
|
<!-- These are the opacity and scale values for the 3 possible steps in the menu
|
||||||
Make all the values the same if you do not want these effects -->
|
Make all the values the same if you do not want these effects -->
|
||||||
|
@ -65,8 +68,11 @@
|
||||||
<y>50%</y>
|
<y>50%</y>
|
||||||
</position>
|
</position>
|
||||||
|
|
||||||
<item_gap>0</item_gap>
|
<!-- This determines the height of each item based on a percentage of the font size.
|
||||||
<num_visible_elements>8</num_visible_elements>
|
Eg: 1.00 means that each item will be the same height as the font,
|
||||||
|
1.50 means that the item will be 1.x times the height as the font etc
|
||||||
|
-->
|
||||||
|
<item_height_percent>1.00</item_height_percent>
|
||||||
|
|
||||||
<!-- These are the opacity and scale values for the 3 possible steps in the menu
|
<!-- These are the opacity and scale values for the 3 possible steps in the menu
|
||||||
Make all the values the same if you do not want these effects -->
|
Make all the values the same if you do not want these effects -->
|
||||||
|
|
|
@ -14,12 +14,15 @@
|
||||||
<height>40%</height>
|
<height>40%</height>
|
||||||
</dimensions>
|
</dimensions>
|
||||||
<position type="relativeToStage">
|
<position type="relativeToStage">
|
||||||
<x>40%</x>
|
<x>50%</x>
|
||||||
<y>20%</y>
|
<y>25%</y>
|
||||||
</position>
|
</position>
|
||||||
|
|
||||||
<item_gap>0</item_gap>
|
<!-- This determines the height of each item based on a percentage of the font size.
|
||||||
<num_visible_elements>4</num_visible_elements>
|
Eg: 1.00 means that each item will be the same height as the font,
|
||||||
|
1.50 means that the item will be 1.x times the height as the font etc
|
||||||
|
-->
|
||||||
|
<item_height_percent>1.00</item_height_percent>
|
||||||
|
|
||||||
<!-- These are the opacity and scale values for the 3 possible steps in the menu
|
<!-- These are the opacity and scale values for the 3 possible steps in the menu
|
||||||
Make all the values the same if you do not want these effects -->
|
Make all the values the same if you do not want these effects -->
|
||||||
|
@ -44,7 +47,33 @@
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
</position>
|
</position>
|
||||||
</texture>
|
</texture>
|
||||||
|
|
||||||
|
<texture id="image_up">
|
||||||
|
<image>up.png</image>
|
||||||
|
<dimensions type="relativeToStage">
|
||||||
|
<width>3%</width>
|
||||||
|
<height>3%</height>
|
||||||
|
</dimensions>
|
||||||
|
<position type="relativeToSelf">
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
</position>
|
||||||
|
</texture>
|
||||||
|
|
||||||
|
<texture id="image_down">
|
||||||
|
<image>down.png</image>
|
||||||
|
<dimensions type="relativeToStage">
|
||||||
|
<width>3%</width>
|
||||||
|
<height>3%</height>
|
||||||
|
</dimensions>
|
||||||
|
<position type="blah">
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
</position>
|
||||||
|
</texture>
|
||||||
<inactive_background>music/songlist_off.png</inactive_background>
|
<inactive_background>music/songlist_off.png</inactive_background>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</label_list>
|
</label_list>
|
||||||
|
|
||||||
|
@ -59,7 +88,7 @@
|
||||||
</dimensions>
|
</dimensions>
|
||||||
<position type="relativeToStage">
|
<position type="relativeToStage">
|
||||||
<x>10%</x>
|
<x>10%</x>
|
||||||
<y>40%</y>
|
<y>35%</y>
|
||||||
</position>
|
</position>
|
||||||
</image_frame>
|
</image_frame>
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -12,7 +12,7 @@ class LabelList(clutter.Group):
|
||||||
|
|
||||||
#Default font
|
#Default font
|
||||||
font_string = "Tahoma 30"
|
font_string = "Tahoma 30"
|
||||||
item_gap = 0
|
item_height_percent = 1.00
|
||||||
width = 0
|
width = 0
|
||||||
|
|
||||||
def __init__(self, length):
|
def __init__(self, length):
|
||||||
|
@ -29,22 +29,28 @@ class LabelList(clutter.Group):
|
||||||
self.displayMax = length
|
self.displayMax = length
|
||||||
self.displaySize = self.displayMax - self.displayMin
|
self.displaySize = self.displayMax - self.displayMin
|
||||||
|
|
||||||
|
self.item_group = clutter.Group()
|
||||||
|
self.item_group.show()
|
||||||
|
|
||||||
self.inactive_item_background = None
|
self.inactive_item_background = None
|
||||||
self.background_group = clutter.Group()
|
self.background_group = clutter.Group()
|
||||||
self.background_group.show()
|
self.background_group.show()
|
||||||
self.add(self.background_group)
|
self.add(self.background_group)
|
||||||
|
|
||||||
|
self.image_down = None
|
||||||
|
self.image_up = None
|
||||||
|
|
||||||
#Selector bar image, moves with selections to show current item
|
#Selector bar image, moves with selections to show current item
|
||||||
self.selector_bar = None
|
self.selector_bar = None
|
||||||
|
|
||||||
def setup_from_theme_id(self, themeMgr, id):
|
def setup_from_theme_id(self, themeMgr, id):
|
||||||
element = themeMgr.search_docs("label_list", id).childNodes
|
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
|
#Quick check to make sure we found something
|
||||||
if element is None:
|
if element is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
self.item_gap = int(themeMgr.find_child_value(element, "item_gap"))
|
self.item_height_percent = float(themeMgr.find_child_value(element, "item_height_percent"))
|
||||||
self.displayMax = int(themeMgr.find_child_value(element, "num_visible_elements"))
|
|
||||||
|
|
||||||
#Grab the font
|
#Grab the font
|
||||||
font_node = themeMgr.get_subnode(element, "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.fps = int(themeMgr.find_child_value(element, "transition_fps"))
|
||||||
self.frames = int(themeMgr.find_child_value(element, "transition_frames"))
|
self.frames = int(themeMgr.find_child_value(element, "transition_frames"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
themeMgr.setup_actor(self, element, themeMgr.stage)
|
themeMgr.setup_actor(self, element, themeMgr.stage)
|
||||||
(self.width, self.height) = themeMgr.get_dimensions(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")
|
self.item_group.set_clip(0, 0, self.width, self.height)
|
||||||
img_element = themeMgr.find_element(img_element, "id", "inactive_background")
|
self.background_group.set_clip(0, 0, self.width, self.height)
|
||||||
if not img_element is None:
|
|
||||||
img_element = img_element.childNodes
|
#Get the item background img
|
||||||
self.inactive_item_background = themeMgr.get_texture("inactive_background", self, element = img_element)
|
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):
|
def on_key_press_event (self, event):
|
||||||
self.input_queue.input(event)
|
self.input_queue.input(event)
|
||||||
|
@ -87,32 +112,42 @@ class LabelList(clutter.Group):
|
||||||
tempLabel.set_text("S")
|
tempLabel.set_text("S")
|
||||||
|
|
||||||
self.label_height = tempLabel.get_height()
|
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
|
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 a background pic is specified in the theme, clone it and add
|
||||||
if not self.inactive_item_background is None:
|
if not self.inactive_item_background is None:
|
||||||
bg_img = clutter.CloneTexture(self.inactive_item_background)
|
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_width(self.width)
|
||||||
bg_img.set_position(0, label_y)
|
bg_img.set_position(0, item_y)
|
||||||
bg_img.show()
|
|
||||||
self.background_group.add(bg_img)
|
self.background_group.add(bg_img)
|
||||||
|
|
||||||
|
|
||||||
newItem = ListItem(self.font_string, itemLabel, label_list = self, max_width = self.width)
|
newItem = ListItem(self.font_string, itemLabel, label_list = self, max_width = self.width)
|
||||||
newItem.set_position(0, label_y)
|
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.items.append(newItem)
|
||||||
|
|
||||||
self.add(newItem)
|
self.item_group.add(newItem)
|
||||||
return newItem
|
return newItem
|
||||||
|
|
||||||
#Removes all items from the list
|
#Removes all items from the list
|
||||||
def clear(self):
|
def clear(self):
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
self.remove(item)
|
self.item_group.remove(item)
|
||||||
item = None
|
item = None
|
||||||
self.items = []
|
self.items = []
|
||||||
self.selected = 0
|
self.selected = 0
|
||||||
|
@ -121,7 +156,7 @@ class LabelList(clutter.Group):
|
||||||
def display(self):
|
def display(self):
|
||||||
if self.displayMax > len(self.items):
|
if self.displayMax > len(self.items):
|
||||||
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):
|
#for i in range(self.displaySize):
|
||||||
# self.menuItems[i].show()
|
# self.menuItems[i].show()
|
||||||
|
@ -249,14 +284,14 @@ class LabelList(clutter.Group):
|
||||||
(group_x, new_y )\
|
(group_x, new_y )\
|
||||||
)
|
)
|
||||||
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
|
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
|
||||||
self.behaviour1 = clutter.BehaviourPath(alpha, knots)
|
self.behaviour_path = clutter.BehaviourPath(alpha, knots)
|
||||||
self.behaviour2 = clutter.BehaviourOpacity(opacity_start=outgoingMenuItem.get_opacity(), opacity_end=0, alpha=alpha)
|
self.behaviour_opacity = clutter.BehaviourOpacity(opacity_start=outgoingMenuItem.get_opacity(), opacity_end=0, alpha=alpha)
|
||||||
|
|
||||||
#print "Going to: "+ str(new_y)
|
#print "Going to: "+ str(new_y)
|
||||||
#print behaviour1.get_knots()
|
#print behaviour1.get_knots()
|
||||||
|
|
||||||
self.behaviour1.apply(self)
|
self.behaviour_path.apply(self.item_group)
|
||||||
self.behaviour2.apply(outgoingMenuItem)
|
self.behaviour_opacity.apply(outgoingMenuItem)
|
||||||
|
|
||||||
import gobject
|
import gobject
|
||||||
class ListItem(clutter.Group):
|
class ListItem(clutter.Group):
|
||||||
|
|
Loading…
Reference in New Issue