mirror of
https://github.com/rbreu/beeref.git
synced 2026-03-11 08:54:28 +00:00
Move app name into constants module
This commit is contained in:
parent
7bf8f0304d
commit
e9c1eef0dc
10 changed files with 44 additions and 14 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
17
beeref/constants.py
Normal file
17
beeref/constants.py
Normal file
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
APPNAME = 'BeeRef'
|
||||
VERSION = '0.1'
|
||||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue