Make Window.canvas a property

This commit is contained in:
Tomeu Vizoso 2009-07-08 13:16:22 +02:00
parent afce505143
commit 3dad7c6fff

View File

@ -85,7 +85,7 @@ class Window(gtk.Window):
self.toolbox = None self.toolbox = None
self._alerts = [] self._alerts = []
self.canvas = None self._canvas = None
self.tray = None self.tray = None
self._vbox = gtk.VBox() self._vbox = gtk.VBox()
@ -107,13 +107,18 @@ class Window(gtk.Window):
self.__unfullscreen_button_pressed) self.__unfullscreen_button_pressed)
def set_canvas(self, canvas): def set_canvas(self, canvas):
if self.canvas: if self._canvas:
self._event_box.remove(self.canvas) self._event_box.remove(self._canvas)
if canvas: if canvas:
self._event_box.add(canvas) self._event_box.add(canvas)
self.canvas = canvas self._canvas = canvas
def get_canvas(self):
return self._canvas
canvas = property(get_canvas, set_canvas)
def set_toolbox(self, toolbox): def set_toolbox(self, toolbox):
if self.toolbox: if self.toolbox: