LiquidGUI [1.3.0.0]
- Unified Labels class to handle Linux and Windows.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
from PySide6.QtWidgets import QLabel
|
||||
from PySide6.QtGui import QFont
|
||||
from PySide6.QtCore import Qt
|
||||
import globals
|
||||
|
||||
def _set_os_family_font(ClassName: str):
|
||||
_font = None
|
||||
|
||||
if globals.os == "Linux":
|
||||
if ClassName == MainLabel.__name__ or SubLabel.__name__:
|
||||
_font = "Noto Sans"
|
||||
elif ClassName == SubLabelValue.__name__:
|
||||
_font = "Noto Sans Mono"
|
||||
elif globals.os == "Windows":
|
||||
if ClassName == MainLabel.__name__ or SubLabel.__name__:
|
||||
_font = "Calibri"
|
||||
elif ClassName == SubLabelValue.__name__:
|
||||
_font = "Cascadia Code"
|
||||
|
||||
return _font
|
||||
|
||||
|
||||
class MainLabel(QLabel):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
self.setFont(QFont(_set_os_family_font(__class__.__name__),
|
||||
16,
|
||||
weight=QFont.Weight.ExtraBold))
|
||||
|
||||
class SubLabel(QLabel):
|
||||
""" Formatting for sub-labels. """
|
||||
|
||||
def __init__(self, value):
|
||||
super().__init__()
|
||||
self.setFont(QFont(_set_os_family_font(__class__.__name__),
|
||||
12,
|
||||
weight=QFont.Weight.Thin))
|
||||
self.setText(value)
|
||||
|
||||
class SubLabelValue(QLabel):
|
||||
""" Formatting for values. """
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setAlignment(Qt.AlignmentFlag.AlignRight)
|
||||
self.setFont(QFont(_set_os_family_font(__class__.__name__), 8))
|
||||
@@ -1,27 +0,0 @@
|
||||
from PySide6.QtWidgets import QLabel
|
||||
from PySide6.QtGui import QFont
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
class MainLabel(QLabel):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
self.setFont(QFont("Noto Sans",
|
||||
16,
|
||||
weight=QFont.Weight.ExtraBold))
|
||||
class SubLabel(QLabel):
|
||||
""" Formatting for sub-labels. """
|
||||
|
||||
def __init__(self, value):
|
||||
super().__init__()
|
||||
self.setFont(QFont("Noto Sans", 12, weight=QFont.Weight.Thin))
|
||||
self.setText(value)
|
||||
class SubLabelValue(QLabel):
|
||||
""" Formatting for values. """
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setAlignment(Qt.AlignmentFlag.AlignRight)
|
||||
self.setFont(QFont("Noto Sans Mono", 8))
|
||||
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
from PySide6.QtWidgets import QLabel
|
||||
from PySide6.QtGui import QFont
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
class MainLabel(QLabel):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
self.setFont(QFont("Calibri",
|
||||
14.5,
|
||||
weight=QFont.Weight.ExtraBold))
|
||||
class SubLabel(QLabel):
|
||||
""" Formatting for sub-labels. """
|
||||
|
||||
def __init__(self, value):
|
||||
super().__init__()
|
||||
self.setFont(QFont("Calibri", 12, weight=QFont.Weight.Thin))
|
||||
self.setText(value)
|
||||
class SubLabelValue(QLabel):
|
||||
""" Formatting for values. """
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setAlignment(Qt.AlignmentFlag.AlignRight)
|
||||
self.setFont(QFont("Cascadia Code", 8))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user