# HG changeset patch # User Thinker K.F. Li # Date 1304133231 -28800 # Node ID 471805e582cc6adfd3d93df87735546a8cd6c70e # Parent 20cf6ea263c6841962ada7dcd22b58f51f555a9a Leave current mode when closing a FSM editor window diff -r 20cf6ea263c6 -r 471805e582cc pyink/FSM_window.py --- a/pyink/FSM_window.py Fri Apr 29 23:42:22 2011 +0800 +++ b/pyink/FSM_window.py Sat Apr 30 11:13:51 2011 +0800 @@ -21,6 +21,8 @@ main_win = builder.get_object("FSM_main_win") view_box = builder.get_object("view_box") + add_state_button = builder.get_object('add_state') + move_state_button = builder.get_object('move_state') state_editor = builder.get_object("state_editor") state_name = builder.get_object('state_name') @@ -34,6 +36,8 @@ self._builder = builder self._main_win = main_win self._view_box = view_box + self._add_state_button = add_state_button + self._move_state_button = move_state_button self._state_editor = state_editor self._state_name = state_name @@ -73,6 +77,7 @@ def show(self): self._main_win.show() + self._add_state_button.set_active(True) pass def hide(self): @@ -708,8 +713,6 @@ control_layer.setAttribute('inkscape:groupmode', 'layer') root.appendChild(control_layer) self._control_layer = control_layer - - self._add_state_mode.activate() pass def _doc(self): @@ -764,6 +767,7 @@ def _emit_leave_mode(self): if self._leave_mode_cb: self._leave_mode_cb() + self._leave_mode_cb = None pass pass @@ -846,14 +850,17 @@ pass def on_close_window_activate(self, *args): + self._emit_leave_mode() self._close_cb() pass def on_FSM_main_win_destroy_event(self, *args): + self._emit_leave_mode() self._destroy_cb() pass def on_FSM_main_win_delete_event(self, *args): + self._emit_leave_mode() self._destroy_cb() pass @@ -919,6 +926,7 @@ self._install_test_data() self._install_test_data = lambda: None self._update_view() + self._add_state_mode.activate() super(FSM_window, self).show() pass