changeset 1505:7b8e67b2391b

Hint for user overing a state object
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 09 May 2011 15:20:29 +0800
parents d5b677831671
children f185a9d23a30
files pyink/FSM_window.py
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/FSM_window.py	Mon May 09 00:27:10 2011 +0800
+++ b/pyink/FSM_window.py	Mon May 09 15:20:29 2011 +0800
@@ -883,9 +883,15 @@
         pass
 
     def start_hint(self):
+        circle_node = self._circle_node
+        circle_node.setAttribute('style', 'stroke: #000000; stroke-width: 3; '
+                                 'fill: #ffffff')
         pass
 
     def stop_hint(self):
+        circle_node = self._circle_node
+        circle_node.setAttribute('style', 'stroke: #000000; stroke-width: 1; '
+                                 'fill: #ffffff')
         pass
     pass
 
@@ -1005,10 +1011,10 @@
     def _handle_select_transition_target(self, state, evtype, button, x, y):
         if self._candidate_target != state and self._menu_state != state:
             if self._candidate_target:
-                self._candidate_target.hide_selected()
+                self._candidate_target.stop_hint()
                 pass
             self._candidate_target = state
-            state.show_selected()
+            state.start_hint()
             pass
 
         if evtype != pybInkscape.PYSPItem.PYB_EVENT_BUTTON_RELEASE:
@@ -1038,6 +1044,10 @@
         window._install_transition_event_handler(trn)
         
         window.pop_grabs()
+
+        target_state.stop_hint()
+        select = self._select
+        select.deselect()
         pass
 
     def _handle_add_transition(self, *args):
@@ -1161,11 +1171,11 @@
             if evtype == pybInkscape.PYSPItem.PYB_EVENT_BUTTON_RELEASE:
                 window.ungrab_mouse()
                 pass
-            new_state_x = orign_state_x + start_x - x
-            new_state_y = orign_state_y + start_y - y
+            new_state_x = orign_state_x + x - start_x
+            new_state_y = orign_state_y + y - start_y
 
             domview = self._domview
-            domview.set_state_xy(state.state_name, x, y)
+            domview.set_state_xy(state.state_name, new_state_x, new_state_y)
             state.update()
             state.adjust_transitions()
             state.show_selected()
@@ -1350,9 +1360,6 @@
         if evtype == pybInkscape.PYSPItem.PYB_EVENT_BUTTON_RELEASE and \
                 button == 1:
             self._select_transition(trn)
-        elif evtype == pybInkscape.PYSPItem.PYB_EVENT_MOUSE_ENTER:
-            self._hint_transition(trn)
-            pass
         else:
             self._popup._handle_transition_mouse_events(trn, evtype, button,
                                                         x, y)