GUI: Clean-up

This commit is contained in:
leonarski_f committed 2026-01-15 16:07:53 +01:00
1 parent b63ce6892f
commit 65c341077a
25 files changed
+66 -63

No files matched your search

+1 -3
View File
@@ -10,8 +10,6 @@ class MXBeamline(Enum):
def mx_beamline() -> MXBeamline:
name = os.getenv("BEAMLINE_XNAME")
if name is None:
name = os.getenv("BEAMLINE", "SIMULATED")
name = os.getenv("BEAMLINE")
name=name.strip().upper()
return MXBeamline[name] if name in MXBeamline.__members__ else MXBeamline.SIMULATED
+19 -19
View File
@@ -38,34 +38,34 @@ def setup_logger(name="aareDAQ", base_dir: str | None = '~/tmp/mxlogs', config_p
# switch to production mode using: $ APP_ENV=prod python main.py
env = os.getenv("APP_ENV", "dev") # default: dev
if config_path is None:
config_file = get_config_path(env)
else:
config_file = Path(config_path)
#if config_path is None:
# config_file = get_config_path(env)
#else:
# config_file = Path(config_path)
with open(config_file, "r") as f:
config = yaml.safe_load(f.read())
# with open(config_file, "r") as f:
# config = yaml.safe_load(f.read())
# Force base directory to be under the user's home dir
effective_base = base_dir or '~/mxlogs'
effective_base = os.path.abspath(os.path.expanduser(os.path.expandvars(effective_base)))
# effective_base = base_dir or '~/mxlogs'
# effective_base = os.path.abspath(os.path.expanduser(os.path.expandvars(effective_base)))
# Ensure directories for file handlers exist
handlers = config.get("handlers", {})
#handlers = config.get("handlers", {})
for h in handlers.values():
#for h in handlers.values():
filename = h.get("filename")
if not filename:
continue
abs_filename = os.path.join(effective_base, os.path.basename(filename))
# filename = h.get("filename")
# if not filename:
# continue
# abs_filename = os.path.join(effective_base, os.path.basename(filename))
h["filename"] = abs_filename
log_dir = os.path.dirname(abs_filename)
if log_dir and not os.path.exists(log_dir):
os.makedirs(log_dir, exist_ok=True)
#h["filename"] = abs_filename
#log_dir = os.path.dirname(abs_filename)
#if log_dir and not os.path.exists(log_dir):
# os.makedirs(log_dir, exist_ok=True)
logging.config.dictConfig(config)
# logging.config.dictConfig(config)
logging.getLogger("redis_lock").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.getLogger("matplotlib.font_manager").setLevel(logging.WARNING)
+1 -1
View File
@@ -24,7 +24,7 @@ class BeamlineDevices:
self.__smargon = smargon.Smargon(beamline)
self.__ring_current_pv = PV(f"ARS07-DPCT-0100:CURR")
self.__dtz = MyMotor(f"{BEAMLINE}-ES-DET:TRZ1")
self.__dtz = MyMotor(f"{BEAMLINE}-ES-DET:TRZ")
self.__sample_cam = epicsAD(f"{BEAMLINE}-SAMCAM:")
# Transmission
+2
View File
@@ -13,6 +13,8 @@ class JFJochWrapper:
match bl:
case MXBeamline.X06DA:
self.__url = "http://sls-gpu-001:8080"
case MXBeamline.X10SA:
self.__url = "http://sls-gpu-002:8080"
case MXBeamline.SIMULATED:
self.__url = "http://localhost:8080"
case _:
+3
View File
@@ -23,6 +23,9 @@ class Smargon(object):
if bl == MXBeamline.X06DA:
self.__simulated = False
self.__base = "http://x06da-smargopolo.psi.ch:3000"
elif bl == MXBeamline.X10SA:
self.__simulated = False
self.__base = "http://x10sa-smargopolo.psi.ch:3000"
elif bl == MXBeamline.SIMULATED:
self.__simulated = True
self.__pos = self.SMARGON_HOME
+1 -1
View File
@@ -33,7 +33,7 @@ if __name__ == "__main__":
default_zmq_addr = "tcp://x06da-pserv-01:9089" #129.129.110.12:9089
default_pred_zmq_addr = "tcp://mx-ml:9091"
case MXBeamline.X10SA:
default_url = "http://mx-x10sa-queue-01.psi.ch:5210"
default_url = "http://127.0.0.1:5210"
default_zmq_addr = "tcp://x10sa-pserv-01:9089"
default_pred_zmq_addr = ""
case MXBeamline.X06SA:
+10 -10
View File
@@ -17,24 +17,24 @@ from aare.common.models import SampleShortInfoList, TokenData, DAQStatusModel, B
from aare.common.sample_geometry import SampleGeometryModel
from aare.gui.panels.LogPanel import LogDock
from aare.gui.panels import BeamlineControls
from aare.gui.panels import DataCollectionSettings
from aare.gui.panels.beamline_controls import BeamlineControls
from aare.gui.panels.data_collection_settings import DataCollectionSettings
from aare.gui.panels.manual_sample_panel import ManualSamplePanel
from aare.gui.panels.reference_tools_panel import ReferenceToolsPanel
from aare.gui.panels import SampleQueuePanel
from aare.gui.panels.sample_queue_panel import SampleQueuePanel
from aare.gui.panels.tell_sample_panel import TellSamplePanel
from aare.gui.panels.face_detection_panel import FaceDetectionPanel
from aare.gui.scan_logic import RasterGridManager
from aare.gui.scan_logic import RotationScanManager
from aare.gui.scan_logic import SampleMountLogic
from aare.gui.scan_logic.raster_grid_manager import RasterGridManager
from aare.gui.scan_logic.rotation_scan_manager import RotationScanManager
from aare.gui.scan_logic.sample_mount_logic import SampleMountLogic
from aare.gui.threads.axis_video_thread import VideoThread
from aare.gui.threads import SampleCameraThread, PredictionSubscriber
from aare.gui.threads import DAQWorker
from aare.gui.threads import JFJochDBusClient
from aare.gui.threads.camera_thread import SampleCameraThread, PredictionSubscriber
from aare.gui.threads.daq_worker import DAQWorker
from aare.gui.threads.jfjoch_viewer import JFJochDBusClient
from aare.gui.widgets.camera_image import SampleCameraImageLabel
from aare.gui.widgets.no_wheel_scroll_area import NoWheelScrollArea
from aare.gui.widgets.status_bar import StatusBar
from aare.gui.widgets import VideoGraphicsView
from aare.gui.widgets.video_image import VideoGraphicsView
from aare.gui.panels.fluorescence_panel import FluorescencePanel
logger = setup_logger("aareGUI")
+2 -2
View File
@@ -4,8 +4,8 @@ from PySide6.QtWidgets import QWidget, QGridLayout, QLabel, QPushButton
from aare.common.coordinate import Coordinate
from aare.common.models import DAQStatusModel
from aare.gui.widgets import ButtonWithPayload
from aare.gui.widgets import NumberLineEdit
from aare.gui.widgets.button_with_payload import ButtonWithPayload
from aare.gui.widgets.number_line_edit import NumberLineEdit
from aare.gui.widgets.title_label import TitleLabel
DEFAULT_ABR_STEP_UM = 5
+1 -1
View File
@@ -2,7 +2,7 @@ from PySide6.QtCore import Signal, Slot
from PySide6.QtWidgets import QWidget, QGridLayout, QLabel
from aare.common.models import DAQStatusModel
from aare.gui.widgets import NumberLineEdit
from aare.gui.widgets.number_line_edit import NumberLineEdit
from aare.gui.widgets.title_label import TitleLabel
+1 -1
View File
@@ -2,7 +2,7 @@ from PySide6.QtCore import Signal, Slot
from PySide6.QtWidgets import QWidget, QGridLayout, QLabel
from aare.common.models import DAQStatusModel
from aare.gui.widgets import NumberLineEdit
from aare.gui.widgets.number_line_edit import NumberLineEdit
from aare.gui.widgets.title_label import TitleLabel
+5 -5
View File
@@ -1,10 +1,10 @@
from PySide6.QtWidgets import QFrame, QVBoxLayout
from aare.gui.panels import AbrTweakWidget
from aare.gui.panels import BeamCenterWidget
from aare.gui.panels import BeamMarkWidget
from aare.gui.panels import BeamSizeWidget
from aare.gui.panels import IlluminationPanel
from aare.gui.panels.abr_tweak_panel import AbrTweakWidget
from aare.gui.panels.beam_center_panel import BeamCenterWidget
from aare.gui.panels.beam_mark_panel import BeamMarkWidget
from aare.gui.panels.beam_size_panel import BeamSizeWidget
from aare.gui.panels.illumination_panel import IlluminationPanel
from aare.gui.panels.loop_centering_panel import LoopCenteringPanel
from aare.gui.panels.omega_panel import OmegaPanel
from aare.gui.panels.samcam_panel import SamcamPanel
@@ -14,8 +14,8 @@ from aare.gui.panels.file_path_panel import FilePathPanel
from aare.gui.panels.fluorescence_data_collection import FluorescenceDataCollectionPanel
from aare.gui.panels.raster_data_collection import RasterDataCollectionPanel
from aare.gui.panels.rotation_data_collection import RotationDataCollectionPanel
from aare.gui.panels import SimpleRotationSettingsPanel
from aare.gui.scan_logic import RasterGridManager
from aare.gui.panels.smart_rotation_panel import SimpleRotationSettingsPanel
from aare.gui.scan_logic.raster_grid_manager import RasterGridManager
class DataCollectionSettings(QFrame):
+1 -1
View File
@@ -5,7 +5,7 @@ from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import numpy as np
from aare.gui.widgets import NumberLineEdit
from aare.gui.widgets.number_line_edit import NumberLineEdit
from aare.gui.widgets.title_label import TitleLabel
from aare.common.logger_config import setup_logger
@@ -2,7 +2,7 @@ from PySide6.QtCore import Signal, Slot
from PySide6.QtWidgets import QWidget, QGridLayout, QLabel, QPushButton, QCheckBox
from aare.common.models import FluorescenceSpectrumParameterModel
from aare.gui.widgets import NumberLineEdit
from aare.gui.widgets.number_line_edit import NumberLineEdit
class FluorescenceDataCollectionPanel(QWidget):
+1 -1
View File
@@ -3,7 +3,7 @@ from PySide6.QtWidgets import QWidget, QGridLayout, QLabel, QPushButton, QCheckB
from aareDBclient import DataCollectionParameters
from aare.common.models import SampleShortInfo, DAQStatusModel
from aare.gui.widgets import NumberLineEdit
from aare.gui.widgets.number_line_edit import NumberLineEdit
from aare.gui.widgets.title_label import TitleLabel
+2 -2
View File
@@ -2,8 +2,8 @@ from PySide6.QtCore import Signal, Slot
from PySide6.QtWidgets import QWidget, QGridLayout, QLabel, QHBoxLayout
from aare.common.models import DAQStatusModel
from aare.gui.widgets import ButtonWithPayload
from aare.gui.widgets import NumberLineEdit
from aare.gui.widgets.button_with_payload import ButtonWithPayload
from aare.gui.widgets.number_line_edit import NumberLineEdit
from aare.gui.widgets.title_label import TitleLabel
@@ -3,9 +3,9 @@ from PySide6.QtWidgets import QLabel, QSizePolicy, QSpacerItem, QPushButton, QCo
from aare.common.diffraction_geometry import DiffractionGeometry
from aare.common.models import DAQStatusModel, BeamlineStateEnum
from aare.gui.panels import ScanSettingsPanel
from aare.gui.scan_logic import RasterGridManager, RasterGridMetric
from aare.gui.widgets import CheckedLineEdit
from aare.gui.panels.scan_settings_panel import ScanSettingsPanel
from aare.gui.scan_logic.raster_grid_manager import RasterGridManager, RasterGridMetric
from aare.gui.widgets.number_line_edit import CheckedLineEdit
from aare.gui.widgets.raster_grid_table import RasterGridTable
from aare.common.logger_config import setup_logger
@@ -7,8 +7,8 @@ from aare.common.diffraction_geometry import DiffractionGeometry
from aare.common.logger_config import setup_logger
from aare.common.models import DAQStatusModel, BeamlineStateEnum
from aare.common.rotation_scan import RotationScanRequest
from aare.gui.panels import ScanSettingsPanel
from aare.gui.widgets import NumberLineEdit, CheckedLineEdit
from aare.gui.panels.scan_settings_panel import ScanSettingsPanel
from aare.gui.widgets.number_line_edit import NumberLineEdit, CheckedLineEdit
logger = setup_logger("aareGUI")
+1 -1
View File
@@ -4,7 +4,7 @@ from PySide6.QtWidgets import QFrame, QVBoxLayout, QHBoxLayout, QPushButton, QHe
from PySide6.QtGui import QKeySequence, QShortcut
from aare.common.models import SampleShortInfoList, SampleShortInfo, BeamlineStateEnum
from aare.gui.models import SampleQueueSpreadsheet
from aare.gui.models.sample_queue_model import SampleQueueSpreadsheet
from aare.gui.widgets.message_box import ring_current_low_check, experiment_hutch_shutter_check, LOW_CURRENT_THRESHOLD, \
ring_current_auto_check
from aare.gui.widgets.title_label import TitleLabel
+1 -1
View File
@@ -5,7 +5,7 @@ from aare.common.diffraction_geometry import DiffractionGeometry
from aare.common.logger_config import setup_logger
from aare.common.models import DAQStatusModel
from aare.gui.widgets.message_box import ring_current_low_check, experiment_hutch_shutter_check
from aare.gui.widgets import CheckedLineEdit
from aare.gui.widgets.number_line_edit import CheckedLineEdit
logger = setup_logger("aareGUI")
+2 -2
View File
@@ -2,8 +2,8 @@ from PySide6.QtCore import Signal, Slot
from PySide6.QtWidgets import QWidget, QGridLayout, QLabel, QPushButton
from aare.common.models import DAQStatusModel
from aare.gui.widgets import ButtonWithPayload
from aare.gui.widgets import NumberLineEdit
from aare.gui.widgets.button_with_payload import ButtonWithPayload
from aare.gui.widgets.number_line_edit import NumberLineEdit
from aare.gui.widgets.title_label import TitleLabel
from aare.common.coordinate import SmargonCoordinate, Coordinate
from aare.common.sample_geometry import SampleGeometryModel
+1 -1
View File
@@ -7,7 +7,7 @@ from aare.common.logger_config import setup_logger
from aare.common.models import DAQStatusModel, SimpleScanParameters, CrystalSize
from aare.common.rotation_scan import RotationScanRequest
from aare.gui.panels.rotation_data_collection import add_data_to_path
from aare.gui.widgets import NumberLineEdit
from aare.gui.widgets.number_line_edit import NumberLineEdit
logger = setup_logger("aareGUI")
+1 -1
View File
@@ -2,7 +2,7 @@ from PySide6.QtCore import Slot, Signal
from PySide6.QtWidgets import QWidget, QGridLayout
from aare.common.models import DAQStatusModel
from aare.gui.widgets import ButtonWithPayload
from aare.gui.widgets.button_with_payload import ButtonWithPayload
from aare.gui.widgets.title_label import TitleLabel
+1 -1
View File
@@ -27,7 +27,7 @@ from aare.common.models import DAQStatusModel, AutofocusSettings, SampleCameraSe
from aare.gui.models.bookmark import SmargonBookmarkList
from aare.common.coordinate import Coordinate, SmargonCoordinate
from aare.common.sample_geometry import SampleGeometryModel
from aare.gui.scan_logic import RasterGridManager
from aare.gui.scan_logic.raster_grid_manager import RasterGridManager
from aare.common.logger_config import setup_logger
logger = setup_logger("aareGUI")
+1 -1
View File
@@ -1,7 +1,7 @@
from PySide6.QtCore import Signal, Slot
from PySide6.QtWidgets import QTableWidget, QHeaderView, QTableWidgetItem, QWidget, QHBoxLayout, QPushButton
from aare.gui.scan_logic import RasterGridManager
from aare.gui.scan_logic.raster_grid_manager import RasterGridManager
class RasterGridTable(QTableWidget):