Mercurial > MadButterfly
diff pyink/FSM_window.py @ 1498:fc4169113259
Show popup menu for right click on a transition
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 03 May 2011 13:00:20 +0800 |
parents | 08329d3bf452 |
children | 9a7332e28291 |
line wrap: on
line diff
--- a/pyink/FSM_window.py Tue May 03 12:48:08 2011 +0800 +++ b/pyink/FSM_window.py Tue May 03 13:00:20 2011 +0800 @@ -117,6 +117,7 @@ error_dialog_label = builder.get_object('error_dialog_label') state_menu = builder.get_object('state_menu') + transition_menu = builder.get_object('transition_menu') builder.connect_signals(self) @@ -134,6 +135,7 @@ self._error_dialog_label = error_dialog_label self._state_menu = state_menu + self._transition_menu = transition_menu pass def show_error(self, msg): @@ -168,6 +170,11 @@ menu = self._state_menu menu.popup(None, None, None, 0, 0) pass + + def popup_transition_menu(self): + menu = self._transition_menu + menu.popup(None, None, None, 0, 0) + pass def show(self): self._main_win.show() @@ -782,6 +789,8 @@ _domview = None _selected_cleaner = None + _select_transition = None + def __init__(self, window, domview_ui): super(_FSM_move_state_mode, self).__init__() @@ -983,6 +992,21 @@ window.grab_bg(stop_hint) pass + def on_del_transition_activate(self, *args): + pass + + def on_edit_transition_activate(self, *args): + pass + + def _show_transition_menu(self, trn): + self._select_transition = trn + + window = self._window + window.popup_transition_menu() + pass + + ## \brief Handle mouse events when selecting no transition. + # def _handle_transitoin_mouse_events(self, trn, evtype, button, x, y): if evtype == pybInkscape.PYSPItem.PYB_EVENT_BUTTON_RELEASE and \ button == 1: @@ -990,6 +1014,10 @@ elif evtype == pybInkscape.PYSPItem.PYB_EVENT_MOUSE_ENTER: self._hint_transition(trn) pass + elif evtype == pybInkscape.PYSPItem.PYB_EVENT_BUTTON_PRESS and \ + button == 3: + self._show_transition_menu(trn) + pass pass def activate(self): @@ -1021,7 +1049,7 @@ _select_state = None _candidate_state = None - + def __init__(self, window, domview_ui): super(_FSM_add_state_mode, self).__init__()