def __init__(self, handle): super(ImplodeActivity, self).__init__(handle) _logger.debug('Starting implode activity...') self.max_participants = 1 self._game = ImplodeGame() game_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) game_box.pack_start(self._game, True, True, 0) self._stuck_strip = _StuckStrip() self._configure_toolbars() self.set_canvas(game_box) # Show everything except the stuck strip. self.show_all() self._configure_cb() game_box.pack_end(self._stuck_strip, expand=False, fill=False, padding=0) self._game.connect('show-stuck', self._show_stuck_cb) self._stuck_strip.connect('undo-clicked', self._stuck_undo_cb) game_box.connect('key-press-event', self._key_press_event_cb) self._game.grab_focus() last_game_path = self._get_last_game_path() if os.path.exists(last_game_path): self.read_file(last_game_path)
def __init__(self, handle): Activity.__init__(self, handle) self._joining_hide = False self._game = ImplodeGame() self._collab = CollabWrapper(self) self._collab.connect('message', self._message_cb) game_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) game_box.pack_start(self._game, True, True, 0) self._stuck_strip = _StuckStrip() self._configure_toolbars() self.set_canvas(game_box) # Show everything except the stuck strip. self.show_all() self._configure_cb() game_box.pack_end(self._stuck_strip, expand=False, fill=False, padding=0) self._game.connect('show-stuck', self._show_stuck_cb) self._game.connect('piece-selected', self._piece_selected_cb) self._game.connect('undo-key-pressed', self._undo_key_pressed_cb) self._game.connect('redo-key-pressed', self._redo_key_pressed_cb) self._game.connect('new-key-pressed', self._new_key_pressed_cb) self._stuck_strip.connect('undo-clicked', self._stuck_undo_cb) game_box.connect('key-press-event', self._key_press_event_cb) self._game.grab_focus() last_game_path = self._get_last_game_path() if os.path.exists(last_game_path): self.read_file(last_game_path) self._collab.setup() # Hide the canvas when joining a shared activity if self.shared_activity: if not self.get_shared(): self.get_canvas().hide() self.busy() self._joining_hide = True