From 6d1754a666c76e643e0e8e3173722d4c748297b8 Mon Sep 17 00:00:00 2001 From: limengxun Date: Tue, 6 Jun 2023 00:49:33 +0800 Subject: [PATCH] style --- resbibman/GUIs/mainWindow.py | 12 ++++++++++-- resbibman/assets/summary.template.html | 2 +- resbibman/stylesheets/Simple-dark.qss | 14 +++++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/resbibman/GUIs/mainWindow.py b/resbibman/GUIs/mainWindow.py index ffbc9e55..1142d64a 100644 --- a/resbibman/GUIs/mainWindow.py +++ b/resbibman/GUIs/mainWindow.py @@ -2,7 +2,7 @@ from typing import Literal, Tuple, List, Callable from PyQt6 import QtGui from PyQt6.QtGui import QIcon, QKeySequence -from PyQt6.QtWidgets import QDialog, QFileDialog, QMainWindow, QMenu, QMenuBar, QSplitter, QWidget, QHBoxLayout, QToolBar, QTabWidget, QTabBar +from PyQt6.QtWidgets import QDialog, QFileDialog, QMainWindow, QMenu, QMenuBar, QSplitter, QWidget, QHBoxLayout, QToolBar, QTabWidget, QTabBar, QApplication from PyQt6.QtGui import QAction from PyQt6.QtCore import Qt, QThreadPool @@ -26,7 +26,7 @@ from ..core.serverConn import ServerConn from ..core.dataClass import DataTags, DataBase, DataPoint from ..confReader import getConf, ICON_PATH, getConfV, getDatabase, saveToConf, saveToConf_guiStatus -from ..confReader import TMP_DB, TMP_WEB, TMP_COVER +from ..confReader import TMP_DB, TMP_WEB, TMP_COVER, getStyleSheets from ..version import VERSION from ..perf.qtThreading import SyncWorker, InitDBWorker import os, typing, requests, functools, time, shutil, traceback, webbrowser @@ -717,6 +717,7 @@ def reloadData(self): """ Reload database, Will synchronize add data if in online mode + by the way... realod stylesheet """ if getConf()["host"]: try: @@ -733,6 +734,13 @@ def reloadData(self): # local dir self.loadData_async(getConf()["database"], sync_after=False) # self._loadData(getConf()["database"]) + # reload stylesheet + # get application style, for development purpose + app: QApplication = QApplication.instance() # type: ignore + ss = getStyleSheets()[getConf()["stylesheet"]] + if ss != "": + with open(ss, "r", encoding="utf-8") as f: + app.setStyleSheet(f.read()) def statusBarMsg(self, msg: str, bg_color = "none"): if self.db.offline: diff --git a/resbibman/assets/summary.template.html b/resbibman/assets/summary.template.html index d690ef66..ead28ee2 100644 --- a/resbibman/assets/summary.template.html +++ b/resbibman/assets/summary.template.html @@ -8,7 +8,7 @@ html, body { height: 100%; margin: 0; - padding: 0; + padding: 10px; font-family: "Times New Roman", Times, serif; font-size: 1.2em; margin-left: auto; diff --git a/resbibman/stylesheets/Simple-dark.qss b/resbibman/stylesheets/Simple-dark.qss index a1c4f4a8..b02d047b 100644 --- a/resbibman/stylesheets/Simple-dark.qss +++ b/resbibman/stylesheets/Simple-dark.qss @@ -9,5 +9,17 @@ QTableView::item:hover:!selected { background-color: #2f3a5b; color: #cccccc; border-style: solid; - border: 1px solid #D3F1FC; } + +QLineEdit, QTextEdit, QPlainTextEdit, QSpinBox, QDoubleSpinBox, QDateEdit, QTimeEdit, QDateTimeEdit { + background-color: #2e2e2e; + color: #f0f0f0; + border: 1px solid #4f4f4f; + border-radius: 5px; + padding: 2px; +} + +QLineEdit:focus, QTextEdit:focus, QPlainTextEdit:focus, QSpinBox:focus, QDoubleSpinBox:focus, QComboBox:focus, QDateEdit:focus, QTimeEdit:focus, QDateTimeEdit:focus { + border: 1px solid #7da0ff; + box-shadow: #222222 0px 0px 2px; +} \ No newline at end of file