Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/jukeboxactivity.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-10-02 19:21:29 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-10-10 16:24:37 (GMT)
commitf7d1a43af5f93e97ba3aea7a97a943e8d5abdef2 (patch)
treec2f203df6cda8350aed06f7faf0f3a26a9db827d /jukeboxactivity.py
parentbecfccb6dad3bb1c81ea4836a5ec70f1602b702a (diff)
Use a notebook in the visualization area
Previously an empty widget and a videowidget were packed and removed from a container, but there are problems with the video widget not ready when the player want start at times. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org> Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Diffstat (limited to 'jukeboxactivity.py')
-rw-r--r--jukeboxactivity.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/jukeboxactivity.py b/jukeboxactivity.py
index aebbc98..5132c68 100644
--- a/jukeboxactivity.py
+++ b/jukeboxactivity.py
@@ -150,8 +150,8 @@ class JukeboxActivity(activity.Activity):
self._empty_widget = Gtk.Label(label="")
self._empty_widget.show()
self.videowidget = VideoWidget()
- self._switch_canvas(show_video=False)
self.set_canvas(self.canvas)
+ self._init_view_area()
self.show_all()
self.canvas.connect('size-allocate', self.__size_allocate_cb)
@@ -165,6 +165,18 @@ class JukeboxActivity(activity.Activity):
self.uri = handle.uri
GObject.idle_add(self._start, self.uri, handle.title)
+ def _init_view_area(self):
+ """
+ Use a notebook with two pages, one empty an another
+ with the videowidget
+ """
+ self.view_area = Gtk.Notebook()
+ self.view_area.set_show_tabs(False)
+ self.view_area.append_page(self._empty_widget, None)
+ self.view_area.append_page(self.videowidget, None)
+ self.canvas.pack_end(self.view_area, expand=True,
+ fill=True, padding=0)
+
def _switch_canvas(self, show_video):
"""Show or hide the video visualization in the canvas.
@@ -173,11 +185,9 @@ class JukeboxActivity(activity.Activity):
"""
if show_video:
- self.canvas.remove(self._empty_widget)
- self.canvas.pack_end(self.videowidget, True, True, 0)
+ self.view_area.set_current_page(1)
else:
- self.canvas.pack_end(self._empty_widget, True, True, 0)
- self.canvas.remove(self.videowidget)
+ self.view_area.set_current_page(0)
self.canvas.queue_draw()
def __get_tags_cb(self, tags_reader, order, tags):
@@ -288,10 +298,7 @@ class JukeboxActivity(activity.Activity):
self.player.stop()
self.player.set_uri(None)
self.control.set_disabled()
- self.canvas.remove(self.videowidget)
- text = Gtk.Label("Error: %s - %s" % (message, detail))
- text.show_all()
- self.canvas.add(text)
+ self._show_error_alert("Error: %s - %s" % (message, detail))
def _player_new_tag_cb(self, widget, tag, value):
if not tag in [gst.TAG_TITLE, gst.TAG_ARTIST, gst.TAG_ALBUM]: