def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers): # todo: only let this event "count" if we moved far enough? maybe let this be a param within transition?? button, modifiers = 0, 0 # see caveats/bugs in HuntForClickAction_ToolStateBehavior comment transition = self.on_mouse_release_would_do(x, y, button, modifiers) ##### WRONG: button == 0 (but ignored by current code) tip, command, next_state, handled = parse_transition( transition) self._tip_and_highlight_info = tip del command, next_state return handled
def on_mouse_motion(self, x, y, dx, dy): # todo: only let this event "count" if we moved far enough? maybe let this be a param within transition?? button, modifiers = 0, 0 ### GUESS AT TYPE (not checked by current code, either) #### FIX: use current ones, not constant 0; get them from modkey press/release; # and call the following updater then too; later, worry about multiple buttons pressed at once transition = self.on_mouse_press_would_do(x, y, button, modifiers) tip, command, next_state, handled = parse_transition(transition) self._tip_and_highlight_info = tip del command, next_state return handled # guess at correct behavior; this lets background handlers highlight things too...
def on_mouse_motion(self, x, y, dx, dy): # todo: only let this event "count" if we moved far enough? maybe let this be a param within transition?? button, modifiers = 0, 0 ### GUESS AT TYPE (not checked by current code, either) #### FIX: use current ones, not constant 0; get them from modkey press/release; # and call the following updater then too; later, worry about multiple buttons pressed at once transition = self.on_mouse_press_would_do(x, y, button, modifiers) tip, command, next_state, handled = parse_transition( transition) self._tip_and_highlight_info = tip del command, next_state return handled # guess at correct behavior; this lets background handlers highlight things too...
def on_mouse_release(self, x, y, button, modifiers): """ Do whatever self.on_mouse_release_would_do() says to do, for this state. """ transition = self.on_mouse_release_would_do(x, y, button, modifiers) # pyglet API issue: if other mouse buttons are still pressed, do we have enough info?? tip, command, next_state, handled = parse_transition( transition) del tip self._tip_and_highlight_info = None # or something to say we're doing it, in case redraws occur during that? self._cmd_retval = self._doit(command) # this value is used for CMD_RETVAL assert self._cmd_retval or not command, "error: %r returns %r in %r" % \ (command, self._cmd_retval, self) # not ok in general, but will help catch bugs for now ### self.transition_to(next_state) return handled