# HG changeset patch # User Thinker K.F. Li # Date 1313994492 -28800 # Node ID 66c672d8f267c7ccbce698b0499d7c90a712ddba # Parent 73837e189039923c429fc4d68125c3d70e747f81 Add action_picker on UI for transition editor. Pick an action from a list for a transition instead of typing. diff -r 73837e189039 -r 66c672d8f267 pyink/FSM_window.glade --- a/pyink/FSM_window.glade Sat Aug 20 16:17:56 2011 +0800 +++ b/pyink/FSM_window.glade Mon Aug 22 14:28:12 2011 +0800 @@ -528,6 +528,7 @@ 200 normal FSM_main_win + True @@ -568,10 +569,32 @@ - + True - True - + + + True + True + + + + 0 + + + + + gtk-find + True + True + True + True + + + + 5 + 1 + + 1 @@ -636,6 +659,7 @@ True + True @@ -655,4 +679,156 @@ + + + + + + + + action1 + + + action2 + + + + + 5 + True + center-always + 320 + 260 + normal + transition_editor + + + + True + vertical + 2 + + + True + vertical + + + 200 + True + True + action_store + False + 0 + horizontal + + + + Actions + True + + + + 0 + + + + + + + 0 + + + + + True + + + True + Action: + + + False + False + 0 + + + + + True + 5 + picked + + + + + + + False + False + 1 + + + + + + + + False + False + 1 + + + + + 1 + + + + + True + end + + + gtk-ok + True + True + True + True + + + + False + False + 0 + + + + + gtk-cancel + True + True + True + True + + + + False + False + 1 + + + + + False + end + 0 + + + + + + action_ok + action_cancel + + diff -r 73837e189039 -r 66c672d8f267 pyink/FSM_window.py --- a/pyink/FSM_window.py Sat Aug 20 16:17:56 2011 +0800 +++ b/pyink/FSM_window.py Mon Aug 22 14:28:12 2011 +0800 @@ -197,6 +197,11 @@ _error_dialog_label = None _state_menu = None + + _action_picker = None + _picked_action = None + _picked_action_txt = None + _action_store = None def __init__(self): super(FSM_window_base, self).__init__() @@ -228,6 +233,10 @@ state_menu = builder.get_object('state_menu') transition_menu = builder.get_object('transition_menu') + action_picker = builder.get_object('action_picker') + picked_action = builder.get_object('picked_action') + action_store = builder.get_object('action_store') + builder.connect_signals(self) self._builder = builder @@ -251,6 +260,10 @@ self._state_menu = state_menu self._transition_menu = transition_menu self._comp_name_label = comp_name_label + + self._action_picker = action_picker + self._picked_action = picked_action + self._action_store = action_store pass def show_error(self, msg): @@ -308,6 +321,16 @@ menu.popup(None, None, None, 0, 0) pass + def show_action_picker(self): + self._picked_action.set_text('') + self._picked_action_txt = None + self._action_picker.show() + pass + + def hide_action_picker(self): + self._action_picker.hide() + pass + def show(self): self._main_win.show() self._add_state_button.set_active(True) @@ -378,11 +401,35 @@ transition_editor.hide() pass + def on_transition_pick_act_clicked(self, *args): + self.show_action_picker() + pass + def on_del_transition_activate(self, *args): pass def on_edit_transition_activate(self, *args): pass + + def on_action_cancel_clicked(self, *args): + action_picker = self._action_picker + action_picker.hide() + pass + + def on_action_ok_clicked(self, *args): + if self._picked_action_txt: + self._transition_action.set_text(self._picked_action_txt) + pass + self.hide_action_picker() + pass + + def on_action_list_row_activated(self, view, path, col): + action_store = self._action_store + action_iter = action_store.get_iter(path) + action_text = action_store.get_value(action_iter, 0) + self._picked_action_txt = action_text + self._picked_action.set_text(action_text) + pass pass