- Fixed theming on label_list (Parent now works appropriately)

- Progress bar reverted back to normal rectangle
This commit is contained in:
noisymime 2008-06-05 23:48:42 +00:00
parent 067ca78fd2
commit 3d1e7aeb3f
6 changed files with 54 additions and 37 deletions

View File

@ -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):

View File

@ -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

View File

@ -90,30 +90,31 @@
<x>50%</x>
<y>25%</y>
</position>
<label_list id="option_dialog_list">
<font id="main">
<face>Tahoma</face>
<size id="default">30</size>
<size id="1024x768">38</size>
<size id="default">20</size>
<size id="1024x768">28</size>
<size id="800x600">30</size>
<size id="1920x1080">25</size>
</font>
<dimensions type="relativeToStage">
<width>40%</width>
<height>40%</height>
<dimensions type="relativeToParent">
<width>80%</width>
<height>80%</height>
</dimensions>
<position type="relativeToStage">
<x>50%</x>
<y>25%</y>
<position type="relativeToParent">
<x>10%</x>
<y>10%</y>
</position>
<!-- This determines the height of each item based on a percentage of the font size.
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>
<item_height_percent>1.20</item_height_percent>
<!-- 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 -->
@ -166,4 +167,5 @@
</label_list>
</group>
</gloss-theme>

View File

@ -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

View File

@ -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

View File

@ -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