diff options
author | Nostalghia <b.vehikel@googlemail.com> | 2010-06-27 16:57:23 (GMT) |
---|---|---|
committer | Nostalghia <b.vehikel@googlemail.com> | 2010-06-27 16:57:23 (GMT) |
commit | 5dce05c339d2fc636b845d7c01d2103c565447f6 (patch) | |
tree | b467ca648fe2feb876705e47ecb86c31b3b2c59b /activity.py | |
parent | 22d182db24861239a33806c4869b2d6cc7228d8b (diff) |
refactoring th code for page handling
Diffstat (limited to 'activity.py')
-rw-r--r-- | activity.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/activity.py b/activity.py index 64057d2..203666b 100644 --- a/activity.py +++ b/activity.py @@ -75,11 +75,13 @@ class KandidActivity(activity.Activity): # Create the main container main_view = gtk.HBox() - self._widget = ka_widget.KandidWidget(main_view) + self._widget = ka_widget.KandidWidget() + main_view.pack_start(self._widget.get_widget_tree()) # Create a controller to connect view and model self._controller = ka_controller.KandidController( \ - self._widget.widget_tree, + self._widget, self.get_activity_root()) + self._controller.create_pages() self.set_canvas(main_view) self.kandidtube = None # Shared session @@ -92,11 +94,9 @@ class KandidActivity(activity.Activity): self.pservice = presenceservice.get_instance() self._start_collaboration() - self._controller.autoconnect_events() self.show_all() if handle.object_id is None: - #Assume getting started page has position 3. - self._controller.on_page_show(3) + self._controller.switch_page('GettingstartedController') def _print_greetings(self, handle): if handle.object_id is None: @@ -153,8 +153,10 @@ class KandidActivity(activity.Activity): """ ka_debug.info('read_file [%s] [%s]' % \ (self.metadata['mime_type'], file_path)) - self._controller.read_file(file_path) - self._controller.start_all_calculations() + population_controller = self._controller.find_page('PopulationController') + if population_controller is not None: + population_controller.read_file(file_path) + population_controller.start_all_calculations() def write_file(self, file_path): @@ -164,7 +166,9 @@ class KandidActivity(activity.Activity): which provides the file_path. """ ka_debug.info('write_file [%s]' % file_path) - self._controller.write_file(file_path) + population_controller = self._controller.find_page('PopulationController') + if population_controller is not None: + population_controller.write_file(file_path) def can_close(self): """Activity will be closed.""" @@ -254,7 +258,10 @@ class KandidActivity(activity.Activity): self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], tube_id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) - self.kandidtube = self._controller.on_new_tube(self.telepathy_conn, + population_controller = self._controller.find_page('PopulationController') + if population_controller is not None: + self.kandidtube = population_controller.on_new_tube( + self.telepathy_conn, tube_conn, self._get_my_id(), self.initiating, |