Make the frame adapt to screen size again.
Several cleanups. Fixup makefiles
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
import gtk
|
||||
import goocanvas
|
||||
|
||||
class CanvasWindow(gtk.Window):
|
||||
def __init__(self, model):
|
||||
gtk.Window.__init__(self)
|
||||
|
||||
self._view = goocanvas.CanvasView()
|
||||
self._view.set_model(model.get())
|
||||
self.add(self._view)
|
||||
self._view.show()
|
||||
|
||||
def get_view(self):
|
||||
return self._view
|
||||
@@ -26,5 +26,11 @@ class GridModel:
|
||||
def get(self):
|
||||
return self._model
|
||||
|
||||
def get_width(self):
|
||||
return self._width
|
||||
|
||||
def get_bounds(self, constraints):
|
||||
return self.get_layout().get_bounds(self._root, constraints)
|
||||
|
||||
def get_layout(self):
|
||||
return self._root.get_layout()
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import gtk
|
||||
import goocanvas
|
||||
|
||||
class GridWindow(gtk.Window):
|
||||
def __init__(self, model):
|
||||
gtk.Window.__init__(self)
|
||||
|
||||
self._model = model
|
||||
|
||||
self._view = goocanvas.CanvasView()
|
||||
self._view.set_model(model.get())
|
||||
self.add(self._view)
|
||||
self._view.show()
|
||||
|
||||
def scale_to_screen(self):
|
||||
self._view.set_scale(float(gtk.gdk.screen_width()) /
|
||||
float(self._model.get_width()))
|
||||
|
||||
def set_bounds(self, constraints):
|
||||
bounds = self._model.get_bounds(constraints)
|
||||
self._view.set_bounds(bounds[0], bounds[1],
|
||||
bounds[2], bounds[3])
|
||||
|
||||
def get_view(self):
|
||||
return self._view
|
||||
@@ -1,5 +1,9 @@
|
||||
sugardir = $(pythondir)/sugar/canvas
|
||||
sugar_PYTHON = \
|
||||
__init__.py \
|
||||
GridLayout.py \
|
||||
GridModel.py \
|
||||
GridWindow.py \
|
||||
IconItem.py \
|
||||
IconColor.py
|
||||
IconColor.py \
|
||||
ScreenContainer.py
|
||||
|
||||
Reference in New Issue
Block a user