def setup_filter(self, baseplot): filter = baseplot.filter # Initialisation du filtre start_state = filter.new_state() # Bouton gauche : ObjectHandler(filter, Qt.LeftButton, start_state=start_state) ObjectHandler(filter, Qt.LeftButton, mods=Qt.ControlModifier, start_state=start_state, multiselection=True) filter.add_event(start_state, KeyEventMatch(( Qt.Key_Enter, Qt.Key_Return, )), baseplot.do_enter_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Space, )), baseplot.do_space_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Right, )), baseplot.do_right_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Left, )), baseplot.do_left_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Backspace, )), baseplot.do_backspace_pressed, start_state) return setup_standard_tool_filter(filter, start_state)
def setup_filter(self, baseplot): filter = baseplot.filter # Initialisation du filtre start_state = filter.new_state() # Bouton gauche : # start_state = filter.new_state() handler = QtDragHandler(filter, Qt.LeftButton, start_state=start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Space, )), baseplot.do_space_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Backspace, Qt.Key_Escape)), baseplot.do_backspace_pressed, start_state) self.connect(handler, SIG_MOVE, baseplot.move_in_drag_mode) self.connect(handler, SIG_START_TRACKING, baseplot.start_drag_mode) self.connect(handler, SIG_STOP_NOT_MOVING, baseplot.stop_drag_mode) self.connect(handler, SIG_STOP_MOVING, baseplot.stop_drag_mode) """ filter.add_event(self.state0, filter.mouse_release(btn), self.stop_notmoving, start_state) filter.add_event(self.state1, filter.mouse_release(btn), self.stop_moving, start_state) """ # Bouton du milieu ImprovedPanHandler(filter, Qt.MidButton, start_state=start_state) ImprovedPanHandler(filter, Qt.LeftButton, mods=Qt.AltModifier, start_state=start_state) # Bouton droit class ZoomHandlerWithStopingEvent(ImprovedZoomHandler): def stop_moving(self, filter_, event): x_state, y_state = self.get_move_state(filter_, event.pos()) filter_.plot.do_finish_zoom_view(x_state, y_state) ZoomHandlerWithStopingEvent(filter, Qt.RightButton, start_state=start_state) ZoomHandlerWithStopingEvent(filter, Qt.LeftButton, mods=Qt.ControlModifier, start_state=start_state) # Autres (touches, move) MoveHandler(filter, start_state=start_state) MoveHandler(filter, start_state=start_state, mods=Qt.ShiftModifier) MoveHandler(filter, start_state=start_state, mods=Qt.AltModifier) return start_state
def setup_filter(self, baseplot): filter = baseplot.filter # Initialisation du filtre start_state = filter.new_state() # Bouton gauche : ObjectHandler(filter, Qt.LeftButton, start_state=start_state) filter.add_event(start_state, KeyEventMatch(( Qt.Key_Enter, Qt.Key_Return, )), baseplot.do_enter_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Space, )), baseplot.do_space_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Right, )), baseplot.do_right_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Left, )), baseplot.do_left_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Backspace, Qt.Key_Escape)), baseplot.do_backspace_pressed, start_state) # Bouton du milieu ImprovedPanHandler(filter, Qt.MidButton, start_state=start_state) ImprovedPanHandler(filter, Qt.LeftButton, mods=Qt.AltModifier, start_state=start_state) # Bouton droit ImprovedZoomHandler(filter, Qt.RightButton, start_state=start_state) ImprovedZoomHandler(filter, Qt.LeftButton, mods=Qt.ControlModifier, start_state=start_state) # Autres (touches, move) MoveHandler(filter, start_state=start_state) MoveHandler(filter, start_state=start_state, mods=Qt.ShiftModifier) MoveHandler(filter, start_state=start_state, mods=Qt.AltModifier) return start_state
def setup_filter(self, baseplot): filter = baseplot.filter # Initialisation du filtre start_state = filter.new_state() # Bouton gauche : #start_state = filter.new_state() handler = QtDragHandler(filter, Qt.LeftButton, start_state=start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Space, )), baseplot.do_space_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_Backspace, )), baseplot.do_backspace_pressed, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_C, )), baseplot.do_c_pressed, start_state) self.connect(handler, SIG_MOVE, baseplot.move_in_drag_mode) self.connect(handler, SIG_START_TRACKING, baseplot.start_drag_mode) self.connect(handler, SIG_STOP_NOT_MOVING, baseplot.stop_drag_mode) self.connect(handler, SIG_STOP_MOVING, baseplot.stop_drag_mode) #self.connect(handler, SIGNAL("doubleClicked()"), baseplot.do_c_pressed) return setup_standard_tool_filter(filter, start_state)
def setup_filter(self, baseplot): filter = baseplot.filter # Initialisation du filtre start_state = filter.new_state() key_left_handler = lambda *a: baseplot.KEY_LEFT.emit() key_right_handler = lambda *a: baseplot.KEY_RIGHT.emit() key_end_handler = lambda *a: baseplot.KEY_END.emit() key_backspace_handler = lambda *a: baseplot.KEY_BACKSPACE.emit() key_left_and_aliases = [(Qt.Key_Z, Qt.ControlModifier), Qt.Key_Left] filter.add_event(start_state, KeyEventMatch(key_left_and_aliases), key_left_handler, start_state) key_right_and_aliases = [(Qt.Key_Y, Qt.ControlModifier), Qt.Key_Right] filter.add_event(start_state, KeyEventMatch(key_right_and_aliases), key_right_handler, start_state) filter.add_event( start_state, KeyEventMatch((Qt.Key_Backspace, Qt.Key_Escape, Qt.Key_Home)), key_backspace_handler, start_state) filter.add_event(start_state, KeyEventMatch((Qt.Key_End, )), key_end_handler, start_state) handler = QtDragHandler(filter, Qt.LeftButton, start_state=start_state) self.connect(handler, SIG_MOVE, baseplot.move_in_drag_mode) self.connect(handler, SIG_START_TRACKING, baseplot.start_drag_mode) self.connect(handler, SIG_STOP_NOT_MOVING, baseplot.stop_drag_mode) self.connect(handler, SIG_STOP_MOVING, baseplot.stop_drag_mode) handler = QtDragHandler(filter, Qt.LeftButton, start_state=start_state, mods=Qt.ShiftModifier) self.connect(handler, SIG_MOVE, baseplot.move_in_drag_mode) self.connect(handler, SIG_START_TRACKING, baseplot.start_drag_mode) self.connect(handler, SIG_STOP_NOT_MOVING, baseplot.stop_drag_mode) self.connect(handler, SIG_STOP_MOVING, baseplot.stop_drag_mode) # Bouton du milieu PanHandler(filter, Qt.MidButton, start_state=start_state) PanHandler(filter, Qt.LeftButton, mods=Qt.AltModifier, start_state=start_state) # AutoZoomHandler(filter, Qt.MidButton, start_state=start_state) # Bouton droit ZoomHandler(filter, Qt.RightButton, start_state=start_state) ZoomHandler(filter, Qt.LeftButton, mods=Qt.ControlModifier, start_state=start_state) # MenuHandler(filter, Qt.RightButton, start_state=start_state) # Autres (touches, move) MoveHandler(filter, start_state=start_state) MoveHandler(filter, start_state=start_state, mods=Qt.ShiftModifier) MoveHandler(filter, start_state=start_state, mods=Qt.AltModifier) return start_state