def scroll_event(self, widget, event): x, y = event.x(), event.y() # accept event here so it doesn't get propagated to parent event.accept() self.last_win_x, self.last_win_y = x, y data_x, data_y = self.check_cursor_location() # NOTE: for future use in distinguishing mouse wheel vs. # trackpad events src = 'wheel' if hasattr(event, 'source'): # Qt5 only, it seems _src = event.source() if _src == QtCore.Qt.MouseEventNotSynthesized: src = 'wheel' else: src = 'trackpad' # noqa point = event.pixelDelta() dx, dy = point.x(), point.y() # Synthesize this as a pan gesture event self.make_ui_callback('pan', 'start', 0, 0) self.make_ui_callback('pan', 'move', dx, dy) return self.make_ui_callback('pan', 'stop', 0, 0) num_degrees, direction = get_scroll_info(event) self.logger.debug("scroll deg={} direction={}".format( num_degrees, direction)) return self.make_ui_callback('scroll', direction, num_degrees, data_x, data_y)
def scroll_event(self, widget, event): x, y = event.x(), event.y() self.last_win_x, self.last_win_y = x, y numDegrees, direction = get_scroll_info(event) self.logger.debug("scroll deg=%f direction=%f" % (numDegrees, direction)) data_x, data_y = self.get_data_xy(x, y) self.last_data_x, self.last_data_y = data_x, data_y return self.make_ui_callback('scroll', direction, numDegrees, data_x, data_y)
def scroll_event(self, widget, event): x, y = event.x(), event.y() self.last_win_x, self.last_win_y = x, y numDegrees, direction = get_scroll_info(event) self.logger.debug("scroll deg=%f direction=%f" % ( numDegrees, direction)) data_x, data_y = self.get_data_xy(x, y) self.last_data_x, self.last_data_y = data_x, data_y return self.make_ui_callback('scroll', direction, numDegrees, data_x, data_y)
def wheelEvent(self, event): num_degrees, direction = get_scroll_info(event) if (direction < 90.0) or (direction > 270.0): # up scale_factor = 1.1 else: # not up! scale_factor = 0.9 self.stretch_colormap(scale_factor) self.make_callback("scroll", event)
def wheelEvent(self, event): num_degrees, direction = get_scroll_info(event) if (direction < 90.0) or (direction > 270.0): # up scale_factor = 1.1 else: # not up! scale_factor = 0.9 self.stretch_colormap(scale_factor) self.make_callback('scroll', event)
def scroll_event(self, widget, event): x, y = event.x(), event.y() self.last_win_x, self.last_win_y = x, y num_degrees, direction = get_scroll_info(event) self.logger.debug("scroll deg={} direction={}".format( num_degrees, direction)) # NOTE: for future use in distinguishing mouse wheel vs. # trackpad events src = 'wheel' if hasattr(event, 'source'): # Qt5 only, it seems _src = event.source() if _src == QtCore.Qt.MouseEventNotSynthesized: src = 'wheel' else: src = 'trackpad' data_x, data_y = self.check_cursor_location() return self.make_ui_callback('scroll', direction, num_degrees, data_x, data_y)
def scroll_event(self, widget, event): x, y = event.x(), event.y() self.last_win_x, self.last_win_y = x, y num_degrees, direction = get_scroll_info(event) self.logger.debug("scroll deg={} direction={}".format( num_degrees, direction)) # NOTE: for future use in distinguishing mouse wheel vs. # trackpad events src = 'wheel' if hasattr(event, 'source'): # Qt5 only, it seems _src = event.source() if _src == QtCore.Qt.MouseEventNotSynthesized: src = 'wheel' else: src = 'trackpad' data_x, data_y = self.get_data_xy(x, y) self.last_data_x, self.last_data_y = data_x, data_y return self.make_ui_callback('scroll', direction, num_degrees, data_x, data_y)