qss
This commit is contained in:
		@@ -6,13 +6,14 @@ import json
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
from PySide6.QtWidgets import QApplication, QWidget, QHBoxLayout, QMessageBox, QMainWindow, QStatusBar
 | 
			
		||||
from PySide6.QtGui import QFont, QIcon, QResizeEvent, QShortcut, QKeySequence, QAction
 | 
			
		||||
from PySide6.QtCore import Qt
 | 
			
		||||
from PySide6.QtGui import QIcon, QResizeEvent, QShortcut, QKeySequence, QAction
 | 
			
		||||
from PySide6.QtCore import Qt, QFileSystemWatcher
 | 
			
		||||
 | 
			
		||||
from codes.common import clibs, db_operation
 | 
			
		||||
from codes.ui.components.toolbar_ui import SToolBar
 | 
			
		||||
from codes.ui.components.list_widget_ui import SListWidget
 | 
			
		||||
from codes.ui.components.stacked_widget_ui import SStackedWidget
 | 
			
		||||
from codes.ui.components.statusbar_ui import SStatusBar
 | 
			
		||||
from codes.common.signal_bus import signal_bus
 | 
			
		||||
from codes.common.worker import Worker
 | 
			
		||||
from codes.common.exception_handler import handle_exception
 | 
			
		||||
@@ -22,38 +23,29 @@ from codes.ui.overlay_page.overlay_ui import WidgetWithBg
 | 
			
		||||
class MainWindow(QMainWindow):
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        super().__init__()
 | 
			
		||||
        self.predos()
 | 
			
		||||
        self.pre_do()
 | 
			
		||||
        self.init_ui()
 | 
			
		||||
        self.setup_slot()
 | 
			
		||||
        self.setup_sc()
 | 
			
		||||
        self.post_do()
 | 
			
		||||
 | 
			
		||||
    def predos(self):
 | 
			
		||||
    def pre_do(self):
 | 
			
		||||
        self.m = Path(__file__).stem
 | 
			
		||||
        self.home_overlay = None
 | 
			
		||||
        db_operation.db_backup()
 | 
			
		||||
        db_operation.db_conn()
 | 
			
		||||
 | 
			
		||||
    def init_ui(self):
 | 
			
		||||
        self.setObjectName("MainWindow")
 | 
			
		||||
        self.setMinimumSize(clibs.win_width, clibs.win_height)
 | 
			
		||||
        self.resize(clibs.win_width, clibs.win_height)
 | 
			
		||||
        self.setWindowTitle("Toolbox")
 | 
			
		||||
        self.setWindowIcon(QIcon(f"{clibs.base_path}/assets/media/icon.ico"))
 | 
			
		||||
        self.setFont(QFont("Consolas", 14))
 | 
			
		||||
        # 任务栏/主窗口/状态栏
 | 
			
		||||
        self.toolBar = SToolBar()
 | 
			
		||||
        self.addToolBar(self.toolBar)
 | 
			
		||||
        self.toolBar.setMovable(False)
 | 
			
		||||
        self.centralW = QWidget()
 | 
			
		||||
        self.setCentralWidget(self.centralW)
 | 
			
		||||
        self.statusBar = QStatusBar()
 | 
			
		||||
        self.statusBar.setStyleSheet("""
 | 
			
		||||
            QStatusBar {
 | 
			
		||||
                background: #8B8989;   /* 背景色 */
 | 
			
		||||
                color: #000000;        /* 文字色 */
 | 
			
		||||
                border: none;
 | 
			
		||||
                font: 14px "Consolas";
 | 
			
		||||
            }
 | 
			
		||||
        """)
 | 
			
		||||
        self.statusBar = SStatusBar()
 | 
			
		||||
        self.setStatusBar(self.statusBar)
 | 
			
		||||
 | 
			
		||||
        layout_h = QHBoxLayout()
 | 
			
		||||
@@ -69,6 +61,10 @@ class MainWindow(QMainWindow):
 | 
			
		||||
        signal_bus.home_overlay_close.connect(self.exit_overlay)
 | 
			
		||||
        self.install_sc()
 | 
			
		||||
 | 
			
		||||
    def post_do(self):
 | 
			
		||||
        self.setup_slot()
 | 
			
		||||
        self.setup_sc()
 | 
			
		||||
 | 
			
		||||
    def setup_sc(self, enable: bool = True):
 | 
			
		||||
        for sc_id, obj in self.sc_pool.items():
 | 
			
		||||
            if isinstance(obj, QAction):
 | 
			
		||||
@@ -134,7 +130,7 @@ class MainWindow(QMainWindow):
 | 
			
		||||
            for file in files:
 | 
			
		||||
                image_names.append(file.name.removesuffix(".jpg"))
 | 
			
		||||
            for image in res["images"]:
 | 
			
		||||
                image_name = "-".join([image["startdate"], image["title"]])
 | 
			
		||||
                image_name = "-".join([image["startdate"], image["hsh"]])
 | 
			
		||||
                if image_name in image_names:
 | 
			
		||||
                    continue
 | 
			
		||||
                else:
 | 
			
		||||
@@ -149,7 +145,6 @@ class MainWindow(QMainWindow):
 | 
			
		||||
            proverbs = []
 | 
			
		||||
            proverb_file = Path(f"{clibs.base_path}/assets/media/hitokoto.json")
 | 
			
		||||
            req = requests.get(hitokoto)
 | 
			
		||||
            print(f"req.text = {req.text}")
 | 
			
		||||
            if not proverb_file.exists():
 | 
			
		||||
                proverb_file.touch()
 | 
			
		||||
                proverb_file.write_text("[]")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user