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:
@ -206,6 +206,11 @@ class ConfigDialog(QWidget, Ui_Form):
|
|||||||
Returns:
|
Returns:
|
||||||
scan_tab(QWidget): Scan tab widget
|
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
|
# Create a new scan tab
|
||||||
scan_tab = QWidget()
|
scan_tab = QWidget()
|
||||||
@ -305,7 +310,8 @@ class ConfigDialog(QWidget, Ui_Form):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
scan_tab = self.add_new_scan(parent_tab, scan_name, closable=True)
|
scan_tab = self.add_new_scan(parent_tab, scan_name, closable=True)
|
||||||
self.add_new_plot(scan_tab)
|
if scan_tab is not None:
|
||||||
|
self.add_new_plot(scan_tab)
|
||||||
|
|
||||||
def get_plot_config(self, plot_tab: QWidget) -> dict:
|
def get_plot_config(self, plot_tab: QWidget) -> dict:
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user