From af8958feadc84020f04694f81f5cfb31ced8d1a5 Mon Sep 17 00:00:00 2001 From: JoachimCoenen Date: Sun, 12 Dec 2021 16:12:53 +0100 Subject: [PATCH] added ApplicationVersion --- main.py | 3 ++ settings/_applicationSettings.py | 54 ++++++++++++-------------------- 2 files changed, 23 insertions(+), 34 deletions(-) diff --git a/main.py b/main.py index ac4f91f..62e8121 100644 --- a/main.py +++ b/main.py @@ -108,8 +108,11 @@ def start(argv): QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseStyleSheetPropagationInWidgetStyles, True) QtWidgets.QApplication.setStyle(applicationSettings.appearance.applicationStyle) app = QtWidgets.QApplication(argv) + app.setApplicationName(applicationSettings.applicationName) app.setApplicationDisplayName(applicationSettings.applicationName) + app.setApplicationVersion(applicationSettings.version) + app.setOrganizationName(applicationSettings.organization) applyStyle(app, Style({'QWidget': getStyles().hostWidgetStyle})) # + styles.layoutingBorder)) palette = app.palette() diff --git a/settings/_applicationSettings.py b/settings/_applicationSettings.py index b56dc36..2b5b4aa 100644 --- a/settings/_applicationSettings.py +++ b/settings/_applicationSettings.py @@ -142,16 +142,15 @@ class MinecraftSettings(SerializableContainer): class DebugSettings(SerializableContainer): __slots__ = () - @pd.Title('Developer Mode') - @pd.ToggleSwitch() - @Serialized() - def isDeveloperMode(self) -> bool : - return False + isDeveloperMode: bool = Serialized( + default=False, + decorators=[ + pd.ToggleSwitch(), + pd.Title('Developer Mode') + ] + ) - @pd.ToggleSwitch() - @Serialized() - def showUndoRedoPane(self) -> bool : - return False + showUndoRedoPane: bool = Serialized(default=False, decorators=[pd.ToggleSwitch()]) test: str = Serialized( default='Test', @@ -165,14 +164,16 @@ class AboutSettings(SerializableContainer): __slots__ = () @pd.ReadOnlyLabel() - @Serialized(shouldSerialize=False, wordWrap=False, label=' ', style=getStyles().title) + @Computed(shouldSerialize=False, wordWrap=False, label=' ', style=getStyles().title) def title(self) -> str: return "Datapack Editor" @pd.ReadOnlyLabel() @Serialized(shouldSerialize=False, wordWrap=False, label='Version') def version(self) -> str: - return """0.1.0""" + return """0.1.0-alpha""" + + organization: str = Computed(default="""Joachim Coenen""", decorators=[pd.NoUI()]) @pd.ReadOnlyLabel() @Serialized(shouldSerialize=False, wordWrap=True, label='Copyright') @@ -214,31 +215,16 @@ def __typeCheckerInfo___(self): self.about: AboutSettings = AboutSettings() self.isUserSetupFinished: bool = False - @pd.NoUI() - @Computed() - def applicationName(self) -> str: - return 'Minecraft Datapack Editor' - - @Serialized(label='Appearance') - def appearance(self) -> AppearanceSettings: - return AppearanceSettings() - - @Serialized(label='Minecraft') - def minecraft(self) -> MinecraftSettings: - return MinecraftSettings() + appearance: AppearanceSettings = Serialized(default_factory=AppearanceSettings, label='Appearance') + minecraft: MinecraftSettings = Serialized(default_factory=MinecraftSettings, label='Minecraft') + debugging: DebugSettings = Serialized(default_factory=DebugSettings, label='Debugging') + about: AboutSettings = Serialized(default_factory=AboutSettings, label='About') - @Serialized(label='Debugging') - def debugging(self) -> DebugSettings: - return DebugSettings() + applicationName: str = Computed(default='Minecraft Datapack Editor', decorators=[pd.NoUI()]) + version: str = about.version + organization: str = about.organization - @Serialized(label='About') - def about(self) -> AboutSettings: - return AboutSettings() - - @pd.NoUI() - @Serialized() - def isUserSetupFinished(self) -> bool: - return False + isUserSetupFinished: bool = Serialized(default=False, decorators=[pd.NoUI()]) applicationSettings = ApplicationSettings()