diff --git a/beeref/assets.py b/beeref/assets.py deleted file mode 100644 index 99b325a..0000000 --- a/beeref/assets.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python3 - -# This file is part of BeeRef. -# -# BeeRef is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# BeeRef is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with BeeRef. If not, see . - -import logging -import os.path - -from PyQt6 import QtGui, QtWidgets - - -logger = logging.getLogger(__name__) - - -class BeeAssets: - _instance = None - PATH = os.path.join(os.path.dirname(__file__), 'assets') - - def __new__(cls, *args, **kwargs): - if not cls._instance: - cls._instance = super().__new__(cls, *args, **kwargs) - cls._instance.on_new() - return cls._instance - - def on_new(self): - logger.debug(f'Assets path: {self.PATH}') - - self.logo = QtGui.QIcon(os.path.join(self.PATH, 'logo.png')) - self.cursor_rotate = self.cursor_from_image( - 'cursor_rotate.png', (20, 20)) - self.cursor_flip_h = self.cursor_from_image( - 'cursor_flip_h.png', (20, 20)) - self.cursor_flip_v = self.cursor_from_image( - 'cursor_flip_v.png', (20, 20)) - - def cursor_from_image(self, filename, hotspot): - app = QtWidgets.QApplication.instance() - scaling = app.primaryScreen().devicePixelRatio() - img = QtGui.QImage(os.path.join(self.PATH, filename)) - pixmap = QtGui.QPixmap.fromImage(img) - pixmap.setDevicePixelRatio(scaling) - return QtGui.QCursor(pixmap, hotspot[0]/scaling, hotspot[1]/scaling) diff --git a/beeref/assets/__init__.py b/beeref/assets/__init__.py index 99b325a..97068b6 100644 --- a/beeref/assets/__init__.py +++ b/beeref/assets/__init__.py @@ -26,7 +26,7 @@ logger = logging.getLogger(__name__) class BeeAssets: _instance = None - PATH = os.path.join(os.path.dirname(__file__), 'assets') + PATH = os.path.dirname(__file__) def __new__(cls, *args, **kwargs): if not cls._instance: