From 625f65dc2b9e04c580cec99459f404c53a8eec31 Mon Sep 17 00:00:00 2001 From: wyzula-jan Date: Fri, 12 Dec 2025 14:04:44 +0100 Subject: [PATCH] fix(bec_widgets): removed omny alignment old gui --- .../widgets/omny_alignment/__init__.py | 0 .../widgets/omny_alignment/omny_alignment.py | 140 ------------------ .../omny_alignment/omny_alignment.pyproject | 1 - .../widgets/omny_alignment/omny_alignment.ui | 125 ---------------- .../omny_alignment/omny_alignment_plugin.py | 54 ------- .../omny_alignment/register_omny_alignment.py | 15 -- 6 files changed, 335 deletions(-) delete mode 100644 csaxs_bec/bec_widgets/widgets/omny_alignment/__init__.py delete mode 100644 csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.py delete mode 100644 csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.pyproject delete mode 100644 csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.ui delete mode 100644 csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment_plugin.py delete mode 100644 csaxs_bec/bec_widgets/widgets/omny_alignment/register_omny_alignment.py diff --git a/csaxs_bec/bec_widgets/widgets/omny_alignment/__init__.py b/csaxs_bec/bec_widgets/widgets/omny_alignment/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.py b/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.py deleted file mode 100644 index 622bf3c..0000000 --- a/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.py +++ /dev/null @@ -1,140 +0,0 @@ - - -from typing import TypedDict -from bec_widgets.utils.error_popups import SafeSlot -import os -from bec_widgets.utils.bec_widget import BECWidget -from bec_widgets.utils.ui_loader import UILoader -from qtpy.QtWidgets import QWidget, QPushButton, QLineEdit, QLabel, QVBoxLayout -from bec_qthemes import material_icon -from bec_lib.logger import bec_logger - -logger = bec_logger.logger - - -# class OmnyAlignmentUIComponents(TypedDict): -# moveRightButton: QPushButton -# moveLeftButton: QPushButton -# moveUpButton: QPushButton -# moveDownButton: QPushButton -# image: Image - - -class OmnyAlignment(BECWidget, QWidget): - USER_ACCESS = ["enable_live_view", "enable_live_view.setter", "user_message", "user_message.setter","sample_name", "sample_name.setter", "enable_move_buttons", "enable_move_buttons.setter"] - PLUGIN = True - ui_file = "./omny_alignment.ui" - - def __init__(self, parent=None, **kwargs): - super().__init__(parent=parent, **kwargs) - - self._load_ui() - - def _load_ui(self): - current_path = os.path.dirname(__file__) - self.ui = UILoader(self).loader(os.path.join(current_path, self.ui_file)) - layout = QVBoxLayout() - layout.addWidget(self.ui) - self.setLayout(layout) - - icon_options = {"size": (16, 16), "convert_to_pixmap": False} - self.ui.moveRightButton.setText("") - self.ui.moveRightButton.setIcon( - material_icon(icon_name="keyboard_arrow_right", **icon_options) - ) - - self.ui.moveLeftButton.setText("") - self.ui.moveLeftButton.setIcon( - material_icon(icon_name="keyboard_arrow_left", **icon_options) - ) - - self.ui.moveUpButton.setText("") - self.ui.moveUpButton.setIcon( - material_icon(icon_name="keyboard_arrow_up", **icon_options) - ) - - self.ui.moveDownButton.setText("") - self.ui.moveDownButton.setIcon( - material_icon(icon_name="keyboard_arrow_down", **icon_options) - ) - - self.ui.confirmButton.setText("OK") - - - self.ui.liveViewSwitch.enabled.connect(self.on_live_view_enabled) - - # self.ui.moveUpButton.clicked.connect(self.on_move_up) - - - @property - def enable_live_view(self): - return self.ui.liveViewSwitch.checked - - @enable_live_view.setter - def enable_live_view(self, enable:bool): - self.ui.liveViewSwitch.checked = enable - - - @property - def user_message(self): - return self.ui.messageLineEdit.text() - - @user_message.setter - def user_message(self, message:str): - self.ui.messageLineEdit.setText(message) - - @property - def sample_name(self): - return self.ui.sampleLineEdit.text() - - @sample_name.setter - def sample_name(self, message:str): - self.ui.sampleLineEdit.setText(message) - - - @SafeSlot(bool) - def on_live_view_enabled(self, enabled:bool): - from bec_widgets.widgets.plots.image.image import Image - logger.info(f"Live view is enabled: {enabled}") - image: Image = self.ui.image - if enabled: - image.image("cam_xeye") - return - - image.disconnect_monitor("cam_xeye") - - - @property - def enable_move_buttons(self): - move_up:QPushButton = self.ui.moveUpButton - move_down:QPushButton = self.ui.moveDownButton - move_left:QPushButton = self.ui.moveLeftButton - move_right:QPushButton = self.ui.moveRightButton - return move_up.isEnabled() and move_down.isEnabled() and move_left.isEnabled() and move_right.isEnabled() - - @enable_move_buttons.setter - def enable_move_buttons(self, enabled:bool): - move_up:QPushButton = self.ui.moveUpButton - move_down:QPushButton = self.ui.moveDownButton - move_left:QPushButton = self.ui.moveLeftButton - move_right:QPushButton = self.ui.moveRightButton - - move_up.setEnabled(enabled) - move_down.setEnabled(enabled) - move_left.setEnabled(enabled) - move_right.setEnabled(enabled) - - - - - - -if __name__ == "__main__": - from qtpy.QtWidgets import QApplication - import sys - - app = QApplication(sys.argv) - widget = OmnyAlignment() - - widget.show() - sys.exit(app.exec_()) \ No newline at end of file diff --git a/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.pyproject b/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.pyproject deleted file mode 100644 index 3182247..0000000 --- a/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.pyproject +++ /dev/null @@ -1 +0,0 @@ -{'files': ['omny_alignment.py']} \ No newline at end of file diff --git a/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.ui b/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.ui deleted file mode 100644 index 6572d2f..0000000 --- a/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment.ui +++ /dev/null @@ -1,125 +0,0 @@ - - - Form - - - - 0 - 0 - 988 - 821 - - - - Form - - - - - - - - PushButton - - - - - - - PushButton - - - - - - - Up - - - - - - - PushButton - - - - - - - PushButton - - - - - - - - - - - - - - - - - Sample - - - - - - - Message - - - - - - - - - false - - - false - - - cam_xeye - - - 3 - - - - - - - - - - Live View - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - - - - - - Image - QWidget -
image
-
- - ToggleSwitch - QWidget -
toggle_switch
-
-
- - -
diff --git a/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment_plugin.py b/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment_plugin.py deleted file mode 100644 index cbbd81b..0000000 --- a/csaxs_bec/bec_widgets/widgets/omny_alignment/omny_alignment_plugin.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -from qtpy.QtDesigner import QDesignerCustomWidgetInterface - -from bec_widgets.utils.bec_designer import designer_material_icon -from csaxs_bec.bec_widgets.widgets.omny_alignment.omny_alignment import OmnyAlignment - -DOM_XML = """ - - - - -""" - - -class OmnyAlignmentPlugin(QDesignerCustomWidgetInterface): # pragma: no cover - def __init__(self): - super().__init__() - self._form_editor = None - - def createWidget(self, parent): - t = OmnyAlignment(parent) - return t - - def domXml(self): - return DOM_XML - - def group(self): - return "" - - def icon(self): - return designer_material_icon(OmnyAlignment.ICON_NAME) - - def includeFile(self): - return "omny_alignment" - - def initialize(self, form_editor): - self._form_editor = form_editor - - def isContainer(self): - return False - - def isInitialized(self): - return self._form_editor is not None - - def name(self): - return "OmnyAlignment" - - def toolTip(self): - return "OmnyAlignment" - - def whatsThis(self): - return self.toolTip() diff --git a/csaxs_bec/bec_widgets/widgets/omny_alignment/register_omny_alignment.py b/csaxs_bec/bec_widgets/widgets/omny_alignment/register_omny_alignment.py deleted file mode 100644 index 701fb7c..0000000 --- a/csaxs_bec/bec_widgets/widgets/omny_alignment/register_omny_alignment.py +++ /dev/null @@ -1,15 +0,0 @@ -def main(): # pragma: no cover - from qtpy import PYSIDE6 - - if not PYSIDE6: - print("PYSIDE6 is not available in the environment. Cannot patch designer.") - return - from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection - - from csaxs_bec.bec_widgets.widgets.omny_alignment.omny_alignment_plugin import OmnyAlignmentPlugin - - QPyDesignerCustomWidgetCollection.addCustomWidget(OmnyAlignmentPlugin()) - - -if __name__ == "__main__": # pragma: no cover - main()