Пример #1
0
 def set_cursor(self, cursor: constants.CursorShapeStr | QtGui.QCursor) -> None:
     if isinstance(cursor, QtGui.QCursor):
         curs = cursor
     else:
         if cursor not in constants.CURSOR_SHAPE:
             raise InvalidParamError(cursor, constants.CURSOR_SHAPE)
         curs = gui.Cursor(constants.CURSOR_SHAPE[cursor])
     self.setCursor(curs)
Пример #2
0
    def mousePressEvent(self, event):
        """
        override to allow dragging the chart
        """
        if event.button() == QtCore.Qt.RightButton:
            cursor = gui.Cursor(QtCore.Qt.SizeAllCursor)
            QtWidgets.QApplication.setOverrideCursor(cursor)
            self.last_mouse_pos = event.pos()
            event.accept()

        super().mousePressEvent(event)
Пример #3
0
def test_cursor():
    cursor = gui.Cursor()
    cursor.set_shape("arrow")
    with pytest.raises(InvalidParamError):
        cursor.set_shape("test")
    assert cursor.get_shape() == "arrow"
    with open("data.pkl", "wb") as jar:
        pickle.dump(cursor, jar)
    with open("data.pkl", "rb") as jar:
        cursor = pickle.load(jar)
    bytes(cursor)
    cursor.get_position()
Пример #4
0
 def get_cursor(self) -> gui.Cursor:
     return gui.Cursor(self.cursor())
Пример #5
0
 def set_override_cursor(cls, cursor: constants.CursorShapeStr):
     crs = gui.Cursor(constants.CURSOR_SHAPE[cursor])
     cls.setOverrideCursor(crs)
Пример #6
0
def test_cursor():
    cursor = gui.Cursor()
    cursor.set_shape("arrow")
    with pytest.raises(ValueError):
        cursor.set_shape("test")
    assert cursor.get_shape() == "arrow"