summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKushal Das <kushal@fedoraproject.org>2008-10-01 23:50:21 +0530
committerKushal Das <kushal@fedoraproject.org>2008-10-01 23:50:21 +0530
commit42599035387d76c980d2127522c7c08a73a7e9c8 (patch)
tree5d1fd67a6088c48efb5aeeced8254bdf209161d7
parentcb54d6f18ced5590ab94bbcc40fa7ac691dc0a76 (diff)
downloadjukebox-activity.git-42599035387d76c980d2127522c7c08a73a7e9c8.zip
jukebox-activity.git-42599035387d76c980d2127522c7c08a73a7e9c8.tar.gz
jukebox-activity.git-42599035387d76c980d2127522c7c08a73a7e9c8.tar.xz
Toolbar is now moved to a new file called ControlToolbar.py
-rw-r--r--ControlToolbar.py94
-rw-r--r--MANIFEST7
-rwxr-xr-xjukeboxactivity.py58
3 files changed, 102 insertions, 57 deletions
diff --git a/ControlToolbar.py b/ControlToolbar.py
new file mode 100644
index 0000000..79a1fd3
--- /dev/null
+++ b/ControlToolbar.py
@@ -0,0 +1,94 @@
+# Copyright (C) 2007 Andy Wingo <wingo@pobox.com>
+# Copyright (C) 2007 Red Hat, Inc.
+# Copyright (C) 2008 Kushal Das <kushal@fedoraproject.org>
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+import logging
+from gettext import gettext as _
+import re
+
+import gobject
+import gtk
+
+from sugar.graphics.toolbutton import ToolButton
+from sugar.graphics.menuitem import MenuItem
+from sugar.graphics import iconentry
+from sugar.activity import activity
+
+
+class ControlToolbar(gtk.Toolbar):
+ """Class to create the toolbar"""
+
+ __gsignals__ = {
+ 'go-fullscreen': (gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ ([]))
+ }
+
+ def __init__(self, toolbox, jukebox):
+ gtk.Toolbar.__init__(self)
+ self.toolbox = toolbox
+ self.jukebox = jukebox
+
+ self.pause_image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PAUSE,
+ gtk.ICON_SIZE_BUTTON)
+ self.pause_image.show()
+ self.play_image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PLAY,
+ gtk.ICON_SIZE_BUTTON)
+ self.play_image.show()
+
+ self.button = gtk.ToolButton()
+ self.button.set_icon_widget(self.play_image)
+ self.button.set_property('can-default', True)
+ self.button.show()
+ self.button.connect('clicked', self._button_clicked_cb)
+
+ self.insert(self.button, -1)
+
+ self.adjustment = gtk.Adjustment(0.0, 0.00, 100.0, 0.1, 1.0, 1.0)
+ self.hscale = gtk.HScale(self.adjustment)
+ self.hscale.set_draw_value(False)
+ self.hscale.set_update_policy(gtk.UPDATE_CONTINUOUS)
+ self.hscale.connect('button-press-event', jukebox.scale_button_press_cb)
+ self.hscale.connect('button-release-event', jukebox.scale_button_release_cb)
+
+ self.scale_item = gtk.ToolItem()
+ self.scale_item.set_expand(True)
+ self.scale_item.add(self.hscale)
+ self.insert(self.scale_item, -1)
+
+ self.audioscale = gtk.VolumeButton()
+ self.audioscale.connect('value-changed', jukebox.volume_changed_cb)
+ self.audioscale.set_value(1)
+
+ self.audio_scale_item = gtk.ToolItem()
+ self.audio_scale_item.set_expand(False)
+ self.audio_scale_item.add(self.audioscale)
+ self.insert(self.audio_scale_item, -1)
+
+ def _button_clicked_cb(self, widget):
+ self.jukebox.play_toggled()
+
+ def set_button_play(self):
+ self.button.set_icon_widget(self.play_image)
+
+ def set_button_pause(self):
+ self.button.set_icon_widget(self.pause_image)
+
+ def set_disabled(self):
+ self.button.set_sensitive(False)
+ self.scale_item.set_sensitive(False)
+ self.hscale.set_sensitive(False)
+
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..fac45c9
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,7 @@
+NEWS
+setup.py
+ControlToolbar.py
+jukeboxactivity.py
+icons/speaker.svg
+activity/activity.info
+activity/activity-jukebox.svg
diff --git a/jukeboxactivity.py b/jukeboxactivity.py
index bc2f9fe..34a78ab 100755
--- a/jukeboxactivity.py
+++ b/jukeboxactivity.py
@@ -41,6 +41,7 @@ import gst.interfaces
import gtk
import urllib
+from ControlToolbar import ControlToolbar
class JukeboxActivity(activity.Activity):
UPDATE_INTERVAL = 500
@@ -235,63 +236,6 @@ class JukeboxActivity(activity.Activity):
return True
-class ControlToolbar(gtk.Toolbar):
- def __init__(self, toolbox, jukebox):
- gtk.Toolbar.__init__(self)
-
- self.toolbox = toolbox
- self.jukebox = jukebox
-
- self.pause_image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PAUSE,
- gtk.ICON_SIZE_BUTTON)
- self.pause_image.show()
- self.play_image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PLAY,
- gtk.ICON_SIZE_BUTTON)
- self.play_image.show()
-
- self.button = gtk.ToolButton()
- self.button.set_icon_widget(self.play_image)
- self.button.set_property('can-default', True)
- self.button.show()
- self.button.connect('clicked', self._button_clicked_cb)
-
- self.insert(self.button, -1)
-
- self.adjustment = gtk.Adjustment(0.0, 0.00, 100.0, 0.1, 1.0, 1.0)
- self.hscale = gtk.HScale(self.adjustment)
- self.hscale.set_draw_value(False)
- self.hscale.set_update_policy(gtk.UPDATE_CONTINUOUS)
- self.hscale.connect('button-press-event', jukebox.scale_button_press_cb)
- self.hscale.connect('button-release-event', jukebox.scale_button_release_cb)
-
- self.scale_item = gtk.ToolItem()
- self.scale_item.set_expand(True)
- self.scale_item.add(self.hscale)
- self.insert(self.scale_item, -1)
-
- self.audioscale = gtk.VolumeButton()
- self.audioscale.connect('value-changed', jukebox.volume_changed_cb)
- self.audioscale.set_value(1)
-
- self.audio_scale_item = gtk.ToolItem()
- self.audio_scale_item.set_expand(False)
- self.audio_scale_item.add(self.audioscale)
- self.insert(self.audio_scale_item, -1)
-
- def _button_clicked_cb(self, widget):
- self.jukebox.play_toggled()
-
- def set_button_play(self):
- self.button.set_icon_widget(self.play_image)
-
- def set_button_pause(self):
- self.button.set_icon_widget(self.pause_image)
-
- def set_disabled(self):
- self.button.set_sensitive(False)
- self.scale_item.set_sensitive(False)
- self.hscale.set_sensitive(False)
-
class GstPlayer(gobject.GObject):
__gsignals__ = {
'error': (gobject.SIGNAL_RUN_FIRST, None, [str, str]),