diff --git a/shell/Makefile.am b/shell/Makefile.am index 61caa3a3..61483ae8 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -6,6 +6,7 @@ bin_SCRIPTS = \ sugar-activity-factory \ sugar-console \ sugar-people \ + sugar-zoom \ sugar-presence-service sugardir = $(pkgdatadir)/shell diff --git a/shell/Shell.py b/shell/Shell.py index ad4db5b0..c8ebe06a 100755 --- a/shell/Shell.py +++ b/shell/Shell.py @@ -37,7 +37,20 @@ class ShellDbusService(dbus.service.Object): def show_console(self): gobject.idle_add(self.__show_console_idle) + @dbus.service.method('com.redhat.Sugar.Shell') + def zoom_in(self): + self._shell.zoom_in() + + @dbus.service.method('com.redhat.Sugar.Shell') + def zoom_out(self): + self._shell.zoom_out() + class Shell(gobject.GObject): + ZOOM_MESH = 0 + ZOOM_FRIENDS = 1 + ZOOM_HOME = 2 + ZOOM_ACTIVITY = 3 + __gsignals__ = { 'activity-opened': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])), @@ -51,6 +64,7 @@ class Shell(gobject.GObject): self._screen = wnck.screen_get_default() self._registry = registry self._hosts = {} + self._zoom_level = Shell.ZOOM_HOME def start(self): session_bus = dbus.SessionBus() @@ -159,3 +173,28 @@ class Shell(gobject.GObject): def get_chat_controller(self): return self._chat_controller + + def _set_zoom_level(self, level): + self._zoom_level = level + + if level == Shell.ZOOM_ACTIVITY: + self._screen.toggle_showing_desktop(False) + else: + self._screen.toggle_showing_desktop(True) + + if level == Shell.ZOOM_HOME: + self._home_window.set_view(HomeWindow.HOME_VIEW) + elif level == Shell.ZOOM_FRIENDS: + self._home_window.set_view(HomeWindow.FRIENDS_VIEW) + elif level == Shell.ZOOM_MESH: + self._home_window.set_view(HomeWindow.MESH_VIEW) + + def zoom_in(self): + level = self._zoom_level + 1 + if level <= Shell.ZOOM_ACTIVITY: + self._set_zoom_level(level) + + def zoom_out(self): + level = self._zoom_level - 1 + if level >= Shell.ZOOM_MESH: + self._set_zoom_level(level) diff --git a/shell/data/Makefile.am b/shell/data/Makefile.am index fa14d6bb..1f0f9c05 100644 --- a/shell/data/Makefile.am +++ b/shell/data/Makefile.am @@ -1,8 +1,4 @@ confdir = $(pkgdatadir) conf_DATA = kbdconfig -imagesdir = $(pkgdatadir) -images_DATA = \ - home-background.png - -EXTRA_DIST = $(conf_DATA) $(images_DATA) +EXTRA_DIST = $(conf_DATA) diff --git a/shell/data/activity-placeholder.png b/shell/data/activity-placeholder.png deleted file mode 100644 index 9fea97b8..00000000 Binary files a/shell/data/activity-placeholder.png and /dev/null differ diff --git a/shell/data/home-background.png b/shell/data/home-background.png deleted file mode 100644 index 346b5dce..00000000 Binary files a/shell/data/home-background.png and /dev/null differ diff --git a/shell/data/kbdconfig b/shell/data/kbdconfig index ef9d96a4..71d8032a 100644 --- a/shell/data/kbdconfig +++ b/shell/data/kbdconfig @@ -5,7 +5,7 @@ n=next p=prev c=close -f1=desktop -f2=!sugar-people -f3=!sugar-console +f1=!sugar-zoom out +f2=!sugar-zoom in +f3=!sugar-people f4=!sugar-activity org.sugar.Terminal diff --git a/shell/home/FriendsView.py b/shell/home/FriendsView.py new file mode 100644 index 00000000..baa834bd --- /dev/null +++ b/shell/home/FriendsView.py @@ -0,0 +1,20 @@ +import goocanvas + +class Model(goocanvas.CanvasModelSimple): + def __init__(self, shell): + goocanvas.CanvasModelSimple.__init__(self) + + root = self.get_root_item() + +class FriendsView(goocanvas.CanvasView): + def __init__(self, shell): + goocanvas.CanvasView.__init__(self) + self._shell = shell + + self.connect("item_view_created", self.__item_view_created_cb) + + canvas_model = Model(shell) + self.set_model(canvas_model) + + def __item_view_created_cb(self, view, item_view, item): + pass diff --git a/shell/home/HomeWindow.py b/shell/home/HomeWindow.py index d66020ea..ca3007da 100644 --- a/shell/home/HomeWindow.py +++ b/shell/home/HomeWindow.py @@ -2,8 +2,13 @@ import gtk from home.MeshView import MeshView from home.HomeView import HomeView +from home.FriendsView import FriendsView class HomeWindow(gtk.Window): + HOME_VIEW = 0 + FRIENDS_VIEW = 1 + MESH_VIEW = 2 + def __init__(self, shell): gtk.Window.__init__(self) @@ -17,6 +22,11 @@ class HomeWindow(gtk.Window): self._nb.append_page(home_view) self._setup_canvas(home_view) home_view.show() + + friends_view = FriendsView(shell) + self._nb.append_page(friends_view) + self._setup_canvas(friends_view) + friends_view.show() mesh_view = MeshView(shell) self._setup_canvas(mesh_view) @@ -26,6 +36,9 @@ class HomeWindow(gtk.Window): self.add(self._nb) self._nb.show() + def set_view(self, view): + self._nb.set_current_page(view) + def _setup_canvas(self, canvas): canvas.set_bounds(0, 0, 1200, 900) canvas.set_scale(float(800) / float(1200)) diff --git a/shell/home/Makefile.am b/shell/home/Makefile.am index 184570e5..72445ecd 100644 --- a/shell/home/Makefile.am +++ b/shell/home/Makefile.am @@ -1,6 +1,7 @@ sugardir = $(pkgdatadir)/shell sugar_PYTHON = \ __init__.py \ + FriendsView.py \ MeshView.py \ HomeView.py \ - Window.py + HomeWindow.py diff --git a/shell/sugar-zoom b/shell/sugar-zoom new file mode 100644 index 00000000..ee435170 --- /dev/null +++ b/shell/sugar-zoom @@ -0,0 +1,14 @@ +#!/usr/bin/python +import sys + +import dbus +import dbus.glib + +bus = dbus.SessionBus() +proxy_obj = bus.get_object('com.redhat.Sugar.Shell', '/com/redhat/Sugar/Shell') +shell = dbus.Interface(proxy_obj, 'com.redhat.Sugar.Shell') + +if sys.argv[1] == 'in': + shell.zoom_in() +elif sys.argv[1] == 'out': + shell.zoom_out()