Add page switch feature to main window and now all qt stylesheet are loaded from an external file.

Rename test dialog window to test page.
This commit is contained in:
wei
2026-07-14 16:41:14 +08:00
parent 1c6438040c
commit e15bd758f3
10 changed files with 322 additions and 55 deletions
+1 -1
View File
@@ -459,7 +459,7 @@ def fetch_and_save_version_manifest(dest: Path, target_version: str=None, root_m
)
def download_core_file(manifest: dict, destination: Path, is_server=False, raise_for_null_hash=False,
progress_callback: Callable[str]=None) -> FileObject:
progress_callback: Callable[[str, float], None]=None) -> FileObject:
"""
Download core file from version manifest.
:param manifest:
+23 -3
View File
@@ -1,5 +1,5 @@
from PySide6.QtCore import QCoreApplication, QThread
from PySide6.QtGui import QScreen
from PySide6.QtCore import QCoreApplication, QThread, QSize, Qt
from PySide6.QtGui import QScreen, QPixmap, QPainter, QPalette, QIcon
from PySide6.QtWidgets import QMainWindow, QApplication
@@ -12,4 +12,24 @@ def move_window_to_center(window: QMainWindow):
def is_main_thread() -> bool:
app = QCoreApplication.instance()
return app is not None and QThread.currentThread() == app.thread()
return app is not None and QThread.currentThread() == app.thread()
def recolor_standard_icon(widget, standard_pixmap, size=24):
source_icon = widget.style().standardIcon(standard_pixmap)
source = source_icon.pixmap(QSize(size, size))
result = QPixmap(source.size())
result.fill(Qt.GlobalColor.transparent)
painter = QPainter(result)
painter.drawPixmap(0, 0, source)
painter.setCompositionMode(
QPainter.CompositionMode.CompositionMode_SourceIn
)
painter.fillRect(
result.rect(),
widget.palette().color(QPalette.ColorRole.ButtonText),
)
painter.end()
return QIcon(result)