from qtpy.QtCore import Qt from qtpy.QtGui import QPixmap, QCursor from functools import cached_property import os class RotateCursorList: @cached_property def Cursor0(self): return QCursor(QPixmap(r'icons/rotate_cursor0.png')) @cached_property def Cursor1(self): return QCursor(QPixmap(r'icons/rotate_cursor1.png')) @cached_property def Cursor2(self): return QCursor(QPixmap(r'icons/rotate_cursor2.png')) @cached_property def Cursor3(self): return QCursor(QPixmap(r'icons/rotate_cursor3.png')) @cached_property def Cursor4(self): return QCursor(QPixmap(r'icons/rotate_cursor4.png')) @cached_property def Cursor5(self): return QCursor(QPixmap(r'icons/rotate_cursor5.png')) @cached_property def Cursor6(self): return QCursor(QPixmap(r'icons/rotate_cursor6.png')) @cached_property def Cursor7(self): return QCursor(QPixmap(r'icons/rotate_cursor7.png')) def __getitem__(self, idx): return self.__getattribute__('Cursor' + str(idx)) resizeCursorList = [ Qt.CursorShape.SizeFDiagCursor, Qt.CursorShape.SizeVerCursor, Qt.CursorShape.SizeBDiagCursor, Qt.CursorShape.SizeHorCursor ] rotateCursorList = RotateCursorList() def get_magic_wand_cursor(): cursor_path = os.path.join(os.path.dirname(__file__), 'resources', 'magic_wand_cursor.png') if os.path.exists(cursor_path): pixmap = QPixmap(cursor_path) return QCursor(pixmap, hotX=0, hotY=0) else: return None