Skip to content

Commit

Permalink
improved about tab
Browse files Browse the repository at this point in the history
  • Loading branch information
JoachimCoenen committed Dec 12, 2021
1 parent cabea2b commit f7daf2b
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions settings/_applicationSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
from typing import Optional
from zipfile import ZipFile

from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont, QFontDatabase
from PyQt5.QtCore import Qt, QUrl
from PyQt5.QtGui import QFont, QFontDatabase, QDesktopServices

from Cat.CatPythonGUI.AutoGUI import propertyDecorators as pd
from Cat.CatPythonGUI.GUI import getStyles
from Cat.Serializable import Computed, RegisterContainer, SerializableContainer, Serialized
from Cat.Serializable.serializedProperty import ComputedCached
from Cat.utils import getExePath
Expand All @@ -36,6 +37,7 @@ class AppearanceSettings(SerializableContainer):
useCompactLayout: bool = Serialized(
default=False,
label='Compact layout',
tip="Merges title bar & toolbar.",
decorators=[pd.ToggleSwitch()]
)

Expand Down Expand Up @@ -163,18 +165,42 @@ class AboutSettings(SerializableContainer):
__slots__ = ()

@pd.ReadOnlyLabel()
@Serialized(shouldSerialize=False, wordWrap=True, label='Copyright ©')
@Serialized(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"""

@pd.ReadOnlyLabel()
@Serialized(shouldSerialize=False, wordWrap=True, label='Copyright')
def copyright(self) -> str:
return """<font>Copyright © 2021 Joachim Coenen. All Rights Reserved</font>"""
return """<font>© 2021 Joachim Coenen. All Rights Reserved</font>"""

@pd.ReadOnlyLabel()
@Serialized(shouldSerialize=False, wordWrap=True, label=' ', textInteractionFlags=Qt.TextBrowserInteraction, openExternalLinks=True)
def about(self) -> str:
return """<font>Written and maintained by Joachim Coenen.
return """<font>Written and maintained by <a href="https://www.github.com/JoachimCoenen">Joachim Coenen</a>.
<br/>If you have any questions, bugs or improvements, please share them on GitHub.
<br/><a href="https://www.github.com/JoachimCoenen/Datapack-Editor">github.com/JoachimCoenen/Datapack-Editor</a>
</font>"""

@pd.ReadOnlyLabel()
@Serialized(shouldSerialize=False, wordWrap=False, label='Homepage', textInteractionFlags=Qt.TextBrowserInteraction, openExternalLinks=True)
def homepage(self) -> str:
return """<font><a href="https://www.github.com/JoachimCoenen/Datapack-Editor">github.com/JoachimCoenen/Datapack-Editor</a></font>"""

@pd.ReadOnlyLabel()
@Serialized(shouldSerialize=False, wordWrap=False, label='Disclaimer', textInteractionFlags=Qt.TextBrowserInteraction, openExternalLinks=True)
def disclaimer(self) -> str:
return """<font>Some contents are from the Minecraft Wiki (see <a href="https://minecraft.gamepedia.com/Minecraft_Wiki:General_disclaimer">Minecraft Wiki:General disclaimer</a>).</font>"""

@pd.ReadOnlyLabel()
@Serialized(shouldSerialize=False, wordWrap=False, label=' ', textInteractionFlags=Qt.TextBrowserInteraction, openExternalLinks=True)
def affiliation(self) -> str:
return """<font>This program is <em>not</em> affiliated with Mojang Studios.</font>"""


@RegisterContainer
class ApplicationSettings(SerializableContainer):
Expand All @@ -185,7 +211,7 @@ def __typeCheckerInfo___(self):
self.appearance: AppearanceSettings = AppearanceSettings()
self.minecraft: MinecraftSettings = MinecraftSettings()
self.debugging: DebugSettings = DebugSettings()
self.copyright: AboutSettings = AboutSettings()
self.about: AboutSettings = AboutSettings()
self.isUserSetupFinished: bool = False

@pd.NoUI()
Expand All @@ -206,7 +232,7 @@ def debugging(self) -> DebugSettings:
return DebugSettings()

@Serialized(label='About')
def copyright(self) -> AboutSettings:
def about(self) -> AboutSettings:
return AboutSettings()

@pd.NoUI()
Expand Down

0 comments on commit f7daf2b

Please sign in to comment.