Browse Source

moved the cursors into their own project

master
Christian Voigt 1 year ago
parent
commit
da66eda790
  1. 36
      world_regions_widget/__init__.py

36
world_regions_widget/__init__.py

@ -1,13 +1,12 @@
import os
import math
import pathlib
import numpy as np
from PyQt5.QtCore import (
Qt, QPoint, QSize
Qt, QPoint
)
from PyQt5.QtGui import (
QCursor, QKeySequence, QPixmap
QKeySequence
)
from PyQt5.QtWidgets import (
QWidget, QAction,
@ -16,10 +15,12 @@ from PyQt5.QtWidgets import (
)
from einops import rearrange
from cursors import ChraniCursors
from .region_label_collection import RegionLabelCollection
class WorldRegionsWidget(QScrollArea):
class WorldRegionsWidget(QScrollArea, ChraniCursors):
root_dir = str
min_zoom_factor = float
@ -39,12 +40,6 @@ class WorldRegionsWidget(QScrollArea):
world_regions_image_raw_data = np.array
cursor_add_region = QCursor
cursor_remove_region = QCursor
cursor_hover_region = QCursor
cursor_region_context = QCursor
cursor_blank = QCursor
def __init__(self, zoom_factor=1.0, min_zoom_factor=0.5, max_zoom_factor=24.0, region_size=48):
super().__init__()
self.world_loaded = False
@ -94,26 +89,7 @@ class WorldRegionsWidget(QScrollArea):
self.addAction(self.action_save_world_file)
def init_cursors(self):
self.root_dir = os.path.dirname(os.path.abspath(__file__))
scale_options = (QSize(86, 86), Qt.KeepAspectRatio)
self.cursor_hover_region = QCursor(
QPixmap(os.path.join(self.root_dir, 'cursors/hover_region.png')).scaled(*scale_options), -1, -1
)
self.cursor_add_region = QCursor(
QPixmap(os.path.join(self.root_dir, 'cursors/add_region.png')).scaled(*scale_options), -1, -1
)
self.cursor_remove_region = QCursor(
QPixmap(os.path.join(self.root_dir, 'cursors/remove_region.png')).scaled(*scale_options), -1, -1
)
self.cursor_region_context = QCursor(
QPixmap(os.path.join(self.root_dir, 'cursors/region_context.png')).scaled(*scale_options), -1, -1
)
self.cursor_blank = QCursor(
QPixmap(os.path.join(self.root_dir, 'cursors/blank_cursor.png')).scaled(*scale_options), -1, -1
)
self.setCursor(self.cursor_hover_region)
pass
def action_zoom_in(self):
self.world_label_zoom_factor += self.min_zoom_factor

Loading…
Cancel
Save