Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-08-27 13:24:56 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-08-27 13:36:02 (GMT)
commit7924289ce65e2c97b4310e599c1ea6d23aaea9dd (patch)
treeba8380a213bff355fca4649e5c4151921a288c07
parent7a954aea816e9b994ddd3d9dcac9897bc47b5aec (diff)
Use a notebook in the visualization area
Previously a 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>
-rw-r--r--jukeboxactivity.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/jukeboxactivity.py b/jukeboxactivity.py
index 5555ed1..c310f9d 100644
--- a/jukeboxactivity.py
+++ b/jukeboxactivity.py
@@ -172,8 +172,8 @@ class JukeboxActivity(activity.Activity):
self._empty_widget = gtk.Label("")
self._empty_widget.show()
self.videowidget = VideoWidget()
- self._switch_canvas(show_video=False)
self.set_canvas(self.bin)
+ self._init_view_area()
self.show_all()
self.bin.connect('size-allocate', self.__size_allocate_cb)
@@ -187,6 +187,17 @@ 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, True, True, 0)
+
def _switch_canvas(self, show_video):
"""Show or hide the video visualization in the canvas.
@@ -195,11 +206,9 @@ class JukeboxActivity(activity.Activity):
"""
if show_video:
- self.bin.remove(self._empty_widget)
- self.bin.pack_end(self.videowidget)
+ self.view_area.set_current_page(1)
else:
- self.bin.pack_end(self._empty_widget)
- self.bin.remove(self.videowidget)
+ self.view_area.set_current_page(0)
self.bin.queue_draw()
def __get_tags_cb(self, tags_reader, order, tags):
@@ -298,10 +307,7 @@ class JukeboxActivity(activity.Activity):
self.player.stop()
self.player.set_uri(None)
self.control.set_disabled()
- self.bin.remove(self.videowidget)
- text = gtk.Label("Error: %s - %s" % (message, detail))
- text.show_all()
- self.bin.add(text)
+ self._show_error_alert("Error: %s - %s" % (message, detail))
def _show_error_alert(self, title, text=None):
alert = ErrorAlert()