| 87 | |
| 88 | |
| 89 | class CellWindow(gtk.Window): |
| 90 | |
| 91 | |
| 92 | def __init__( |
| 93 | self, |
| 94 | running=True, |
| 95 | engine=None, |
| 96 | **args): |
| 97 | |
| 98 | gtk.Window.__init__(self, **args) |
| 99 | |
| 100 | self.engine = engine |
| 101 | |
| 102 | self.connect('destroy', gtk.main_quit) |
| 103 | |
| 104 | self.set_title("OLPC Cellular Automata Engine for Python/Cairo, by Don Hopkins") |
| 105 | |
| 106 | self.views = [] |
| 107 | |
| 108 | da = \ |
| 109 | CellDrawingArea( |
| 110 | engine=self.engine) |
| 111 | self.da = da |
| 112 | |
| 113 | self.add(da) |
| 114 | self.views.append(da) |
| 115 | |
| 116 | engine.addView(da) |
| 117 | |
| 118 | def __del__( |
| 119 | self): |
| 120 | |
| 121 | self.destroyEngine() |
| 122 | |
| 123 | |
| 124 | def destroyEngine(self): |
| 125 | |
| 126 | # TODO: clean up all user pointers and callbacks. |
| 127 | # TODO: Make sure there are no memory leaks. |
| 128 | |
| 129 | TileDrawingArea.destroyEngine(self) |
| 130 | |
| 131 | |
| 132 | ######################################################################## |