[Pkg-sugar-commit] [sugar-jukebox-activity] 03/10: Use a notebook in the visualization area

Jonas Smedegaard dr at jones.dk
Sat Jun 27 01:57:02 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag v26.1
in repository sugar-jukebox-activity.

commit 7924289ce65e2c97b4310e599c1ea6d23aaea9dd
Author: Manuel Kaufmann <humitos at gmail.com>
Date:   Mon Aug 27 10:24:56 2012 -0300

    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 at laptop.org>
    Signed-off-by: Manuel Kaufmann <humitos at gmail.com>
---
 jukeboxactivity.py | 24 +++++++++++++++---------
 1 file 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()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-jukebox-activity.git



More information about the pkg-sugar-commit mailing list