Mercurial > MadButterfly
changeset 1486:471805e582cc
Leave current mode when closing a FSM editor window
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sat, 30 Apr 2011 11:13:51 +0800 |
parents | 20cf6ea263c6 |
children | 3aba29609607 |
files | pyink/FSM_window.py |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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