New UI Redesign in pyqt6 (#56)

* Initial commit for new UI

* Initial commit for new UI

* WIP

* Status bar updates and has an icon for online / offline

* Add log_viewer.py

* Use JSON for delete_engine_download API

* Fix class issue with Downloaders

* Move Config class to new ui

* Add engine_browser.py

* Add a close event handler to the main window

* Fix issue with engine manager not deleting engines properly

* Rearrange all the files

* Add icons and resources

* Cache system info in RenderServerProxy

* Toolbar polish

* Fix resource path in status bar

* Add config_dir to misc_helper.py

* Add try block to zeroconf setup

* Add add_job.py

* Add raw args to add_job.py
This commit is contained in:
2023-11-04 09:52:15 -05:00
committed by GitHub
parent bc8e88ea59
commit 65c256b641
45 changed files with 1491 additions and 53 deletions

49
src/ui/widgets/toolbar.py Normal file
View File

@@ -0,0 +1,49 @@
''' app/ui/widgets/toolbar.py '''
from PyQt6.QtCore import Qt, QSize
from PyQt6.QtGui import QAction, QIcon
from PyQt6.QtWidgets import QToolBar, QWidget, QSizePolicy
class ToolBar(QToolBar):
"""
Initialize the toolbar.
Args:
parent: The parent widget.
orientation: The toolbar's orientation.
style: The toolbar's tool button style.
icon_size: The toolbar's icon size.
"""
def __init__(self, parent,
orientation: Qt.Orientation = Qt.Orientation.Horizontal,
style: Qt.ToolButtonStyle = Qt.ToolButtonStyle.ToolButtonTextUnderIcon,
icon_size: tuple[int, int] = (32, 32)) -> None:
super().__init__(parent)
self.actions_call = {}
self.setOrientation(orientation)
self.setToolButtonStyle(style)
self.setIconSize(QSize(icon_size[0], icon_size[1]))
def add_button(self, text: str, icon: str, trigger_action) -> None:
"""
Add a button to the toolbar.
Args:
text: The button's text.
icon: The button's icon.
trigger_action: The action to be executed when the button is clicked.
"""
self.actions_call[text] = QAction(QIcon(icon), text, self)
self.actions_call[text].triggered.connect(trigger_action)
self.addAction(self.actions_call[text])
def add_separator(self) -> None:
"""
Add a separator to the toolbar.
"""
separator = QWidget(self)
separator.setSizePolicy(
QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
self.addWidget(separator)