Skip to content

Commit

Permalink
added ApplicationVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
JoachimCoenen committed Dec 12, 2021
1 parent f7daf2b commit af8958f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
54 changes: 20 additions & 34 deletions settings/_applicationSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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')
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit af8958f

Please sign in to comment.