mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix: create widget enum programatically
This commit is contained in:
@ -10,44 +10,48 @@ from bec_widgets.cli.rpc.rpc_base import RPCBase, rpc_call
|
|||||||
# pylint: skip-file
|
# pylint: skip-file
|
||||||
|
|
||||||
|
|
||||||
class Widgets(str, enum.Enum):
|
class _WidgetsEnumType(str, enum.Enum):
|
||||||
"""
|
"""Enum for the available widgets, to be generated programatically"""
|
||||||
Enum for the available widgets.
|
|
||||||
"""
|
|
||||||
|
|
||||||
AbortButton = "AbortButton"
|
...
|
||||||
BECColorMapWidget = "BECColorMapWidget"
|
|
||||||
BECDockArea = "BECDockArea"
|
|
||||||
BECProgressBar = "BECProgressBar"
|
_Widgets = {
|
||||||
BECQueue = "BECQueue"
|
"AbortButton": "AbortButton",
|
||||||
BECStatusBox = "BECStatusBox"
|
"BECColorMapWidget": "BECColorMapWidget",
|
||||||
DapComboBox = "DapComboBox"
|
"BECDockArea": "BECDockArea",
|
||||||
DarkModeButton = "DarkModeButton"
|
"BECMultiWaveformWidget": "BECMultiWaveformWidget",
|
||||||
DeviceBrowser = "DeviceBrowser"
|
"BECProgressBar": "BECProgressBar",
|
||||||
DeviceComboBox = "DeviceComboBox"
|
"BECQueue": "BECQueue",
|
||||||
DeviceLineEdit = "DeviceLineEdit"
|
"BECStatusBox": "BECStatusBox",
|
||||||
Image = "Image"
|
"DapComboBox": "DapComboBox",
|
||||||
LMFitDialog = "LMFitDialog"
|
"DarkModeButton": "DarkModeButton",
|
||||||
LogPanel = "LogPanel"
|
"DeviceBrowser": "DeviceBrowser",
|
||||||
Minesweeper = "Minesweeper"
|
"DeviceComboBox": "DeviceComboBox",
|
||||||
MotorMap = "MotorMap"
|
"DeviceLineEdit": "DeviceLineEdit",
|
||||||
MultiWaveform = "MultiWaveform"
|
"Image": "Image",
|
||||||
PositionIndicator = "PositionIndicator"
|
"LMFitDialog": "LMFitDialog",
|
||||||
PositionerBox = "PositionerBox"
|
"LogPanel": "LogPanel",
|
||||||
PositionerBox2D = "PositionerBox2D"
|
"Minesweeper": "Minesweeper",
|
||||||
PositionerControlLine = "PositionerControlLine"
|
"MotorMap": "MotorMap",
|
||||||
ResetButton = "ResetButton"
|
"PositionIndicator": "PositionIndicator",
|
||||||
ResumeButton = "ResumeButton"
|
"PositionerBox": "PositionerBox",
|
||||||
RingProgressBar = "RingProgressBar"
|
"PositionerBox2D": "PositionerBox2D",
|
||||||
ScanControl = "ScanControl"
|
"PositionerControlLine": "PositionerControlLine",
|
||||||
ScatterWaveform = "ScatterWaveform"
|
"ResetButton": "ResetButton",
|
||||||
SignalComboBox = "SignalComboBox"
|
"ResumeButton": "ResumeButton",
|
||||||
SignalLineEdit = "SignalLineEdit"
|
"RingProgressBar": "RingProgressBar",
|
||||||
StopButton = "StopButton"
|
"ScanControl": "ScanControl",
|
||||||
TextBox = "TextBox"
|
"ScatterWaveform": "ScatterWaveform",
|
||||||
VSCodeEditor = "VSCodeEditor"
|
"SignalComboBox": "SignalComboBox",
|
||||||
Waveform = "Waveform"
|
"SignalLineEdit": "SignalLineEdit",
|
||||||
WebsiteWidget = "WebsiteWidget"
|
"StopButton": "StopButton",
|
||||||
|
"TextBox": "TextBox",
|
||||||
|
"VSCodeEditor": "VSCodeEditor",
|
||||||
|
"Waveform": "Waveform",
|
||||||
|
"WebsiteWidget": "WebsiteWidget",
|
||||||
|
}
|
||||||
|
Widgets = _WidgetsEnumType("Widgets", _Widgets)
|
||||||
|
|
||||||
|
|
||||||
class AbortButton(RPCBase):
|
class AbortButton(RPCBase):
|
||||||
|
@ -70,13 +70,18 @@ from bec_widgets.cli.rpc.rpc_base import RPCBase, rpc_call
|
|||||||
Write the client enum to the content.
|
Write the client enum to the content.
|
||||||
"""
|
"""
|
||||||
self.content += """
|
self.content += """
|
||||||
class Widgets(str, enum.Enum):
|
class _WidgetsEnumType(str, enum.Enum):
|
||||||
\"\"\"
|
\"\"\" Enum for the available widgets, to be generated programatically \"\"\"
|
||||||
Enum for the available widgets.
|
...
|
||||||
\"\"\"
|
|
||||||
|
_Widgets = {
|
||||||
"""
|
"""
|
||||||
for cls in published_classes:
|
for cls in published_classes:
|
||||||
self.content += f'{cls.__name__} = "{cls.__name__}"\n '
|
self.content += f'"{cls.__name__}": "{cls.__name__}",\n '
|
||||||
|
|
||||||
|
self.content += """}
|
||||||
|
Widgets = _WidgetsEnumType("Widgets", _Widgets)
|
||||||
|
"""
|
||||||
|
|
||||||
def generate_content_for_class(self, cls):
|
def generate_content_for_class(self, cls):
|
||||||
"""
|
"""
|
||||||
|
3850
bec_widgets/client.py
Normal file
3850
bec_widgets/client.py
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user