diff --git a/beeref/__main__.py b/beeref/__main__.py index a2be6e1..91aadd0 100755 --- a/beeref/__main__.py +++ b/beeref/__main__.py @@ -23,15 +23,18 @@ from PyQt6 import QtCore, QtWidgets from beeref.assets import BeeAssets from beeref.config import CommandlineArgs +from beeref import constants from beeref.view import BeeGraphicsView -logger = logging.getLogger('BeeRef') +logger = logging.getLogger(constants.APPNAME) class BeeRefMainWindow(QtWidgets.QWidget): def __init__(self, app): super().__init__() + app.setOrganizationName(constants.APPNAME) + app.setApplicationName(constants.APPNAME) self.setWindowIcon(BeeAssets().logo) layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(QtCore.QMargins(0, 0, 0, 0)) diff --git a/beeref/assets.py b/beeref/assets.py index d2174fe..e3821a1 100644 --- a/beeref/assets.py +++ b/beeref/assets.py @@ -20,8 +20,10 @@ import os.path from PyQt6 import QtGui +from beeref import constants -logger = logging.getLogger('BeeRef') + +logger = logging.getLogger(constants.APPNAME) class BeeAssets: diff --git a/beeref/constants.py b/beeref/constants.py new file mode 100644 index 0000000..58a30b5 --- /dev/null +++ b/beeref/constants.py @@ -0,0 +1,17 @@ +# 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 . + +APPNAME = 'BeeRef' +VERSION = '0.1' diff --git a/beeref/fileio/__init__.py b/beeref/fileio/__init__.py index bff9379..b8bf4f1 100644 --- a/beeref/fileio/__init__.py +++ b/beeref/fileio/__init__.py @@ -19,6 +19,7 @@ import logging from PyQt6 import QtCore, QtGui from beeref import commands +from beeref import constants from beeref.fileio.errors import BeeFileIOError from beeref.fileio.sql import SQLiteIO from beeref.items import BeePixmapItem @@ -32,7 +33,7 @@ __all__ = [ 'BeeFileIOError', ] -logger = logging.getLogger('BeeRef') +logger = logging.getLogger(constants.APPNAME) def load_bee(filename, scene, worker=None): diff --git a/beeref/fileio/sql.py b/beeref/fileio/sql.py index 8a105fc..e69b8d9 100644 --- a/beeref/fileio/sql.py +++ b/beeref/fileio/sql.py @@ -30,11 +30,12 @@ import sqlite3 from PyQt6 import QtGui from beeref.items import BeePixmapItem +from beeref import constants from .errors import BeeFileIOError from .schema import SCHEMA -logger = logging.getLogger('BeeRef') +logger = logging.getLogger(constants.APPNAME) def handle_sqlite_errors(func): diff --git a/beeref/gui.py b/beeref/gui.py index 63cbc6e..147de1f 100644 --- a/beeref/gui.py +++ b/beeref/gui.py @@ -19,8 +19,10 @@ import os.path from PyQt6 import QtWidgets from PyQt6.QtCore import Qt +from beeref import constants -logger = logging.getLogger('BeeRef') + +logger = logging.getLogger(constants.APPNAME) class WelcomeOverlay(QtWidgets.QWidget): @@ -67,7 +69,7 @@ class BeeProgressDialog(QtWidgets.QProgressDialog): class HelpDialog(QtWidgets.QDialog): def __init__(self, parent): super().__init__(parent) - self.setWindowTitle('BeeRef Help') + self.setWindowTitle(f'{constants.APPNAME} Help') docdir = os.path.join(os.path.dirname(__file__), 'documentation') tabs = QtWidgets.QTabWidget() diff --git a/beeref/items.py b/beeref/items.py index 72ab8c3..df150b4 100644 --- a/beeref/items.py +++ b/beeref/items.py @@ -21,10 +21,11 @@ import logging from PyQt6 import QtCore, QtGui, QtWidgets +from beeref import constants from beeref.selection import SelectableMixin -logger = logging.getLogger('BeeRef') +logger = logging.getLogger(constants.APPNAME) class BeePixmapItem(SelectableMixin, QtWidgets.QGraphicsPixmapItem): diff --git a/beeref/scene.py b/beeref/scene.py index 44dec3c..518b12f 100644 --- a/beeref/scene.py +++ b/beeref/scene.py @@ -23,10 +23,11 @@ from PyQt6.QtCore import Qt import rpack from beeref import commands +from beeref import constants from beeref.selection import MultiSelectItem, RubberbandItem -logger = logging.getLogger('BeeRef') +logger = logging.getLogger(constants.APPNAME) class BeeGraphicsScene(QtWidgets.QGraphicsScene): diff --git a/beeref/selection.py b/beeref/selection.py index d282b37..712ef6f 100644 --- a/beeref/selection.py +++ b/beeref/selection.py @@ -25,11 +25,12 @@ from PyQt6.QtWidgets import QGraphicsItem from beeref.assets import BeeAssets from beeref import commands from beeref.config import CommandlineArgs +from beeref import constants from beeref import utils commandline_args = CommandlineArgs() -logger = logging.getLogger('BeeRef') +logger = logging.getLogger(constants.APPNAME) SELECT_COLOR = QtGui.QColor(116, 234, 231, 255) diff --git a/beeref/view.py b/beeref/view.py index 91de77a..a42a91a 100644 --- a/beeref/view.py +++ b/beeref/view.py @@ -22,6 +22,7 @@ from PyQt6.QtCore import Qt from beeref.actions import ActionsMixin from beeref import commands from beeref.config import CommandlineArgs +from beeref import constants from beeref import fileio from beeref.gui import BeeProgressDialog, WelcomeOverlay, HelpDialog from beeref.items import BeePixmapItem @@ -29,7 +30,7 @@ from beeref.scene import BeeGraphicsScene commandline_args = CommandlineArgs() -logger = logging.getLogger('BeeRef') +logger = logging.getLogger(constants.APPNAME) class BeeGraphicsView(QtWidgets.QGraphicsView, ActionsMixin): @@ -89,11 +90,11 @@ class BeeGraphicsView(QtWidgets.QGraphicsView, ActionsMixin): def update_window_title(self): clean = self.undo_stack.isClean() if clean and not self.filename: - title = 'BeeRef' + title = constants.APPNAME else: name = os.path.basename(self.filename or '[Untitled]') clean = '' if clean else '*' - title = f'{name}{clean} - BeeRef' + title = f'{name}{clean} - {constants.APPNAME}' self.parent().setWindowTitle(title) def on_scene_changed(self, region): @@ -284,7 +285,7 @@ class BeeGraphicsView(QtWidgets.QGraphicsView, ActionsMixin): filename, f = QtWidgets.QFileDialog.getOpenFileName( parent=self, caption='Open file', - filter='BeeRef File (*.bee)') + filter=f'{constants.APPNAME} File (*.bee)') if filename: self.open_from_file(filename) self.filename = filename @@ -316,7 +317,7 @@ class BeeGraphicsView(QtWidgets.QGraphicsView, ActionsMixin): filename, f = QtWidgets.QFileDialog.getSaveFileName( parent=self, caption='Save file', - filter='BeeRef File (*.bee)') + filter=f'{constants.APPNAME} File (*.bee)') if filename: self.do_save(filename, create_new=True)