From cd8ae0a8e1bb3f4f9566054e7d45449a20752aa4 Mon Sep 17 00:00:00 2001 From: Kushal Das Date: Thu, 2 Oct 2008 01:18:29 +0530 Subject: Added a new view tool bar, currently only the full screen button is working --- ControlToolbar.py | 22 +--------------- MANIFEST | 3 +++ ViewToolbar.py | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ jukeboxactivity.py | 10 ++++++- 4 files changed, 90 insertions(+), 22 deletions(-) create mode 100644 ViewToolbar.py diff --git a/ControlToolbar.py b/ControlToolbar.py index dd0dc79..29a50f6 100644 --- a/ControlToolbar.py +++ b/ControlToolbar.py @@ -29,13 +29,7 @@ from sugar.activity import activity class ControlToolbar(gtk.Toolbar): - """Class to create the toolbar""" - - __gsignals__ = { - 'go-fullscreen': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ([])) - } + """Class to create the Control (play )toolbar""" def __init__(self, toolbox, jukebox): gtk.Toolbar.__init__(self) @@ -74,17 +68,6 @@ class ControlToolbar(gtk.Toolbar): self.insert(spacer, -1) spacer.show() - self._fullscreen = ToolButton('view-fullscreen') - self._fullscreen.set_tooltip(_('Fullscreen')) - self._fullscreen.connect('clicked', self._fullscreen_cb) - self.insert(self._fullscreen, -1) - self._fullscreen.show() - - spacer = gtk.SeparatorToolItem() - spacer.props.draw = False - self.insert(spacer, -1) - spacer.show() - self.audioscale = gtk.VolumeButton() self.audioscale.connect('value-changed', jukebox.volume_changed_cb) self.audioscale.set_value(1) @@ -107,6 +90,3 @@ class ControlToolbar(gtk.Toolbar): self.button.set_sensitive(False) self.scale_item.set_sensitive(False) self.hscale.set_sensitive(False) - - def _fullscreen_cb(self, button): - self.emit('go-fullscreen') diff --git a/MANIFEST b/MANIFEST index fac45c9..a62f73c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5,3 +5,6 @@ jukeboxactivity.py icons/speaker.svg activity/activity.info activity/activity-jukebox.svg +ViewToolbar.py +TODO +po/Jukebox.pot diff --git a/ViewToolbar.py b/ViewToolbar.py new file mode 100644 index 0000000..f3c90ca --- /dev/null +++ b/ViewToolbar.py @@ -0,0 +1,77 @@ +# Copyright (C) 2008 Kushal Das +# +# 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 ViewToolbar(gtk.Toolbar): + """Class to create the view 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._zoom_tofit = ToolButton('zoom-best-fit') + self._zoom_tofit.set_tooltip(_('Fit to window')) + self._zoom_tofit.connect('clicked', self._zoom_tofit_cb) + self.insert(self._zoom_tofit, -1) + self._zoom_tofit.show() + + self._zoom_original = ToolButton('zoom-original') + self._zoom_original.set_tooltip(_('Original size')) + self._zoom_original.connect('clicked', self._zoom_original_cb) + self.insert(self._zoom_original, -1) + self._zoom_original.show() + + spacer = gtk.SeparatorToolItem() + spacer.props.draw = False + self.insert(spacer, -1) + spacer.show() + + + self._fullscreen = ToolButton('view-fullscreen') + self._fullscreen.set_tooltip(_('Fullscreen')) + self._fullscreen.connect('clicked', self._fullscreen_cb) + self.insert(self._fullscreen, -1) + self._fullscreen.show() + + def _zoom_tofit_cb(self, button): + pass + #self.jukebox.player.set_fit_to_screen_cb() + + def _zoom_original_cb(self, button): + pass + #self.jukebox.player.set_original_to_size_cb() + + def _fullscreen_cb(self, button): + self.emit('go-fullscreen') diff --git a/jukeboxactivity.py b/jukeboxactivity.py index 4a98e4f..ab791d2 100755 --- a/jukeboxactivity.py +++ b/jukeboxactivity.py @@ -3,6 +3,7 @@ Activity that plays media. Copyright (C) 2007 Andy Wingo Copyright (C) 2007 Red Hat, Inc. + Copyright (C) 2008 Kushal Das """ # This program is free software; you can redistribute it and/or @@ -42,6 +43,7 @@ import gtk import urllib from ControlToolbar import ControlToolbar +from ViewToolbar import ViewToolbar class JukeboxActivity(activity.Activity): UPDATE_INTERVAL = 500 @@ -57,9 +59,15 @@ class JukeboxActivity(activity.Activity): toolbox.add_toolbar(_('Play'), toolbar) toolbar.show() + self._view_toolbar = ViewToolbar(toolbox, self) + toolbox.add_toolbar(_('View'), self._view_toolbar) + self._view_toolbar.show() + + + toolbox.show() - self.toolbar.connect('go-fullscreen', self.__go_fullscreen_cb) + self._view_toolbar.connect('go-fullscreen', self.__go_fullscreen_cb) self.connect("shared", self._shared_cb) -- cgit