refactor(icons): icons moved to the assets directory
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
3
bec_widgets/assets/toolbar_icons/add.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 -960 960 960" width="48px" fill="#FFFFFF">
|
||||
<path d="M440.39-440.39H185.87v-79.22h254.52V-774.7h79.22v255.09H774.7v79.22H519.61v254.52h-79.22v-254.52Z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
3
bec_widgets/assets/toolbar_icons/line_axis.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 -960 960 960" width="48px" fill="#FFFFFF">
|
||||
<path d="M110.39-110.39v-89.57l77.52-77.52v167.09h-77.52Zm165.57 0v-250.13l77.52-77.52v327.65h-77.52Zm165.56 0v-327.65l77.52 77.95v249.7h-77.52Zm165.57 0v-250.83l77.52-76.96v327.79h-77.52Zm165.56 0v-411.83l76.96-76.96v488.79h-76.96ZM110.39-335.65v-112.7L400-735.96l160 160 289.61-290.61v112.14L560-463.26l-160-160-289.61 287.61Z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
3
bec_widgets/assets/toolbar_icons/save.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 -960 960 960" width="48px" fill="#FFFFFF">
|
||||
<path d="M854.7-689.22v504.13q0 32.51-23.53 55.87-23.52 23.35-56.26 23.35H185.09q-32.51 0-55.87-23.35-23.35-23.36-23.35-55.87v-589.82q0-32.74 23.35-56.26 23.36-23.53 55.87-23.53h504.13L854.7-689.22Zm-79.79 35.48L653.74-774.91H185.09v589.82h589.82v-468.65ZM479.76-250.09q43.24 0 73.74-30.26 30.5-30.27 30.5-73.5 0-43.24-30.26-73.74-30.27-30.5-73.5-30.5-43.24 0-73.74 30.27-30.5 30.26-30.5 73.5 0 43.23 30.26 73.73 30.27 30.5 73.5 30.5ZM238.09-578.91h358v-143h-358v143Zm-53-74.83v468.65-589.82 121.17Z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 621 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@ -202,7 +202,8 @@ def main():
|
||||
module_path = os.path.dirname(bec_widgets.__file__)
|
||||
icon = QIcon()
|
||||
icon.addFile(
|
||||
os.path.join(module_path, "assets", "bec_widgets_icon.png"), size=QSize(48, 48)
|
||||
os.path.join(module_path, "assets", "app_icons", "bec_widgets_icon.png"),
|
||||
size=QSize(48, 48),
|
||||
)
|
||||
app.setWindowIcon(icon)
|
||||
|
||||
|
@ -201,7 +201,9 @@ if __name__ == "__main__": # pragma: no cover
|
||||
app.setApplicationDisplayName("Jupyter Console")
|
||||
apply_theme("dark")
|
||||
icon = QIcon()
|
||||
icon.addFile(os.path.join(module_path, "assets", "terminal_icon.png"), size=QSize(48, 48))
|
||||
icon.addFile(
|
||||
os.path.join(module_path, "assets", "app_icons", "terminal_icon.png"), size=QSize(48, 48)
|
||||
)
|
||||
app.setWindowIcon(icon)
|
||||
|
||||
bec_dispatcher = BECDispatcher()
|
||||
|
@ -1,10 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 20 20" height="48px" viewBox="0 0 20 20" width="48px"
|
||||
fill="#FFFFFF">
|
||||
<g>
|
||||
<rect fill="none" height="20" width="20" x="0"/>
|
||||
</g>
|
||||
<g>
|
||||
<polygon
|
||||
points="14.68,10.61 18,6.88 16.88,5.89 13.62,9.56 8,4 2,10.01 3.06,11.07 8,6.12 12.62,10.68 11.27,12.2 8,8.93 2,14.94 3.06,16 8,11.05 11.33,14.38 13.69,11.73 17,15.01 18.06,13.95"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 454 B |
@ -3,19 +3,20 @@ from __future__ import annotations
|
||||
import os
|
||||
from typing import Literal
|
||||
|
||||
from PySide6.QtCore import QObject
|
||||
from PySide6.QtGui import QIcon
|
||||
from PySide6.QtWidgets import QComboBox, QLineEdit, QPushButton, QSpinBox, QTableWidget
|
||||
from pydantic import BaseModel
|
||||
from qtpy.QtCore import Slot
|
||||
from qtpy.QtWidgets import QVBoxLayout
|
||||
from qtpy.QtCore import QObject, QSize, Slot
|
||||
from qtpy.QtGui import QIcon
|
||||
from qtpy.QtWidgets import QComboBox, QLineEdit, QPushButton, QSpinBox, QTableWidget, QVBoxLayout
|
||||
|
||||
import bec_widgets
|
||||
from bec_widgets.qt_utils.error_popups import WarningPopupUtility
|
||||
from bec_widgets.qt_utils.settings_dialog import SettingWidget
|
||||
from bec_widgets.utils import Colors, UILoader
|
||||
from bec_widgets.widgets.color_button.color_button import ColorButton
|
||||
from bec_widgets.widgets.device_line_edit.device_line_edit import DeviceLineEdit
|
||||
|
||||
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
||||
|
||||
|
||||
class CurveSettings(SettingWidget):
|
||||
def __init__(self, parent=None, *args, **kwargs):
|
||||
@ -23,6 +24,7 @@ class CurveSettings(SettingWidget):
|
||||
current_path = os.path.dirname(__file__)
|
||||
|
||||
self.ui = UILoader(self).loader(os.path.join(current_path, "curve_dialog.ui"))
|
||||
self._setup_icons()
|
||||
|
||||
self.warning_util = WarningPopupUtility(self)
|
||||
|
||||
@ -35,6 +37,16 @@ class CurveSettings(SettingWidget):
|
||||
self.ui.normalize_colors_scan.clicked.connect(lambda: self.change_colormap("scan"))
|
||||
self.ui.normalize_colors_dap.clicked.connect(lambda: self.change_colormap("dap"))
|
||||
|
||||
def _setup_icons(self):
|
||||
add_icon = QIcon()
|
||||
add_icon.addFile(
|
||||
os.path.join(MODULE_PATH, "assets", "toolbar_icons", "add.svg"), size=QSize(20, 20)
|
||||
)
|
||||
self.ui.add_dap.setIcon(add_icon)
|
||||
self.ui.add_dap.setToolTip("Add DAP Curve")
|
||||
self.ui.add_curve.setIcon(add_icon)
|
||||
self.ui.add_curve.setToolTip("Add Scan Curve")
|
||||
|
||||
@Slot(dict)
|
||||
def display_current_settings(self, config: dict | BaseModel):
|
||||
|
||||
@ -323,6 +335,5 @@ class StyleComboBox(QComboBox):
|
||||
class RemoveButton(QPushButton):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
current_path = os.path.dirname(__file__)
|
||||
icon_path = os.path.join(current_path, "remove.svg")
|
||||
icon_path = os.path.join(MODULE_PATH, "assets", "toolbar_icons", "remove.svg")
|
||||
self.setIcon(QIcon(icon_path))
|
||||
|
@ -171,8 +171,11 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="add_curve">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Curve</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -360,7 +363,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="add_dap">
|
||||
<property name="text">
|
||||
<string>Add DAP</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -3,44 +3,48 @@ import os
|
||||
from qtpy.QtCore import QSize
|
||||
from qtpy.QtGui import QAction, QIcon
|
||||
|
||||
import bec_widgets
|
||||
from bec_widgets.qt_utils.toolbar import ToolBarAction
|
||||
|
||||
MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
||||
|
||||
|
||||
class CurveAction(ToolBarAction):
|
||||
def add_to_toolbar(self, toolbar, target):
|
||||
current_path = os.path.dirname(__file__)
|
||||
parent_path = os.path.dirname(current_path)
|
||||
icon = QIcon()
|
||||
icon.addFile(os.path.join(parent_path, "assets", "line_axis.svg"), size=QSize(20, 20))
|
||||
icon.addFile(
|
||||
os.path.join(MODULE_PATH, "assets", "toolbar_icons", "line_axis.svg"),
|
||||
size=QSize(20, 20),
|
||||
)
|
||||
self.action = QAction(icon, "Open Curves Configuration", target)
|
||||
toolbar.addAction(self.action)
|
||||
|
||||
|
||||
class SettingsAction(ToolBarAction):
|
||||
def add_to_toolbar(self, toolbar, target):
|
||||
current_path = os.path.dirname(__file__)
|
||||
parent_path = os.path.dirname(current_path)
|
||||
icon = QIcon()
|
||||
icon.addFile(os.path.join(parent_path, "assets", "settings.svg"), size=QSize(20, 20))
|
||||
icon.addFile(
|
||||
os.path.join(MODULE_PATH, "assets", "toolbar_icons", "settings.svg"), size=QSize(20, 20)
|
||||
)
|
||||
self.action = QAction(icon, "Open Configuration Dialog", target)
|
||||
toolbar.addAction(self.action)
|
||||
|
||||
|
||||
class ImportAction(ToolBarAction):
|
||||
def add_to_toolbar(self, toolbar, target):
|
||||
current_path = os.path.dirname(__file__)
|
||||
parent_path = os.path.dirname(current_path)
|
||||
icon = QIcon()
|
||||
icon.addFile(os.path.join(parent_path, "assets", "import.svg"), size=QSize(20, 20))
|
||||
icon.addFile(
|
||||
os.path.join(MODULE_PATH, "assets", "toolbar_icons", "import.svg"), size=QSize(20, 20)
|
||||
)
|
||||
self.action = QAction(icon, "Import Configuration from YAML", target)
|
||||
toolbar.addAction(self.action)
|
||||
|
||||
|
||||
class ExportAction(ToolBarAction):
|
||||
def add_to_toolbar(self, toolbar, target):
|
||||
current_path = os.path.dirname(__file__)
|
||||
parent_path = os.path.dirname(current_path)
|
||||
icon = QIcon()
|
||||
icon.addFile(os.path.join(parent_path, "assets", "export.svg"), size=QSize(20, 20))
|
||||
icon.addFile(
|
||||
os.path.join(MODULE_PATH, "assets", "toolbar_icons", "export.svg"), size=QSize(20, 20)
|
||||
)
|
||||
self.action = QAction(icon, "Export Current Configuration to YAML", target)
|
||||
toolbar.addAction(self.action)
|
||||
|
@ -8,7 +8,7 @@ from qtpy.QtWidgets import QVBoxLayout, QWidget
|
||||
|
||||
from bec_widgets.qt_utils.error_popups import error_managed
|
||||
from bec_widgets.qt_utils.settings_dialog import SettingsDialog
|
||||
from bec_widgets.qt_utils.toolbar import ModularToolBar
|
||||
from bec_widgets.qt_utils.toolbar import ModularToolBar, SeparatorAction
|
||||
from bec_widgets.utils import BECConnector
|
||||
from bec_widgets.widgets.figure import BECFigure
|
||||
from bec_widgets.widgets.figure.plots.axis_settings import AxisSettings
|
||||
@ -67,9 +67,10 @@ class BECWaveformWidget(BECConnector, QWidget):
|
||||
self.fig = BECFigure()
|
||||
self.toolbar = ModularToolBar(
|
||||
actions={
|
||||
# "connect": ConnectAction(),
|
||||
"separator_1": SeparatorAction(),
|
||||
"curves": CurveAction(),
|
||||
"axis_settings": SettingsAction(),
|
||||
"separator_2": SeparatorAction(),
|
||||
"import": ImportAction(),
|
||||
"export": ExportAction(),
|
||||
},
|
||||
|