improvement(data_viewer): Add info message to load from folder button #100
@@ -16,7 +16,7 @@ from bec_widgets.utils.colors import apply_theme, get_accent_colors
|
||||
from bec_widgets.utils.error_popups import SafeSlot
|
||||
|
||||
# pylint: disable=E0611
|
||||
from qtpy.QtWidgets import QApplication, QFileDialog, QVBoxLayout, QWidget
|
||||
from qtpy.QtWidgets import QApplication, QFileDialog, QMessageBox, QVBoxLayout, QWidget
|
||||
|
||||
from .panels.input_panel import InputPanel
|
||||
from .panels.scan_view import ScanViewer
|
||||
@@ -60,6 +60,8 @@ class DataViewer(BECWidget, QWidget):
|
||||
self.viewer.unload_button.clicked_connect(self.unload_all_scans)
|
||||
self.input.open_fm_button.clicked_connect(self.open_in_file_manager)
|
||||
|
||||
self.show_open_from_folder_infobox = True
|
||||
|
||||
def apply_theme(self, theme: Literal["dark", "light"]):
|
||||
"""
|
||||
Apply the theme
|
||||
@@ -115,6 +117,16 @@ class DataViewer(BECWidget, QWidget):
|
||||
start_folder = f"/sls/{beamline}/data/{active_account}/raw"
|
||||
else:
|
||||
start_folder = "/sls"
|
||||
|
||||
if self.show_open_from_folder_infobox:
|
||||
self.show_open_from_folder_infobox = False
|
||||
info_box = QMessageBox(self)
|
||||
info_box.setIcon(QMessageBox.Icon.Information)
|
||||
info_box.setWindowTitle("Select Scan Folder")
|
||||
info_box.setText("Navigate to the scan <b>folder</b> and click 'Open' to load it.")
|
||||
info_box.addButton("Got it!", QMessageBox.ButtonRole.AcceptRole)
|
||||
info_box.exec_()
|
||||
|
||||
base_filepath = QFileDialog.getExistingDirectory(self, "Open Scan Folder", start_folder)
|
||||
|
||||
if base_filepath != "":
|
||||
|
||||
Reference in New Issue
Block a user