Starting to create the mesh view...

This commit is contained in:
Marco Pesenti Gritti 2006-08-19 01:29:42 +02:00
parent 825758018d
commit 24dae31a9d
9 changed files with 68 additions and 23 deletions

View File

@ -30,6 +30,7 @@ activities/chat/Makefile
activities/terminal/Makefile
shell/Makefile
shell/data/Makefile
shell/home/Makefile
shell/session/Makefile
shell/PresenceService/Makefile
sugar/Makefile

View File

@ -1,4 +1,4 @@
SUBDIRS = data session PresenceService
SUBDIRS = data session home PresenceService
bin_SCRIPTS = \
sugar \
@ -11,13 +11,11 @@ bin_SCRIPTS = \
sugardir = $(pkgdatadir)/shell
sugar_PYTHON = \
__init__.py \
ActivitiesModel.py \
ActivityHost.py \
ActivityRegistry.py \
ChatController.py \
ConsoleWindow.py \
Owner.py \
HomeWindow.py \
PeopleWindow.py \
PresenceView.py \
Shell.py

View File

@ -8,7 +8,7 @@ import gobject
import wnck
from ActivityRegistry import ActivityRegistry
from HomeWindow import HomeWindow
from home.HomeWindow import HomeWindow
from sugar import env
from Owner import ShellOwner
from sugar.presence.PresenceService import PresenceService

View File

@ -95,27 +95,15 @@ class Model(goocanvas.CanvasModelSimple):
tasks.translate(600, 450)
root.add_child(tasks)
class HomeWindow(gtk.Window):
class HomeView(goocanvas.CanvasView):
def __init__(self, shell):
gtk.Window.__init__(self)
goocanvas.CanvasView.__init__(self)
self._shell = shell
self.connect('realize', self.__realize_cb)
canvas = goocanvas.CanvasView()
self.connect("item_view_created", self.__item_view_created_cb)
canvas_model = Model(shell)
canvas.set_bounds(0, 0, 1200, 900)
canvas.set_scale(float(800) / float(1200))
canvas.set_size_request(800, 600)
canvas.connect("item_view_created", self.__item_view_created_cb)
self.add(canvas)
canvas.show()
canvas.set_model(canvas_model)
self.set_model(canvas_model)
def __item_view_created_cb(self, view, item_view, item):
if isinstance(item, ActivityItem):
@ -133,6 +121,3 @@ class HomeWindow(gtk.Window):
def __task_button_press_cb(self, view, target, event):
activity = view.get_item().get_data('activity')
activity.present()
def __realize_cb(self, window):
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)

35
shell/home/HomeWindow.py Normal file
View File

@ -0,0 +1,35 @@
import gtk
from home.MeshView import MeshView
from home.HomeView import HomeView
class HomeWindow(gtk.Window):
def __init__(self, shell):
gtk.Window.__init__(self)
self.connect('realize', self.__realize_cb)
self._nb = gtk.Notebook()
self._nb.set_show_tabs(False)
self._nb.set_show_border(False)
home_view = HomeView(shell)
self._nb.append_page(home_view)
self._setup_canvas(home_view)
home_view.show()
mesh_view = MeshView(shell)
self._setup_canvas(mesh_view)
self._nb.append_page(mesh_view)
mesh_view.show()
self.add(self._nb)
self._nb.show()
def _setup_canvas(self, canvas):
canvas.set_bounds(0, 0, 1200, 900)
canvas.set_scale(float(800) / float(1200))
canvas.set_size_request(800, 600)
def __realize_cb(self, window):
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)

6
shell/home/Makefile.am Normal file
View File

@ -0,0 +1,6 @@
sugardir = $(pkgdatadir)/shell
sugar_PYTHON = \
__init__.py \
MeshView.py \
HomeView.py \
Window.py

20
shell/home/MeshView.py Normal file
View 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 MeshView(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

0
shell/home/__init__.py Normal file
View File