Implement zooming levels, actual view still empty
This commit is contained in:
parent
24dae31a9d
commit
de65daf548
@ -6,6 +6,7 @@ bin_SCRIPTS = \
|
||||
sugar-activity-factory \
|
||||
sugar-console \
|
||||
sugar-people \
|
||||
sugar-zoom \
|
||||
sugar-presence-service
|
||||
|
||||
sugardir = $(pkgdatadir)/shell
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 69 KiB |
@ -5,7 +5,7 @@
|
||||
<Alt>n=next
|
||||
<Alt>p=prev
|
||||
<Alt>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
|
||||
|
20
shell/home/FriendsView.py
Normal file
20
shell/home/FriendsView.py
Normal file
@ -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
|
@ -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)
|
||||
|
||||
@ -18,6 +23,11 @@ class HomeWindow(gtk.Window):
|
||||
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)
|
||||
self._nb.append_page(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))
|
||||
|
@ -1,6 +1,7 @@
|
||||
sugardir = $(pkgdatadir)/shell
|
||||
sugar_PYTHON = \
|
||||
__init__.py \
|
||||
FriendsView.py \
|
||||
MeshView.py \
|
||||
HomeView.py \
|
||||
Window.py
|
||||
HomeWindow.py
|
||||
|
14
shell/sugar-zoom
Normal file
14
shell/sugar-zoom
Normal file
@ -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()
|
Loading…
Reference in New Issue
Block a user