mosamatic2 2.0.1__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mosamatic2 might be problematic. Click here for more details.
- mosamatic2-2.0.2/PKG-INFO +31 -0
- mosamatic2-2.0.2/pyproject.toml +47 -0
- mosamatic2-2.0.2/src/mosamatic2/app.py +28 -0
- mosamatic2-2.0.2/src/mosamatic2/constants.py +24 -0
- mosamatic2-2.0.2/src/mosamatic2/core/__init__.py +0 -0
- mosamatic2-2.0.2/src/mosamatic2/core/managers/__init__.py +0 -0
- mosamatic2-2.0.2/src/mosamatic2/core/managers/logmanager.py +47 -0
- mosamatic2-2.0.2/src/mosamatic2/core/managers/logmanagerlistener.py +3 -0
- mosamatic2-2.0.2/src/mosamatic2/core/singleton.py +9 -0
- mosamatic2-2.0.2/src/mosamatic2/core/utils.py +0 -0
- mosamatic2-2.0.2/src/mosamatic2/server.py +2 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/__init__.py +0 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/mainwindow.py +62 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/resources/VERSION +1 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/resources/icons/mosamatic2.icns +0 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/resources/icons/mosamatic2.ico +0 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/resources/icons/spinner.gif +0 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/resources/images/body-composition.jpg +0 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/settings.py +62 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/utils.py +36 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/widgets/__init__.py +0 -0
- mosamatic2-2.0.2/src/mosamatic2/ui/widgets/splashscreen.py +101 -0
- mosamatic2-2.0.1/PKG-INFO +0 -12
- mosamatic2-2.0.1/pyproject.toml +0 -28
- mosamatic2-2.0.1/src/mosamatic2/api.py +0 -2
- mosamatic2-2.0.1/src/mosamatic2/app.py +0 -2
- {mosamatic2-2.0.1 → mosamatic2-2.0.2}/README.md +0 -0
- {mosamatic2-2.0.1 → mosamatic2-2.0.2}/src/models.py +0 -0
- {mosamatic2-2.0.1 → mosamatic2-2.0.2}/src/mosamatic2/__init__.py +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: mosamatic2
|
|
3
|
+
Version: 2.0.2
|
|
4
|
+
Summary:
|
|
5
|
+
Author: Ralph Brecheisen
|
|
6
|
+
Author-email: r.brecheisen@maastrichtuniversity.nl
|
|
7
|
+
Requires-Python: >=3.11,<3.12
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Requires-Dist: nibabel (>=5.3.2)
|
|
11
|
+
Requires-Dist: numpy (>=1.26.4)
|
|
12
|
+
Requires-Dist: openpyxl (>=3.1.5)
|
|
13
|
+
Requires-Dist: pandas (>=2.3.2)
|
|
14
|
+
Requires-Dist: pendulum (>=3.1.0)
|
|
15
|
+
Requires-Dist: pillow (>=11.3.0)
|
|
16
|
+
Requires-Dist: pydicom (>=3.0.1)
|
|
17
|
+
Requires-Dist: pyside6-essentials (>=6.9)
|
|
18
|
+
Requires-Dist: python-gdcm (>=3.0.26)
|
|
19
|
+
Requires-Dist: scipy (>=1.15.3)
|
|
20
|
+
Requires-Dist: tensorboard (==2.15.2)
|
|
21
|
+
Requires-Dist: tensorboard-data-server (==0.7.2)
|
|
22
|
+
Requires-Dist: tensorflow (==2.15.*) ; platform_system == "Linux"
|
|
23
|
+
Requires-Dist: tensorflow-intel (==2.15.0) ; platform_system == "Windows"
|
|
24
|
+
Requires-Dist: tensorflow-io-gcs-filesystem (==0.31.0)
|
|
25
|
+
Requires-Dist: tensorflow-macos (==2.15.0) ; platform_system == "Darwin" and platform_machine == "arm64"
|
|
26
|
+
Requires-Dist: torch (>=2.8.0)
|
|
27
|
+
Requires-Dist: torchvision (>=0.23.0)
|
|
28
|
+
Requires-Dist: totalsegmentator (>=2.11.0)
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mosamatic2"
|
|
3
|
+
version = "2.0.2"
|
|
4
|
+
description = ""
|
|
5
|
+
authors = [
|
|
6
|
+
{name = "Ralph Brecheisen", email = "r.brecheisen@maastrichtuniversity.nl"}
|
|
7
|
+
]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.11,<3.12"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"pyside6-essentials>=6.9",
|
|
12
|
+
"pydicom>=3.0.1",
|
|
13
|
+
"numpy>=1.26.4",
|
|
14
|
+
"pandas>=2.3.2",
|
|
15
|
+
"nibabel>=5.3.2",
|
|
16
|
+
"openpyxl>=3.1.5",
|
|
17
|
+
"pendulum>=3.1.0",
|
|
18
|
+
"pillow>=11.3.0",
|
|
19
|
+
"python-gdcm>=3.0.26",
|
|
20
|
+
"scipy>=1.15.3",
|
|
21
|
+
"torch>=2.8.0",
|
|
22
|
+
"torchvision>=0.23.0",
|
|
23
|
+
"tensorflow==2.15.*; platform_system == 'Linux'",
|
|
24
|
+
"tensorflow-intel==2.15.0; platform_system == 'Windows'",
|
|
25
|
+
"tensorflow-macos==2.15.0; platform_system == 'Darwin' and platform_machine == 'arm64'",
|
|
26
|
+
"tensorboard==2.15.2",
|
|
27
|
+
"tensorboard-data-server==0.7.2",
|
|
28
|
+
"tensorflow-io-gcs-filesystem==0.31.0",
|
|
29
|
+
"totalsegmentator>=2.11.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[tool.poetry]
|
|
33
|
+
packages = [
|
|
34
|
+
{include = "mosamatic2", from = "src"},
|
|
35
|
+
{include = "models.py", from = "src" },
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[tool.poetry.scripts]
|
|
39
|
+
mosamatic2 = "mosamatic2.app:main"
|
|
40
|
+
mosamatic2-server = "mosamatic2.server:main"
|
|
41
|
+
|
|
42
|
+
[tool.poetry.group.dev.dependencies]
|
|
43
|
+
pytest = "^8.4.1"
|
|
44
|
+
|
|
45
|
+
[build-system]
|
|
46
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
47
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import traceback
|
|
3
|
+
import mosamatic2.constants as constants
|
|
4
|
+
from PySide6 import QtWidgets
|
|
5
|
+
from mosamatic2.ui.settings import Settings
|
|
6
|
+
from mosamatic2.core.managers.logmanager import LogManager
|
|
7
|
+
from mosamatic2.ui.widgets.splashscreen import SplashScreen
|
|
8
|
+
|
|
9
|
+
LOG = LogManager()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def main():
|
|
13
|
+
settings = Settings()
|
|
14
|
+
application_name = settings.get(constants.MOSAMATIC2_WINDOW_TITLE)
|
|
15
|
+
QtWidgets.QApplication.setApplicationName(application_name)
|
|
16
|
+
app = QtWidgets.QApplication(sys.argv)
|
|
17
|
+
app.setApplicationName(application_name)
|
|
18
|
+
try:
|
|
19
|
+
splash = SplashScreen()
|
|
20
|
+
splash.show()
|
|
21
|
+
sys.exit(app.exec())
|
|
22
|
+
except Exception as e:
|
|
23
|
+
LOG.error(str(e))
|
|
24
|
+
LOG.error(traceback.format_exc())
|
|
25
|
+
sys.exit(1)
|
|
26
|
+
|
|
27
|
+
if __name__ == '__main__':
|
|
28
|
+
main()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MOSAMATIC2_BUNDLE_IDENTIFIER = 'org.mumc'
|
|
2
|
+
MOSAMATIC2_APP_NAME = 'mosamatic2'
|
|
3
|
+
MOSAMATIC2_VERSION_FILE = 'mosamatic2/ui/resources/VERSION'
|
|
4
|
+
MOSAMATIC2_IMAGES_DIR_PATH = 'mosamatic2/ui/resources/images'
|
|
5
|
+
MOSAMATIC2_ICONS_DIR_PATH = 'mosamaticdesktop/resources/ui/images/icons'
|
|
6
|
+
MOSAMATIC2_APP_ICON_FILE_NAME_WIN = 'mosamaticdesktop.ico'
|
|
7
|
+
MOSAMATIC2_APP_ICON_FILE_NAME_MAC = 'mosamaticdesktop.icns'
|
|
8
|
+
MOSAMATIC2_BACKGROUND_IMAGE_FILE_NAME = 'body-composition.jpg'
|
|
9
|
+
MOSAMATIC2_BACKGROUND_IMAGE_OPACITY = 0.4
|
|
10
|
+
|
|
11
|
+
MOSAMATIC2_WINDOW_TITLE = 'Mosamatic'
|
|
12
|
+
MOSAMATIC2_WINDOW_W = 1000
|
|
13
|
+
MOSAMATIC2_WINDOW_H = 600
|
|
14
|
+
MOSAMATIC2_WINDOW_GEOMETRY_KEY = 'mainwindow/geometry'
|
|
15
|
+
MOSAMATIC2_WINDOW_STATE_KEY = 'mainwindow/state'
|
|
16
|
+
|
|
17
|
+
MOSAMATIC2_SPLASH_SCREEN_TITLE = MOSAMATIC2_WINDOW_TITLE
|
|
18
|
+
MOSAMATIC2_SPLASH_SCREEN_TITLE_STYLESHEET = 'color: rgb(64, 64, 64); font-weight: bold; font-size: 32pt;'
|
|
19
|
+
MOSAMATIC2_SPLASH_SCREEN_SUB_TEXT = 'This software is for research only'
|
|
20
|
+
MOSAMATIC2_SPLASH_SCREEN_SUB_TEXT_STYLE_SHEET = 'color: rgb(64, 64, 64); font-style: italic; font-size: 10pt;'
|
|
21
|
+
MOSAMATIC2_SPLASH_SCREEN_START_BUTTON_TEXT = 'Start Application'
|
|
22
|
+
MOSAMATIC2_SPLASH_SCREEN_QUIT_BUTTON_TEXT = 'Quit'
|
|
23
|
+
MOSAMATIC2_SPLASH_SCREEN_W = 600
|
|
24
|
+
MOSAMATIC2_SPLASH_SCREEN_H = 300
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import atexit
|
|
3
|
+
import datetime
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from mosamatic2.core.singleton import singleton
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@singleton
|
|
9
|
+
class LogManager:
|
|
10
|
+
def __init__(self, suppress_print=False):
|
|
11
|
+
self._suppress_print = suppress_print
|
|
12
|
+
self._listeners = []
|
|
13
|
+
file_path = os.path.join(Path.home(), 'mosamatic2.log')
|
|
14
|
+
if os.path.isfile(file_path):
|
|
15
|
+
os.remove(file_path)
|
|
16
|
+
self._file_handle = open(file_path, 'w', buffering=1)
|
|
17
|
+
atexit.register(self.close_file)
|
|
18
|
+
|
|
19
|
+
def _log(self, level, message):
|
|
20
|
+
timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
|
21
|
+
message = f'[{timestamp}] {level} : {message}'
|
|
22
|
+
if not self._suppress_print:
|
|
23
|
+
print(message)
|
|
24
|
+
self._file_handle.write(message + '\n')
|
|
25
|
+
self.notify_listeners(message)
|
|
26
|
+
return message
|
|
27
|
+
|
|
28
|
+
def info(self, message):
|
|
29
|
+
return self._log('INFO', message)
|
|
30
|
+
|
|
31
|
+
def warning(self, message):
|
|
32
|
+
return self._log('WARNING', message)
|
|
33
|
+
|
|
34
|
+
def error(self, message):
|
|
35
|
+
return self._log('ERROR', message)
|
|
36
|
+
|
|
37
|
+
def add_listener(self, listener):
|
|
38
|
+
if listener not in self._listeners:
|
|
39
|
+
self._listeners.append(listener)
|
|
40
|
+
|
|
41
|
+
def notify_listeners(self, message):
|
|
42
|
+
for listener in self._listeners:
|
|
43
|
+
listener.new_message(message)
|
|
44
|
+
|
|
45
|
+
def close_file(self):
|
|
46
|
+
if self._file_handle:
|
|
47
|
+
self._file_handle.close()
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import mosamatic2.constants as constants
|
|
3
|
+
from PySide6.QtWidgets import (
|
|
4
|
+
QMainWindow,
|
|
5
|
+
)
|
|
6
|
+
from PySide6.QtGui import (
|
|
7
|
+
QGuiApplication,
|
|
8
|
+
QAction,
|
|
9
|
+
QIcon,
|
|
10
|
+
)
|
|
11
|
+
from PySide6.QtCore import Qt, QByteArray
|
|
12
|
+
from mosamatic2.ui.utils import version, resource_path, is_macos
|
|
13
|
+
from mosamatic2.core.managers.logmanager import LogManager
|
|
14
|
+
from mosamatic2.ui.settings import Settings
|
|
15
|
+
|
|
16
|
+
LOG = LogManager()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class MainWindow(QMainWindow):
|
|
20
|
+
def __init__(self):
|
|
21
|
+
super(MainWindow, self).__init__()
|
|
22
|
+
self._settings = None
|
|
23
|
+
self.init_window()
|
|
24
|
+
|
|
25
|
+
def init_window(self):
|
|
26
|
+
self.setWindowTitle(f'{constants.MOSAMATIC2_WINDOW_TITLE} {version()}')
|
|
27
|
+
icon_file_name = constants.MOSAMATIC2_APP_ICON_FILE_NAME_MAC if is_macos() else constants.MOSAMATIC2_APP_ICON_FILE_NAME_WIN
|
|
28
|
+
self.setWindowIcon(QIcon(resource_path(os.path.join(constants.MOSAMATIC2_ICONS_DIR_PATH, icon_file_name))))
|
|
29
|
+
if not self.load_geometry_and_state():
|
|
30
|
+
self.set_default_size_and_position()
|
|
31
|
+
|
|
32
|
+
# GET
|
|
33
|
+
|
|
34
|
+
def settings(self):
|
|
35
|
+
if not self._settings:
|
|
36
|
+
self._settings = Settings()
|
|
37
|
+
return self._settings
|
|
38
|
+
|
|
39
|
+
# MISCELLANEOUS
|
|
40
|
+
|
|
41
|
+
def load_geometry_and_state(self):
|
|
42
|
+
geometry = self.settings().get(constants.MOSAMATIC2_WINDOW_GEOMETRY_KEY)
|
|
43
|
+
state = self.settings().get(constants.MOSAMATIC2_WINDOW_STATE_KEY)
|
|
44
|
+
if isinstance(geometry, QByteArray) and self.restoreGeometry(geometry):
|
|
45
|
+
if isinstance(state, QByteArray):
|
|
46
|
+
self.restoreState(state)
|
|
47
|
+
return True
|
|
48
|
+
return False
|
|
49
|
+
|
|
50
|
+
def save_geometry_and_state(self):
|
|
51
|
+
self.settings().set(constants.MOSAMATIC2_WINDOW_GEOMETRY_KEY, self.saveGeometry())
|
|
52
|
+
self.settings().set(constants.MOSAMATIC2_WINDOW_STATE_KEY, self.saveState())
|
|
53
|
+
|
|
54
|
+
def set_default_size_and_position(self):
|
|
55
|
+
self.resize(constants.MOSAMATIC2_WINDOW_W, constants.MOSAMATIC2_WINDOW_H)
|
|
56
|
+
self.center_window()
|
|
57
|
+
|
|
58
|
+
def center_window(self):
|
|
59
|
+
screen = QGuiApplication.primaryScreen().geometry()
|
|
60
|
+
x = (screen.width() - self.geometry().width()) / 2
|
|
61
|
+
y = (screen.height() - self.geometry().height()) / 2
|
|
62
|
+
self.move(int(x), int(y))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.0.2
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import mosamatic2.constants as constants
|
|
2
|
+
from PySide6.QtCore import QSettings
|
|
3
|
+
from mosamatic2.core.managers.logmanager import LogManager
|
|
4
|
+
|
|
5
|
+
LOG = LogManager()
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Settings(QSettings):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super(Settings, self).__init__(
|
|
11
|
+
QSettings.IniFormat,
|
|
12
|
+
QSettings.UserScope,
|
|
13
|
+
constants.MOSAMATIC2_BUNDLE_IDENTIFIER,
|
|
14
|
+
constants.MOSAMATIC2_APP_NAME,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
def prepend_bundle_identifier_and_name(self, name):
|
|
18
|
+
return '{}.{}.{}'.format(constants.MOSAMATIC2_BUNDLE_IDENTIFIER, constants.MOSAMATIC2_APP_NAME, name)
|
|
19
|
+
|
|
20
|
+
def get(self, name, default=None):
|
|
21
|
+
if not name.startswith(constants.MOSAMATIC2_BUNDLE_IDENTIFIER):
|
|
22
|
+
name = self.prepend_bundle_identifier_and_name(name)
|
|
23
|
+
value = self.value(name)
|
|
24
|
+
if value is None or value == '':
|
|
25
|
+
return default
|
|
26
|
+
return value
|
|
27
|
+
|
|
28
|
+
def get_int(self, name, default=None):
|
|
29
|
+
try:
|
|
30
|
+
return int(self.get(name, default))
|
|
31
|
+
except ValueError as e:
|
|
32
|
+
return default
|
|
33
|
+
|
|
34
|
+
def get_float(self, name, default=None):
|
|
35
|
+
try:
|
|
36
|
+
return float(self.get(name, default))
|
|
37
|
+
except ValueError as e:
|
|
38
|
+
return default
|
|
39
|
+
|
|
40
|
+
def get_bool(self, name, default=None):
|
|
41
|
+
try:
|
|
42
|
+
value = self.get(name, default)
|
|
43
|
+
if value and isinstance(value, str):
|
|
44
|
+
if value == '0' or value.lower() == 'false':
|
|
45
|
+
return False
|
|
46
|
+
elif value == '1' or value.lower() == 'true':
|
|
47
|
+
return True
|
|
48
|
+
else:
|
|
49
|
+
return default
|
|
50
|
+
if value and isinstance(value, bool):
|
|
51
|
+
return value
|
|
52
|
+
except ValueError as e:
|
|
53
|
+
return default
|
|
54
|
+
|
|
55
|
+
def set(self, name, value):
|
|
56
|
+
name = self.prepend_bundle_identifier_and_name(name)
|
|
57
|
+
self.setValue(name, value)
|
|
58
|
+
|
|
59
|
+
def print(self):
|
|
60
|
+
LOG.info(f'Settings path: {self.fileName()}')
|
|
61
|
+
for key in self.allKeys():
|
|
62
|
+
LOG.info(f'Settings: {key}')
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import mosamatic2.constants as constants
|
|
4
|
+
from PySide6.QtGui import (
|
|
5
|
+
QPixmap,
|
|
6
|
+
QPainter,
|
|
7
|
+
QColor
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def resource_path(relative_path):
|
|
12
|
+
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
|
13
|
+
return os.path.join(base_path, relative_path)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def version():
|
|
17
|
+
with open(resource_path(constants.MOSAMATIC2_VERSION_FILE), 'r') as f:
|
|
18
|
+
return f.readline().strip()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def is_macos():
|
|
22
|
+
return sys.platform.startswith('darwin')
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def icon(parent, icon_type):
|
|
26
|
+
return parent.style().standardIcon(icon_type)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def set_opacity(pixmap, opacity):
|
|
30
|
+
result = QPixmap(pixmap.size())
|
|
31
|
+
result.fill(QColor(0, 0, 0, 0))
|
|
32
|
+
painter = QPainter(result)
|
|
33
|
+
painter.setOpacity(opacity)
|
|
34
|
+
painter.drawPixmap(0, 0, pixmap)
|
|
35
|
+
painter.end()
|
|
36
|
+
return result
|
|
File without changes
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import mosamatic2.constants as constants
|
|
3
|
+
from PySide6.QtWidgets import (
|
|
4
|
+
QWidget,
|
|
5
|
+
QVBoxLayout,
|
|
6
|
+
QPushButton,
|
|
7
|
+
QLabel,
|
|
8
|
+
)
|
|
9
|
+
from PySide6.QtCore import Qt
|
|
10
|
+
from PySide6.QtGui import QPixmap
|
|
11
|
+
from mosamatic2.ui.mainwindow import MainWindow
|
|
12
|
+
from mosamatic2.ui.utils import resource_path, set_opacity, version
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SplashScreen(QWidget):
|
|
16
|
+
def __init__(self):
|
|
17
|
+
super(SplashScreen, self).__init__()
|
|
18
|
+
self._main = None
|
|
19
|
+
self._background_label = None
|
|
20
|
+
self._background_pixmap = None
|
|
21
|
+
self._title_label = None
|
|
22
|
+
self._sub_text_label = None
|
|
23
|
+
self._start_app_button = None
|
|
24
|
+
self._donate_button = None
|
|
25
|
+
self._close_button = None
|
|
26
|
+
self.init_layout()
|
|
27
|
+
|
|
28
|
+
def main(self):
|
|
29
|
+
if not self._main:
|
|
30
|
+
self._main = MainWindow()
|
|
31
|
+
return self._main
|
|
32
|
+
|
|
33
|
+
def background_label(self):
|
|
34
|
+
if not self._background_label:
|
|
35
|
+
self._background_label = QLabel(self)
|
|
36
|
+
self._background_label.setPixmap(self.background_pixmap())
|
|
37
|
+
self._background_label.setGeometry(0, 0, self.width(), self.height())
|
|
38
|
+
self._background_label.lower()
|
|
39
|
+
return self._background_label
|
|
40
|
+
|
|
41
|
+
def background_pixmap(self):
|
|
42
|
+
if not self._background_pixmap:
|
|
43
|
+
self._background_pixmap = QPixmap(resource_path(os.path.join(
|
|
44
|
+
constants.MOSAMATIC2_IMAGES_DIR_PATH, constants.MOSAMATIC2_BACKGROUND_IMAGE_FILE_NAME,
|
|
45
|
+
))).scaled(self.size(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
|
|
46
|
+
self._background_pixmap = set_opacity(self._background_pixmap, constants.MOSAMATIC2_BACKGROUND_IMAGE_OPACITY)
|
|
47
|
+
return self._background_pixmap
|
|
48
|
+
|
|
49
|
+
def title_label(self):
|
|
50
|
+
if not self._title_label:
|
|
51
|
+
self._title_label = QLabel(f'{constants.MOSAMATIC2_SPLASH_SCREEN_TITLE} {version()}')
|
|
52
|
+
self._title_label.setStyleSheet(constants.MOSAMATIC2_SPLASH_SCREEN_TITLE_STYLESHEET)
|
|
53
|
+
self._title_label.setAlignment(Qt.AlignCenter)
|
|
54
|
+
return self._title_label
|
|
55
|
+
|
|
56
|
+
def sub_text_label(self):
|
|
57
|
+
if not self._sub_text_label:
|
|
58
|
+
message = constants.MOSAMATIC2_SPLASH_SCREEN_SUB_TEXT
|
|
59
|
+
self._sub_text_label = QLabel(message)
|
|
60
|
+
self._sub_text_label.setStyleSheet(constants.MOSAMATIC2_SPLASH_SCREEN_SUB_TEXT_STYLE_SHEET)
|
|
61
|
+
self._sub_text_label.setAlignment(Qt.AlignCenter)
|
|
62
|
+
return self._sub_text_label
|
|
63
|
+
|
|
64
|
+
def start_app_button(self):
|
|
65
|
+
if not self._start_app_button:
|
|
66
|
+
self._start_app_button = QPushButton(constants.MOSAMATIC2_SPLASH_SCREEN_START_BUTTON_TEXT)
|
|
67
|
+
self._start_app_button.clicked.connect(self.handle_start_app_button)
|
|
68
|
+
return self._start_app_button
|
|
69
|
+
|
|
70
|
+
def close_button(self):
|
|
71
|
+
if not self._close_button:
|
|
72
|
+
self._close_button = QPushButton(constants.MOSAMATIC2_SPLASH_SCREEN_QUIT_BUTTON_TEXT)
|
|
73
|
+
self._close_button.clicked.connect(self.handle_close_button)
|
|
74
|
+
return self._close_button
|
|
75
|
+
|
|
76
|
+
# LAYOUT
|
|
77
|
+
|
|
78
|
+
def init_layout(self):
|
|
79
|
+
layout = QVBoxLayout()
|
|
80
|
+
layout.addWidget(self.title_label())
|
|
81
|
+
layout.addWidget(self.sub_text_label())
|
|
82
|
+
layout.addWidget(self.start_app_button())
|
|
83
|
+
layout.addWidget(self.close_button())
|
|
84
|
+
self.setLayout(layout)
|
|
85
|
+
self.setFixedSize(constants.MOSAMATIC2_SPLASH_SCREEN_W, constants.MOSAMATIC2_SPLASH_SCREEN_H)
|
|
86
|
+
self.setWindowFlags(Qt.FramelessWindowHint)
|
|
87
|
+
|
|
88
|
+
# EVENT HANDLERS
|
|
89
|
+
|
|
90
|
+
def handle_start_app_button(self):
|
|
91
|
+
self.close()
|
|
92
|
+
self.main().show()
|
|
93
|
+
|
|
94
|
+
def handle_close_button(self):
|
|
95
|
+
self.close()
|
|
96
|
+
|
|
97
|
+
def resizeEvent(self, event):
|
|
98
|
+
super().resizeEvent(event)
|
|
99
|
+
scaled = self.background_pixmap().scaled(self.size(), Qt.KeepAspectRatioByExpanding, Qt.SmoothTransformation)
|
|
100
|
+
self.background_label().setPixmap(scaled)
|
|
101
|
+
self.background_label().setGeometry(0, 0, self.width(), self.height())
|
mosamatic2-2.0.1/PKG-INFO
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: mosamatic2
|
|
3
|
-
Version: 2.0.1
|
|
4
|
-
Summary:
|
|
5
|
-
Author: Ralph Brecheisen
|
|
6
|
-
Author-email: r.brecheisen@maastrichtuniversity.nl
|
|
7
|
-
Requires-Python: >=3.11,<3.12
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
|
|
12
|
-
|
mosamatic2-2.0.1/pyproject.toml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "mosamatic2"
|
|
3
|
-
version = "2.0.1"
|
|
4
|
-
description = ""
|
|
5
|
-
authors = [
|
|
6
|
-
{name = "Ralph Brecheisen", email = "r.brecheisen@maastrichtuniversity.nl"}
|
|
7
|
-
]
|
|
8
|
-
readme = "README.md"
|
|
9
|
-
requires-python = ">=3.11,<3.12"
|
|
10
|
-
dependencies = [
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
[tool.poetry]
|
|
14
|
-
packages = [
|
|
15
|
-
{include = "mosamatic2", from = "src"},
|
|
16
|
-
{include = "models.py", from = "src" },
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
[tool.poetry.scripts]
|
|
20
|
-
mosamatic2 = "mosamatic2.app:main"
|
|
21
|
-
mosamatic2-api = "mosamatic2.api:main"
|
|
22
|
-
|
|
23
|
-
[tool.poetry.group.dev.dependencies]
|
|
24
|
-
pytest = "^8.4.1"
|
|
25
|
-
|
|
26
|
-
[build-system]
|
|
27
|
-
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
28
|
-
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|