0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

fix: config_dialog.py prevents to add one scan twice

This commit is contained in:
wyzula-jan
2023-10-26 15:44:02 +02:00
committed by wyzula_j
parent 93db0c21ef
commit 12469c8c1e

View File

@ -206,6 +206,11 @@ class ConfigDialog(QWidget, Ui_Form):
Returns:
scan_tab(QWidget): Scan tab widget
"""
# Check for an existing tab with the same name
for index in range(parent_tab.count()):
if parent_tab.tabText(index) == scan_name:
print(f'Scan name "{scan_name}" already exists.')
return None # or return the existing tab: return parent_tab.widget(index)
# Create a new scan tab
scan_tab = QWidget()
@ -305,6 +310,7 @@ class ConfigDialog(QWidget, Ui_Form):
"""
scan_tab = self.add_new_scan(parent_tab, scan_name, closable=True)
if scan_tab is not None:
self.add_new_plot(scan_tab)
def get_plot_config(self, plot_tab: QWidget) -> dict: