mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-13 11:11:49 +02:00
feat(sbb monitor): add sbb monitor widget
This commit is contained in:
@ -49,6 +49,7 @@ _Widgets = {
|
|||||||
"ResetButton": "ResetButton",
|
"ResetButton": "ResetButton",
|
||||||
"ResumeButton": "ResumeButton",
|
"ResumeButton": "ResumeButton",
|
||||||
"RingProgressBar": "RingProgressBar",
|
"RingProgressBar": "RingProgressBar",
|
||||||
|
"SBBMonitor": "SBBMonitor",
|
||||||
"ScanControl": "ScanControl",
|
"ScanControl": "ScanControl",
|
||||||
"ScatterWaveform": "ScatterWaveform",
|
"ScatterWaveform": "ScatterWaveform",
|
||||||
"SignalComboBox": "SignalComboBox",
|
"SignalComboBox": "SignalComboBox",
|
||||||
@ -3249,6 +3250,12 @@ class RingProgressBar(RPCBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class SBBMonitor(RPCBase):
|
||||||
|
"""A widget to display the SBB monitor website."""
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
class ScanControl(RPCBase):
|
class ScanControl(RPCBase):
|
||||||
"""Widget to submit new scans to the queue."""
|
"""Widget to submit new scans to the queue."""
|
||||||
|
|
||||||
|
@ -169,6 +169,9 @@ class BECDockArea(BECWidget, QWidget):
|
|||||||
tooltip="Add LogPanel - Disabled",
|
tooltip="Add LogPanel - Disabled",
|
||||||
filled=True,
|
filled=True,
|
||||||
),
|
),
|
||||||
|
"sbb_monitor": MaterialIconAction(
|
||||||
|
icon_name="train", tooltip="Add SBB Monitor", filled=True
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
"separator_2": SeparatorAction(),
|
"separator_2": SeparatorAction(),
|
||||||
@ -238,6 +241,9 @@ class BECDockArea(BECWidget, QWidget):
|
|||||||
# self.toolbar.widgets["menu_utils"].widgets["log_panel"].triggered.connect(
|
# self.toolbar.widgets["menu_utils"].widgets["log_panel"].triggered.connect(
|
||||||
# lambda: self._create_widget_from_toolbar(widget_name="LogPanel")
|
# lambda: self._create_widget_from_toolbar(widget_name="LogPanel")
|
||||||
# )
|
# )
|
||||||
|
self.toolbar.widgets["menu_utils"].widgets["sbb_monitor"].triggered.connect(
|
||||||
|
lambda: self._create_widget_from_toolbar(widget_name="SBBMonitor")
|
||||||
|
)
|
||||||
|
|
||||||
# Icons
|
# Icons
|
||||||
self.toolbar.widgets["attach_all"].action.triggered.connect(self.attach_all)
|
self.toolbar.widgets["attach_all"].action.triggered.connect(self.attach_all)
|
||||||
|
0
bec_widgets/widgets/editors/sbb_monitor/__init__.py
Normal file
0
bec_widgets/widgets/editors/sbb_monitor/__init__.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
def main(): # pragma: no cover
|
||||||
|
from qtpy import PYSIDE6
|
||||||
|
|
||||||
|
if not PYSIDE6:
|
||||||
|
print("PYSIDE6 is not available in the environment. Cannot patch designer.")
|
||||||
|
return
|
||||||
|
from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
|
||||||
|
|
||||||
|
from bec_widgets.widgets.editors.sbb_monitor.sbb_monitor_plugin import SBBMonitorPlugin
|
||||||
|
|
||||||
|
QPyDesignerCustomWidgetCollection.addCustomWidget(SBBMonitorPlugin())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__": # pragma: no cover
|
||||||
|
main()
|
15
bec_widgets/widgets/editors/sbb_monitor/sbb_monitor.py
Normal file
15
bec_widgets/widgets/editors/sbb_monitor/sbb_monitor.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from bec_widgets.widgets.editors.website.website import WebsiteWidget
|
||||||
|
|
||||||
|
|
||||||
|
class SBBMonitor(WebsiteWidget):
|
||||||
|
"""
|
||||||
|
A widget to display the SBB monitor website.
|
||||||
|
"""
|
||||||
|
|
||||||
|
PLUGIN = True
|
||||||
|
ICON_NAME = "train"
|
||||||
|
USER_ACCESS = []
|
||||||
|
|
||||||
|
def __init__(self, parent=None, **kwargs):
|
||||||
|
url = "https://free.oevplus.ch/monitor/?viewType=splitView&layout=1&showClock=true&showPerron=true&stationGroup1Title=Villigen%2C%20PSI%20West&stationGroup2Title=Siggenthal-Würenlingen&station_1_id=85%3A3592&station_1_name=Villigen%2C%20PSI%20West&station_1_quantity=5&station_1_group=1&station_2_id=85%3A3502&station_2_name=Siggenthal-Würenlingen&station_2_quantity=5&station_2_group=2"
|
||||||
|
super().__init__(parent=parent, url=url, **kwargs)
|
@ -0,0 +1,54 @@
|
|||||||
|
# Copyright (C) 2022 The Qt Company Ltd.
|
||||||
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||||
|
|
||||||
|
from qtpy.QtDesigner import QDesignerCustomWidgetInterface
|
||||||
|
|
||||||
|
from bec_widgets.utils.bec_designer import designer_material_icon
|
||||||
|
from bec_widgets.widgets.editors.sbb_monitor.sbb_monitor import SBBMonitor
|
||||||
|
|
||||||
|
DOM_XML = """
|
||||||
|
<ui language='c++'>
|
||||||
|
<widget class='SBBMonitor' name='sbb_monitor'>
|
||||||
|
</widget>
|
||||||
|
</ui>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class SBBMonitorPlugin(QDesignerCustomWidgetInterface): # pragma: no cover
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self._form_editor = None
|
||||||
|
|
||||||
|
def createWidget(self, parent):
|
||||||
|
t = SBBMonitor(parent)
|
||||||
|
return t
|
||||||
|
|
||||||
|
def domXml(self):
|
||||||
|
return DOM_XML
|
||||||
|
|
||||||
|
def group(self):
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def icon(self):
|
||||||
|
return designer_material_icon(SBBMonitor.ICON_NAME)
|
||||||
|
|
||||||
|
def includeFile(self):
|
||||||
|
return "sbb_monitor"
|
||||||
|
|
||||||
|
def initialize(self, form_editor):
|
||||||
|
self._form_editor = form_editor
|
||||||
|
|
||||||
|
def isContainer(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def isInitialized(self):
|
||||||
|
return self._form_editor is not None
|
||||||
|
|
||||||
|
def name(self):
|
||||||
|
return "SBBMonitor"
|
||||||
|
|
||||||
|
def toolTip(self):
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def whatsThis(self):
|
||||||
|
return self.toolTip()
|
Reference in New Issue
Block a user