0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

fix(scan_control): scan args signal fixed to emit list instead of hardcoded structure

This commit is contained in:
2024-10-22 15:04:23 +02:00
parent 6f0182115f
commit 4f5448cf51
2 changed files with 91 additions and 116 deletions

View File

@ -215,42 +215,18 @@
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<widget class="ScanControl" name="scan_control"> <widget class="ScanControl" name="scan_control">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="current_scan" stdset="0"> <property name="current_scan" stdset="0">
<string>line_scan</string> <string>line_scan</string>
</property> </property>
<property name="hide_arg_box" stdset="0"> <property name="hide_arg_box" stdset="0">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="hide_kwarg_boxes" stdset="0">
<bool>false</bool>
</property>
<property name="hide_scan_control_buttons" stdset="0">
<bool>false</bool>
</property>
<property name="hide_scan_selection_combobox" stdset="0"> <property name="hide_scan_selection_combobox" stdset="0">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="hide_add_remove_buttons" stdset="0"> <property name="hide_add_remove_buttons" stdset="0">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="hide_args_group" stdset="0">
<bool>false</bool>
</property>
<property name="hide_kwargs_group" stdset="0">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -440,24 +416,9 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>ToggleSwitch</class> <class>DapComboBox</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>toggle_switch</header> <header>dap_combo_box</header>
</customwidget>
<customwidget>
<class>BECWaveformWidget</class>
<extends>QWidget</extends>
<header>bec_waveform_widget</header>
</customwidget>
<customwidget>
<class>BECStatusBox</class>
<extends>QWidget</extends>
<header>bec_status_box</header>
</customwidget>
<customwidget>
<class>WebsiteWidget</class>
<extends>QWidget</extends>
<header>website_widget</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>StopButton</class> <class>StopButton</class>
@ -465,44 +426,59 @@
<header>stop_button</header> <header>stop_button</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>LMFitDialog</class> <class>WebsiteWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>lm_fit_dialog</header> <header>website_widget</header>
</customwidget>
<customwidget>
<class>PositionerGroup</class>
<extends>QWidget</extends>
<header>positioner_group</header>
</customwidget>
<customwidget>
<class>ScanControl</class>
<extends>QWidget</extends>
<header>scan_control</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>BECQueue</class> <class>BECQueue</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>bec_queue</header> <header>bec_queue</header>
</customwidget> </customwidget>
<customwidget>
<class>ScanControl</class>
<extends>QWidget</extends>
<header>scan_control</header>
</customwidget>
<customwidget>
<class>ToggleSwitch</class>
<extends>QWidget</extends>
<header>toggle_switch</header>
</customwidget>
<customwidget> <customwidget>
<class>BECProgressBar</class> <class>BECProgressBar</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>bec_progress_bar</header> <header>bec_progress_bar</header>
</customwidget> </customwidget>
<customwidget>
<class>DeviceComboBox</class>
<extends>QComboBox</extends>
<header>device_combobox</header>
</customwidget>
<customwidget> <customwidget>
<class>DarkModeButton</class> <class>DarkModeButton</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>dark_mode_button</header> <header>dark_mode_button</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>DapComboBox</class> <class>PositionerGroup</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>dap_combo_box</header> <header>positioner_group</header>
</customwidget>
<customwidget>
<class>BECWaveformWidget</class>
<extends>QWidget</extends>
<header>bec_waveform_widget</header>
</customwidget>
<customwidget>
<class>DeviceComboBox</class>
<extends>QComboBox</extends>
<header>device_combobox</header>
</customwidget>
<customwidget>
<class>LMFitDialog</class>
<extends>QWidget</extends>
<header>lm_fit_dialog</header>
</customwidget>
<customwidget>
<class>BECStatusBox</class>
<extends>QWidget</extends>
<header>bec_status_box</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
@ -514,12 +490,12 @@
<slot>toogle_roi_select(bool)</slot> <slot>toogle_roi_select(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>529</x> <x>1042</x>
<y>728</y> <y>212</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>1099</x> <x>1416</x>
<y>96</y> <y>322</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -546,12 +522,12 @@
<slot>plot(QString)</slot> <slot>plot(QString)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>297</x> <x>577</x>
<y>170</y> <y>215</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>1099</x> <x>1416</x>
<y>201</y> <y>427</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -562,12 +538,12 @@
<slot>select_y_axis(QString)</slot> <slot>select_y_axis(QString)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>297</x> <x>577</x>
<y>170</y> <y>215</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>467</x> <x>909</x>
<y>170</y> <y>215</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -578,44 +554,12 @@
<slot>add_dap(QString,QString,QString)</slot> <slot>add_dap(QString,QString,QString)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>467</x>
<y>170</y>
</hint>
<hint type="destinationlabel">
<x>1099</x>
<y>221</y>
</hint>
</hints>
</connection>
<connection>
<sender>scan_control</sender>
<signal>scan_axis(QString,double,double)</signal>
<receiver>bec_waveform_widget</receiver>
<slot>set_x(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>244</x>
<y>348</y>
</hint>
<hint type="destinationlabel">
<x>1140</x>
<y>491</y>
</hint>
</hints>
</connection>
<connection>
<sender>scan_control</sender>
<signal>scan_axis(QString,double,double)</signal>
<receiver>dap_combo_box</receiver>
<slot>select_x_axis(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>244</x>
<y>322</y>
</hint>
<hint type="destinationlabel">
<x>909</x> <x>909</x>
<y>189</y> <y>215</y>
</hint>
<hint type="destinationlabel">
<x>1416</x>
<y>447</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -626,12 +570,44 @@
<slot>set_positioners(QString)</slot> <slot>set_positioners(QString)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>227</x> <x>230</x>
<y>337</y> <y>306</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>227</x> <x>187</x>
<y>676</y> <y>926</y>
</hint>
</hints>
</connection>
<connection>
<sender>scan_control</sender>
<signal>device_selected(QString)</signal>
<receiver>bec_waveform_widget</receiver>
<slot>set_x(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>187</x>
<y>356</y>
</hint>
<hint type="destinationlabel">
<x>972</x>
<y>509</y>
</hint>
</hints>
</connection>
<connection>
<sender>scan_control</sender>
<signal>device_selected(QString)</signal>
<receiver>dap_combo_box</receiver>
<slot>select_x_axis(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>187</x>
<y>356</y>
</hint>
<hint type="destinationlabel">
<x>794</x>
<y>202</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>

View File

@ -45,7 +45,7 @@ class ScanControl(BECWidget, QWidget):
scan_started = Signal() scan_started = Signal()
scan_selected = Signal(str) scan_selected = Signal(str)
device_selected = Signal(str) device_selected = Signal(str)
scan_axis = Signal(str, float, float) scan_args = Signal(list)
def __init__( def __init__(
self, self,
@ -457,8 +457,7 @@ class ScanControl(BECWidget, QWidget):
def run_scan(self): def run_scan(self):
"""Starts the selected scan with the given parameters.""" """Starts the selected scan with the given parameters."""
args, kwargs = self.get_scan_parameters() args, kwargs = self.get_scan_parameters()
for device, start, stop in zip(*[iter(args)] * 3): self.scan_args.emit(args)
self.scan_axis.emit(device.name, start, stop)
scan_function = getattr(self.scans, self.comboBox_scan_selection.currentText()) scan_function = getattr(self.scans, self.comboBox_scan_selection.currentText())
if callable(scan_function): if callable(scan_function):
self.scan_started.emit() self.scan_started.emit()