diff --git a/modules/music_player/music_player.py b/modules/music_player/music_player.py
index ef88ccd..3dba2f0 100644
--- a/modules/music_player/music_player.py
+++ b/modules/music_player/music_player.py
@@ -49,11 +49,7 @@ class Module:
self.timeout_id = 0
self.queue_id = 0
- #There has be 3 of these labels, one left, center and right
- self.artist_label_1 = clutter.Label()
- self.artist_label_2 = clutter.Label()
- self.artist_label_3 = clutter.Label()
- self.artist_label_current = self.artist_label_1
+ self.heading = None
self.setup_ui()
@@ -64,12 +60,18 @@ class Module:
self.default_album_cover = self.glossMgr.themeMgr.get_texture("music_default_album_image", None, None).get_pixbuf()
self.main_img = self.glossMgr.themeMgr.get_imageFrame("music_main_image")
+ colour = clutter.color_parse('White')
+ font_string = "Tahoma 30"
+ self.heading = musicHeading(colour, font_string)
+ self.heading.set_position(400, 250)
+ """
self.artist_label_1.set_position(200, 200)
self.artist_label_2.set_position(200, 200)
self.artist_label_3.set_position(200, 200)
self.artist_label_1.set_color(clutter.color_parse('White'))
self.artist_label_2.set_color(clutter.color_parse('White'))
self.artist_label_3.set_color(clutter.color_parse('White'))
+ """
#Get the images dir setting our of the DB
#But also creates the setting if it doesn't already exist
@@ -128,7 +130,7 @@ class Module:
self.playlist.add_songs(songs)
self.playlist.play()
- self.play_screen.append_playlist(self.playlist)
+ #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
@@ -181,7 +183,7 @@ class Module:
self.conn_id = self.backend.connect("query-complete", self.update_for_albums, artist)
self.backend.get_albums_by_artistID(artist.artistID)
- self.transition_heading(self.direction, self.previous_music_object, artist, None)
+ self.heading.transition_heading(self.direction, self.previous_music_object, artist, None)
#thread = threading.Thread(target=self.backend.get_albums_by_artistID, args=(artist.artistID,))
#thread.start()
@@ -298,14 +300,52 @@ class Module:
self.main_img.show()
self.stage.add(self.main_img)
- self.stage.add(self.artist_label_1)
- self.artist_label_1.show()
- self.stage.add(self.artist_label_2)
- self.artist_label_2.show()
- self.stage.add(self.artist_label_3)
- self.artist_label_3.show()
+ self.stage.add(self.heading)
+ self.heading.show()
self.timeline_display.start()
+
+
+ def stop(self):
+ pass
+
+ def pause(self):
+ pass
+
+ def unpause(self):
+ pass
+
+class musicHeading(clutter.Group):
+ DIRECTION_LEFT, DIRECTION_RIGHT = range(2)
+
+ def __init__(self, colour = None, font_string = None):
+ clutter.Group.__init__(self)
+
+ if colour is None: colour = clutter.color_parse('White')
+ if font_string is None: font_string = "Tahoma 30"
+
+ #There has be 3 of these labels, one left, center and right
+ self.label_1 = clutter.Label()
+ self.label_2 = clutter.Label()
+ self.label_3 = clutter.Label()
+
+ self.label_1.set_font_name(font_string)
+ self.label_2.set_font_name(font_string)
+ self.label_3.set_font_name(font_string)
+
+ self.label_1.set_color(colour)
+ self.label_2.set_color(colour)
+ self.label_3.set_color(colour)
+
+ self.label_current = self.label_1
+
+ self.add(self.label_1)
+ self.add(self.label_2)
+ self.add(self.label_3)
+
+ self.label_1.show()
+ self.label_2.show()
+ self.label_3.show()
def transition_heading(self, direction, old_music_item, new_music_item, timeline = None):
start_timeline = False
@@ -317,33 +357,33 @@ class Module:
self.alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
if direction == self.DIRECTION_LEFT:
- if self.artist_label_current == self.artist_label_1: next_label = self.artist_label_2
- elif self.artist_label_current == self.artist_label_2: next_label = self.artist_label_3
- elif self.artist_label_current == self.artist_label_3: next_label = self.artist_label_1
+ if self.label_current == self.label_1: next_label = self.label_2
+ elif self.label_current == self.label_2: next_label = self.label_3
+ elif self.label_current == self.label_3: next_label = self.label_1
else:
- if self.artist_label_current == self.artist_label_1: next_label = self.artist_label_3
- elif self.artist_label_current == self.artist_label_2: next_label = self.artist_label_1
- elif self.artist_label_current == self.artist_label_3: next_label = self.artist_label_2
+ if self.label_current == self.label_1: next_label = self.label_3
+ elif self.label_current == self.label_2: next_label = self.label_1
+ elif self.label_current == self.label_3: next_label = self.label_2
next_label.set_opacity(0)
next_label.set_scale(0.5, 0.5)
next_label.set_text(new_music_item.name)
- if direction == self.DIRECTION_LEFT:
- next_label.set_x( self.artist_label_current.get_x() + (self.artist_label_current.get_width()))
- outgoing_x = self.artist_label_current.get_x() - int(self.artist_label_current.get_width()/2)
+ if direction == self.DIRECTION_RIGHT:
+ next_label.set_x( self.label_current.get_x() + (self.label_current.get_width()))
+ outgoing_x = self.label_current.get_x() - int(self.label_current.get_width()/2)
else:
- next_label.set_x( self.artist_label_current.get_x() - (next_label.get_width()))
- outgoing_x = self.artist_label_current.get_x() + int(self.artist_label_current.get_width())
+ next_label.set_x( self.label_current.get_x() - (next_label.get_width()))
+ outgoing_x = self.label_current.get_x() + int(self.label_current.get_width())
- incoming_x = self.artist_label_current.get_x() + int(self.artist_label_current.get_width()/2) - int(next_label.get_width()/2)
+ incoming_x = self.label_current.get_x() + int(self.label_current.get_width()/2) - int(next_label.get_width()/2)
knots_incoming =(\
(next_label.get_x(), next_label.get_y()),
(incoming_x, next_label.get_y())
)
knots_outgoing =(\
- (self.artist_label_current.get_x(), self.artist_label_current.get_y()),
+ (self.label_current.get_x(), self.label_current.get_y()),
(outgoing_x, next_label.get_y())
)
@@ -357,9 +397,9 @@ class Module:
self.behaviourIncomingPath.apply(next_label)
self.behaviourIncomingOpacity.apply(next_label)
self.behaviourIncomingScale.apply(next_label)
- self.behaviourOutgoingPath.apply(self.artist_label_current)
- self.behaviourOutgoingOpacity.apply(self.artist_label_current)
- self.behaviourOutgoingScale.apply(self.artist_label_current)
+ self.behaviourOutgoingPath.apply(self.label_current)
+ self.behaviourOutgoingOpacity.apply(self.label_current)
+ self.behaviourOutgoingScale.apply(self.label_current)
timeline.connect("completed", self.set_next_heading, next_label)
@@ -367,14 +407,4 @@ class Module:
timeline.start()
def set_next_heading(self, data, new_heading):
- self.artist_label_current = new_heading
-
-
- def stop(self):
- pass
-
- def pause(self):
- pass
-
- def unpause(self):
- pass
\ No newline at end of file
+ self.label_current = new_heading
\ No newline at end of file
diff --git a/modules/music_player/play_screen.py b/modules/music_player/play_screen.py
index ce7bca8..6c70b05 100644
--- a/modules/music_player/play_screen.py
+++ b/modules/music_player/play_screen.py
@@ -1,5 +1,6 @@
import clutter
from modules.music_player.playlist import Playlist
+from multimedia.progress_bar import ProgressBar
from ui_elements.image_frame import ImageFrame
from ui_elements.image_clone import ImageClone
from ui_elements.label_list import LabelList
@@ -17,11 +18,16 @@ class PlayScreen(clutter.Group):
self.main_img = None
self.song_list = LabelList(8)
- self.playlist = Playlist(musicPlayer)
+ self.playlist = musicPlayer.playlist #Playlist(musicPlayer)
+
+ controller = self.playlist.audio_controller
+ self.progress_bar = ProgressBar(controller)
+
self.setup()
def setup(self):
+ self.progress_bar.setup_from_theme_id(self.glossMgr.themeMgr, "music_progress_bar")
self.song_list.setup_from_theme_id(self.glossMgr.themeMgr, "music_play_screen_songs")
self.main_img_theme = self.glossMgr.themeMgr.get_imageFrame("music_playing_image")
self.img_size = self.main_img_theme.img_size
@@ -78,6 +84,10 @@ class PlayScreen(clutter.Group):
self.song_list.show()
self.add(self.song_list)
+ self.add(self.progress_bar)
+ self.progress_bar.set_position(400, 650)
+ self.progress_bar.display()
+
self.show()
self.stage.add(self)
diff --git a/multimedia/AudioController.py b/multimedia/AudioController.py
index 7268b22..6fe20f2 100644
--- a/multimedia/AudioController.py
+++ b/multimedia/AudioController.py
@@ -8,12 +8,12 @@ class AudioController(MediaController):
def __init__(self, glossMgr):
MediaController.__init__(self, glossMgr)
self.isPlaying = False
- """
+
# Primary audio object
self.audio = clutter.cluttergst.Audio()
self.audio.connect("eos", self.stream_complete)
self.media_element = self.audio
- """
+
#self.osd = osd(glossMgr)
@@ -28,11 +28,13 @@ class AudioController(MediaController):
def play_audio(self, uri):
if self.isPlaying:
self.audio.set_playing(False)
-
+
+ """
# Primary audio object
self.audio = clutter.cluttergst.Audio()
self.audio.connect("eos", self.stream_complete)
self.media_element = self.audio
+ """
self.audio.set_uri(uri)
self.audio.set_playing(True)
diff --git a/multimedia/MediaController.py b/multimedia/MediaController.py
index d8ca508..83ca9a3 100644
--- a/multimedia/MediaController.py
+++ b/multimedia/MediaController.py
@@ -2,6 +2,9 @@ import clutter
import gobject
from multimedia.MediaOSD import osd
+
+# This is an abstract class
+# It should not be instantiated directly
class MediaController(gobject.GObject):
#Setup signals
@@ -41,4 +44,15 @@ class MediaController(gobject.GObject):
#self.media_element.set_position(new_pos)
#Until then use:
self.media_element.set_property("position", int(new_pos))
- if self.use_osd: self.osd.shift_media(amount)
\ No newline at end of file
+ if self.use_osd: self.osd.shift_media(amount)
+
+ def get_position_percent(self):
+ length = int(self.media_element.get_duration())
+ pos = int(self.media_element.get_property("position"))
+
+ #Sanity check
+ if length == 0: return 0
+
+ percent = float( float(pos) / float(length) )
+
+ return percent
\ No newline at end of file
diff --git a/multimedia/progress_bar.py b/multimedia/progress_bar.py
new file mode 100644
index 0000000..7e354c0
--- /dev/null
+++ b/multimedia/progress_bar.py
@@ -0,0 +1,63 @@
+import clutter
+import gobject
+
+class ProgressBar(clutter.Group):
+
+ def __init__(self, Controller):
+ clutter.Group.__init__(self)
+
+ self.media_controller = Controller
+
+ self.bg = clutter.Rectangle()
+ self.fg = clutter.Rectangle()
+
+
+ self.add(self.bg)
+ self.bg.show()
+ self.add(self.fg)
+ self.fg.show()
+
+ def setup_from_theme_id(self, themeMgr, id):
+ element = themeMgr.search_docs("progress_bar", id).childNodes
+ colour_element = themeMgr.search_docs("progress_bar", id).getElementsByTagName("colour")
+
+ #width = clutter.Stage.get_width(), height = 10
+ (self.width, self.height) = themeMgr.get_dimensions(element, themeMgr.stage)
+
+ colour_element_bg = themeMgr.find_element(colour_element, "id", "background")
+ colour_element_fg = themeMgr.find_element(colour_element, "id", "foreground")
+ if not colour_element_bg is None:
+ colour_element_bg = colour_element_bg.childNodes
+ bgColour = themeMgr.get_colour(colour_element_bg, "background")
+ if not colour_element_fg is None:
+ colour_element_fg = colour_element_fg.childNodes
+ fgColour = themeMgr.get_colour(colour_element_fg, "foreground")
+ #bgColour = themeMgr.get_colour(element, "background")
+ #fgColour = themeMgr.get_colour(element, "foreground")
+
+ self.bg.set_color(bgColour)
+ self.bg.set_size(self.width, self.height)
+
+ self.fg.set_color(fgColour)
+ self.fg.set_size(20, self.height)
+
+ def display(self):
+ self.displayed = True
+
+
+ self.show()
+ gobject.timeout_add(1000, self.tick)
+
+ def tick(self):
+ if self.displayed:
+ percent = self.media_controller.get_position_percent()
+ new_width = int(float(self.width) * float(percent))
+
+ #print "new width: %s" % float(new_width)
+ self.fg.set_width(new_width)
+
+ return True
+ else:
+ return False
+
+
\ No newline at end of file
diff --git a/myth/MythMySQL.py b/myth/MythMySQL.py
index 67bae04..523680d 100644
--- a/myth/MythMySQL.py
+++ b/myth/MythMySQL.py
@@ -26,7 +26,7 @@ class mythDB():
def read_config(self):
conf_file = os.path.expanduser("~/.mythtv/mysql.txt")
if not os.path.exists(conf_file):
- print "ERROR: No config file found at ~.mythtv/mysql.txt!"
+ print "ERROR: No config file found at ~/.mythtv/mysql.txt!"
print "No connection to MythTV Database can be made. Quitting"
clutter.main_quit()
return False
diff --git a/themeMgr.py b/themeMgr.py
index 5dcf780..9e393ca 100644
--- a/themeMgr.py
+++ b/themeMgr.py
@@ -264,6 +264,20 @@ class ThemeMgr:
return (int(x), int(y))
+ def get_colour(self, element, name):
+ if element is None:
+ element = self.search_docs("colour", name).childNodes
+ #Quick check to make sure we found something
+ if element is None:
+ return None
+
+ r = int(self.find_child_value(element, "r"))
+ g = int(self.find_child_value(element, "g"))
+ b = int(self.find_child_value(element, "b"))
+
+ colour = clutter.Color(r, g, b)
+ return colour
+
def get_texture(self, name, parent, texture = None, element = None):
texture_src = None
if texture is None:
@@ -291,6 +305,7 @@ class ThemeMgr:
self.setup_actor(texture, element, parent)
return texture
+
def get_font(self, name, element):
if element is None:
@@ -380,4 +395,22 @@ class ThemeMgr:
(x, y) = self.get_position(element, parent)
img_frame.set_position(int(x), int(y))
- return img_frame
\ No newline at end of file
+ return img_frame
+
+ def get_label(self, id, parent = None, element = None, label = None):
+ if element is None:
+ element = self.search_docs("label", id).childNodes
+ #Quick check to make sure we found something
+ if element is None:
+ return None
+
+ if label is None: label = clutter.Label()
+ if parent is None: parent = self.stage
+
+ font_string = self.get_font("font", element)
+ label.set_font_name(font_string)
+
+ self.setup_actor(label, element, parent)
+
+ return label
+
\ No newline at end of file
diff --git a/themes/Pear/music.xml b/themes/Pear/music.xml
index fe60d27..513e3cf 100644
--- a/themes/Pear/music.xml
+++ b/themes/Pear/music.xml
@@ -109,4 +109,23 @@
40%
+
+
diff --git a/themes/Pear/music_play_screen.xml b/themes/Pear/music_play_screen.xml
index 7d56cf1..2776de4 100644
--- a/themes/Pear/music_play_screen.xml
+++ b/themes/Pear/music_play_screen.xml
@@ -91,5 +91,27 @@
35%
-
+
+
+
+ 100
+ 100
+ 100
+
+
+ 255
+ 255
+ 255
+
+
+
+ 30%
+ 10%
+
+
+ 10%
+ 35%
+
+
+