代码拉取完成,页面将自动刷新
# -*- coding: utf-8 -*-
import sys
from PySide6.QtWidgets import QApplication, QHBoxLayout, QLabel
from PySide6.QtCore import QTranslator
from icon import LogoIcon
from main_window import MainWindow
from setting import Setting
from theme import Theme
from base_window import BaseWindow
class MyWindow(BaseWindow):
def __init__(self, parent=None, theme=None):
super().__init__(parent, theme)
# main entry point
if __name__ == "__main__":
# load language and theme from settings
setting = Setting()
setting.load()
locale = setting.get_locale()
theme = setting.get_theme()
print("main:", locale, theme)
# set default language
translator = QTranslator()
translator.load(locale)
app = QApplication(sys.argv)
app.installTranslator(translator)
# body
layout_body = QHBoxLayout()
label = QLabel("Hello")
label.setStyleSheet("background-color:red")
layout_body.addWidget(label)
label = QLabel("World")
label.setStyleSheet("background-color:blue")
layout_body.addWidget(label)
# tail
layout_tail = QHBoxLayout()
label2 = QLabel("tail")
label2.setStyleSheet("background-color:yellow")
layout_tail.addWidget(label2)
theme = Theme(app, theme)
window = MyWindow()
window.setWindowIcon(LogoIcon.get_icon())
window.set_body_layout(layout_body)
window.set_tail_layout(layout_tail)
window.show()
sys.exit(app.exec())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。