# HG changeset patch # User Thinker K.F. Li # Date 1302954072 -28800 # Node ID 894a4bf35fe6efd438d521db11b399130050a4c9 # Parent 8ea0d32a1864e842395cd133512b10def1e93bc9 Start implement FSM editor window diff -r 8ea0d32a1864 -r 894a4bf35fe6 pyink/FSM_window.glade --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pyink/FSM_window.glade Sat Apr 16 19:41:12 2011 +0800 @@ -0,0 +1,293 @@ + + + + + + 500 + 400 + FSM + True + + + + + True + vertical + + + True + + + True + _File + True + + + True + + + gtk-close + True + True + True + + + + + + + + + + True + _Edit + True + + + True + + + gtk-cut + True + True + True + + + + + gtk-copy + True + True + True + + + + + gtk-paste + True + True + True + + + + + gtk-delete + True + True + True + + + + + + + + + True + _View + True + + + + + True + _Help + True + + + True + + + gtk-about + True + True + True + + + + + + + + + False + 0 + + + + + True + + + True + icons + 1 + True + + + True + Add state + Add State + True + gtk-add + + + + False + True + + + + + True + Move or select a state + select & move + True + widget-gtk-alignment + + + + False + True + + + + + True + + + False + True + + + + + True + Zoom-in + Zoom-in + True + gtk-zoom-in + + + + False + True + + + + + True + Zoom-out + Zoom-out + True + gtk-zoom-out + + + + False + True + + + + + + + False + 1 + + + + + True + True + automatic + automatic + + + True + queue + + + + + + + + 2 + + + + + True + 5 + + + True + + + True + 0.10000000149011612 + Compnent: + + + False + 0 + + + + + True + 5 + component1 + + + False + 1 + + + + + False + 0 + + + + + False + 3 + + + + + + + True + + + True + Remove selected state or transition. + Remove + True + + + + + + True + Change state name + Rename + True + + + + + + True + Make the selected state as start state. + Start State + True + + + + + diff -r 8ea0d32a1864 -r 894a4bf35fe6 pyink/FSM_window.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pyink/FSM_window.py Sat Apr 16 19:41:12 2011 +0800 @@ -0,0 +1,90 @@ +import gtk +import os + +class FSM_window_base(object): + def __init__(self): + super(FSM_window_base, self).__init__() + + dirname = os.path.dirname(__file__) + fname = os.path.join(dirname, 'FSM_window.glade') + + builder = gtk.Builder() + builder.add_from_file(fname) + + main_win = builder.get_object("FSM_main_win") + view_box = builder.get_object("view_box") + + builder.connect_signals(self) + + self._builder = builder + self._main_win = main_win + self._view_box = view_box + pass + + def show(self): + self._main_win.show() + pass + + def hide(self): + self._main_win.hide() + pass + + def on_start_state_activate(self, *args): + pass + + def on_rename_state_activate(self, *args): + pass + + def on_remove_state_activate(self, *args): + pass + + def on_zoom_out_clicked(self, *args): + pass + + def on_zoom_in_clicked(self, *args): + pass + + def on_move_state_toggled(self, *args): + pass + + def on_add_state_toggled(self, *args): + pass + + def on_close_window_activate(self, *args): + pass + + def on_FSM_main_win_destroy_event(self, *args): + pass + pass + +class FSM_window(FSM_window_base): + def __init__(self, close_cb, destroy_cb): + super(FSM_window, self).__init__() + + self._close_cb = close_cb + self._destroy_cb = destroy_cb + pass + + def set_svg_view(self, view): + self._view_box.add(view) + pass + + def on_close_window_activate(self, *args): + self._close_cb() + pass + + def on_FSM_main_win_destroy_event(self, *args): + self._destroy_cb() + pass + + def on_FSM_main_win_delete_event(self, *args): + self._destroy_cb() + pass + pass + +if __name__ == '__main__': + win = FSM_window() + win._main_win.connect('destroy', gtk.main_quit) + win.show() + gtk.main() + pass diff -r 8ea0d32a1864 -r 894a4bf35fe6 pyink/comp_dock.py --- a/pyink/comp_dock.py Thu Apr 14 15:24:37 2011 +0800 +++ b/pyink/comp_dock.py Sat Apr 16 19:41:12 2011 +0800 @@ -2,6 +2,7 @@ import os import data_monitor import pybInkscape +import FSM_window ## \brief User interface for management components and their timelines. @@ -159,6 +160,7 @@ super(comp_dock_ui, self).__init__() self._locker = domview_ui + self._fsm_editor_win = None pass def _drop_undo(self): @@ -274,6 +276,26 @@ timeline_name = self._current_timeline() domview_ui.switch_timeline(timeline_name) pass + + def _show_FSM_editor(self): + if not self._fsm_editor_win: + def FSM_editor_close(): + self._fsm_editor_win.hide() + pass + def FSM_editor_destroy(): + self._fsm_editor_win = None + pass + fsm_win = FSM_window.FSM_window(FSM_editor_close, + FSM_editor_destroy) + self._fsm_editor_win = fsm_win + else: + fsm_win = self._fsm_editor_win + pass + fsm_win.show() + pass + + def _show_FSM_for_comp(self, comp_name): + pass def on_add_comp_clicked(self, *args): self._add_component() @@ -299,7 +321,7 @@ self._switch_component() self._drop_undo() pass - + ## \brief Handle of changing component name. # def on_cellrenderer_comp_edited(self, renderer, path, @@ -344,6 +366,14 @@ self._switch_component() self._drop_undo() pass + + ## \brief User clicks "State Machine" on context menu for a component. + # + def on_edit_FSM_activate(self, *args): + self._show_FSM_editor() + comp_name = self._current_component() + self._show_FSM_for_comp(comp_name) + pass def on_add_timeline_clicked(self, *args): self._add_timeline() diff -r 8ea0d32a1864 -r 894a4bf35fe6 pyink/component_dock.glade --- a/pyink/component_dock.glade Thu Apr 14 15:24:37 2011 +0800 +++ b/pyink/component_dock.glade Sat Apr 16 19:41:12 2011 +0800 @@ -229,6 +229,15 @@ + + + True + Edit FSM of the component. + State Machine + True + + + True