def __init__(self, canvas, parent, plot_win, prj, coordinates=True): self.plot_win = plot_win self.prj = prj self.grid_action = None self.flagged_action = None self.flag_action = None self.unflag_action = None self.insert_action = None self.insert_sample = None self.mon_label = None self._ids_flag = None self._flag_mode = None self._flag_start = None self._flag_end = None # custom cursors pan_px = QtGui.QPixmap(os.path.join(self.media, 'pan_cursor.png')) pan_px.setMask(pan_px.mask()) self.pan_cursor = QtGui.QCursor(pan_px) grab_px = QtGui.QPixmap(os.path.join(self.media, 'grab_cursor.png')) grab_px.setMask(grab_px.mask()) self.grab_cursor = QtGui.QCursor(grab_px) NavigationToolbar2QT.__init__(self, canvas=canvas, parent=parent, coordinates=coordinates) self.setIconSize(QtCore.QSize(24, 24)) self.canvas.mpl_connect('button_press_event', self.press) self.canvas.mpl_connect('button_release_event', self.release)
def getMousePos(self) -> Tuple[int, int]: """ TODO: Write documentation. """ pos = self.mapFromGlobal(QtGui.QCursor().pos()) return pos.x(), pos.y()