Download src/fiberpose/gui/__init__.py from vikba/fp2: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/spaces/vikba/fp2/resolve/main/src/fiberpose/gui/__init__.py
- Command line
-
hf download hf://spaces/vikba/fp2/src/fiberpose/gui/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/vikba/fp2/resolve/main/src/fiberpose/gui/__init__.py
1.36 kB
| """PyQt desktop interface: ``fiberpose --gui``. | |
| Importing this package needs the ``gui`` extra (PyQt6, pyqtgraph). | |
| """ | |
| from __future__ import annotations | |
| import sys | |
| from PyQt6.QtGui import QColor, QIcon, QPalette | |
| from PyQt6.QtWidgets import QApplication | |
| from ..paths import APP_ICON_PATH | |
| __all__ = ["launch"] | |
| def launch(config_path: str) -> int: | |
| """Open the main window and run the Qt event loop; returns its exit code.""" | |
| from .main_window import MainWindow | |
| app = QApplication(sys.argv) | |
| app.setWindowIcon(QIcon(str(APP_ICON_PATH))) | |
| app.setStyle("Fusion") | |
| dark, text, white = QColor(45, 45, 45), QColor(220, 220, 220), QColor(255, 255, 255) | |
| palette = QPalette() | |
| for role, color in { | |
| "Window": dark, | |
| "WindowText": text, | |
| "Base": QColor(30, 30, 30), | |
| "AlternateBase": dark.darker(), | |
| "ToolTipBase": white, | |
| "ToolTipText": text, | |
| "Text": text, | |
| "Button": dark, | |
| "ButtonText": text, | |
| "BrightText": QColor(255, 0, 0), | |
| "Highlight": QColor(42, 130, 218), | |
| "HighlightedText": white, | |
| }.items(): | |
| palette.setColor(QPalette.ColorRole[role], color) | |
| app.setPalette(palette) | |
| font = app.font() | |
| font.setPointSize(12) | |
| app.setFont(font) | |
| win = MainWindow(config_path=config_path) | |
| win.show() | |
| return int(app.exec()) | |