mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-03-30 05:18:36 +02:00
fix: typos
This commit is contained in:
@@ -263,7 +263,7 @@ class BECMainApp(BECMainWindow):
|
||||
developer_view_step = self.guided_tour.register_widget(
|
||||
widget=sidebar_developer_view,
|
||||
title="Developer View",
|
||||
text="Click here to access the Developer view to write scripts and makros.",
|
||||
text="Click here to access the Developer view to write scripts and macros.",
|
||||
)
|
||||
tour_steps.append(developer_view_step)
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ class DeviceManagerDisplayWidget(DockAreaWidget):
|
||||
self._upload_redis_dialog: UploadRedisDialog | None = None
|
||||
self._dialog_validation_connection: QMetaObject.Connection | None = None
|
||||
|
||||
# NOTE: We need here a seperate config helper instance to avoid conflicts with
|
||||
# NOTE: We need here a separate config helper instance to avoid conflicts with
|
||||
# other communications to REDIS as uploading a config through a CommunicationConfigAction
|
||||
# will block if we use the config_helper from self.client.config._config_helper
|
||||
self._config_helper = config_helper.ConfigHelper(self.client.connector)
|
||||
@@ -607,8 +607,8 @@ class DeviceManagerDisplayWidget(DockAreaWidget):
|
||||
self.device_table_view._is_config_in_sync_with_redis()
|
||||
)
|
||||
validation_results = self.device_table_view.get_validation_results()
|
||||
for config, config_status, connnection_status in validation_results.values():
|
||||
if connnection_status == ConnectionStatus.CONNECTED.value:
|
||||
for config, config_status, connection_status in validation_results.values():
|
||||
if connection_status == ConnectionStatus.CONNECTED.value:
|
||||
self.device_table_view.update_device_validation(
|
||||
config, config_status, ConnectionStatus.CAN_CONNECT, ""
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ logger = bec_logger.logger
|
||||
|
||||
|
||||
class _WidgetsEnumType(str, enum.Enum):
|
||||
"""Enum for the available widgets, to be generated programatically"""
|
||||
"""Enum for the available widgets, to be generated programmatically"""
|
||||
|
||||
...
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ logger = bec_logger.logger
|
||||
if self._base:
|
||||
self.content += """
|
||||
class _WidgetsEnumType(str, enum.Enum):
|
||||
\"\"\" Enum for the available widgets, to be generated programatically \"\"\"
|
||||
\"\"\" Enum for the available widgets, to be generated programmatically \"\"\"
|
||||
...
|
||||
"""
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ class BECConnector:
|
||||
)
|
||||
self.config = ConnectionConfig(widget_class=self.__class__.__name__)
|
||||
|
||||
# If the gui_id is passed, it should be respected. However, this should be revisted since
|
||||
# If the gui_id is passed, it should be respected. However, this should be revisited since
|
||||
# the gui_id has to be unique, and may no longer be.
|
||||
if gui_id:
|
||||
self.config.gui_id = gui_id
|
||||
@@ -399,7 +399,7 @@ class BECConnector:
|
||||
"""
|
||||
self.config = config
|
||||
|
||||
# FIXME some thoughts are required to decide how thhis should work with rpc registry
|
||||
# FIXME some thoughts are required to decide how this should work with rpc registry
|
||||
def apply_config(self, config: dict, generate_new_id: bool = True) -> None:
|
||||
"""
|
||||
Apply the configuration to the widget.
|
||||
@@ -417,7 +417,7 @@ class BECConnector:
|
||||
else:
|
||||
self.gui_id = self.config.gui_id
|
||||
|
||||
# FIXME some thoughts are required to decide how thhis should work with rpc registry
|
||||
# FIXME some thoughts are required to decide how this should work with rpc registry
|
||||
def load_config(self, path: str | None = None, gui: bool = False):
|
||||
"""
|
||||
Load the configuration of the widget from YAML.
|
||||
|
||||
@@ -43,7 +43,7 @@ class WidgetContainerUtils:
|
||||
if list_of_names is None:
|
||||
list_of_names = []
|
||||
ii = 0
|
||||
while ii < 1000: # 1000 is arbritrary!
|
||||
while ii < 1000: # 1000 is arbitrary!
|
||||
name_candidate = f"{name}_{ii}"
|
||||
if name_candidate not in list_of_names:
|
||||
return name_candidate
|
||||
|
||||
@@ -71,7 +71,7 @@ class FormItemSpec(BaseModel):
|
||||
"""
|
||||
The specification for an item in a dynamically generated form. Uses a pydantic FieldInfo
|
||||
to store most annotation info, since one of the main purposes is to store data for
|
||||
forms genrated from pydantic models, but can also be composed from other sources or by hand.
|
||||
forms generated from pydantic models, but can also be composed from other sources or by hand.
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
@@ -192,7 +192,7 @@ class DynamicFormItem(QWidget):
|
||||
@abstractmethod
|
||||
def _add_main_widget(self) -> None:
|
||||
self._main_widget: QWidget
|
||||
"""Add the main data entry widget to self._main_widget and appply any
|
||||
"""Add the main data entry widget to self._main_widget and apply any
|
||||
constraints from the field info"""
|
||||
|
||||
@SafeSlot()
|
||||
|
||||
@@ -15,7 +15,7 @@ class Kind(IFBase):
|
||||
"""
|
||||
This is used in the .kind attribute of all OphydObj (Signals, Devices).
|
||||
|
||||
A Device examines its components' .kind atttribute to decide whether to
|
||||
A Device examines its components' .kind attribute to decide whether to
|
||||
traverse it in read(), read_configuration(), or neither. Additionally, if
|
||||
decides whether to include its name in `hints['fields']`.
|
||||
"""
|
||||
|
||||
@@ -156,7 +156,7 @@ class RPCServer:
|
||||
if method == "raise" and hasattr(
|
||||
obj, "setWindowState"
|
||||
): # special case for raising windows, should work even if minimized
|
||||
# this is a special case for raising windows for gnome on rethat 9 systems where changing focus is supressed by default
|
||||
# this is a special case for raising windows for gnome on Red Hat (RHEL) 9 systems where changing focus is suppressed by default
|
||||
# The procedure is as follows:
|
||||
# 1. Get the current window state to check if the window is minimized and remove minimized flag
|
||||
# 2. Then in order to force gnome to raise the window, we set the window to stay on top temporarily
|
||||
@@ -442,5 +442,5 @@ class RPCServer:
|
||||
self.status = messages.BECStatus.IDLE
|
||||
self._heartbeat_timer.stop()
|
||||
self.emit_heartbeat()
|
||||
logger.info("Succeded in shutting down CLI server")
|
||||
logger.info("Succeeded in shutting down CLI server")
|
||||
self.client.shutdown()
|
||||
|
||||
@@ -224,7 +224,7 @@ class PositionerBoxBase(BECWidget, CompactPopupWidget):
|
||||
self.bec_dispatcher.connect_slot(slot, MessageEndpoints.device_readback(new_device))
|
||||
|
||||
def _toggle_enable_buttons(self, ui: DeviceUpdateUIComponents, enable: bool) -> None:
|
||||
"""Toogle enable/disable on available buttons
|
||||
"""Toggle enable/disable on available buttons
|
||||
|
||||
Args:
|
||||
enable (bool): Enable buttons
|
||||
|
||||
@@ -13,7 +13,7 @@ if TYPE_CHECKING:
|
||||
from .available_device_group import AvailableDeviceGroup
|
||||
|
||||
|
||||
class _DeviceListWiget(QListWidget):
|
||||
class _DeviceListWidget(QListWidget):
|
||||
|
||||
def _item_iter(self):
|
||||
return (self.item(i) for i in range(self.count()))
|
||||
@@ -44,7 +44,7 @@ class Ui_AvailableDeviceGroup(object):
|
||||
self.n_included.setObjectName("n_included")
|
||||
title_layout.addWidget(self.n_included)
|
||||
|
||||
self.device_list = _DeviceListWiget(AvailableDeviceGroup)
|
||||
self.device_list = _DeviceListWidget(AvailableDeviceGroup)
|
||||
self.device_list.setSelectionMode(QListWidget.SelectionMode.ExtendedSelection)
|
||||
self.device_list.setObjectName("device_list")
|
||||
self.device_list.setFrameStyle(0)
|
||||
|
||||
@@ -34,13 +34,13 @@ class HashModel(str, Enum):
|
||||
class DeviceResourceBackend(Protocol):
|
||||
@property
|
||||
def tag_groups(self) -> dict[str, set[HashableDevice]]:
|
||||
"""A dictionary of all availble devices separated by tag groups. The same device may
|
||||
"""A dictionary of all available devices separated by tag groups. The same device may
|
||||
appear more than once (in different groups)."""
|
||||
...
|
||||
|
||||
@property
|
||||
def all_devices(self) -> set[HashableDevice]:
|
||||
"""A set of all availble devices. The same device may not appear more than once."""
|
||||
"""A set of all available devices. The same device may not appear more than once."""
|
||||
...
|
||||
|
||||
@property
|
||||
|
||||
@@ -347,14 +347,14 @@ class ScanGroupBox(QGroupBox):
|
||||
|
||||
def get_parameters(self, device_object: bool = True):
|
||||
"""
|
||||
Returns the parameters from the widgets in the scan control layout formated to run scan from BEC.
|
||||
Returns the parameters from the widgets in the scan control layout formatted to run scan from BEC.
|
||||
"""
|
||||
if self.box_type == "args":
|
||||
return self._get_arg_parameterts(device_object=device_object)
|
||||
return self._get_arg_parameters(device_object=device_object)
|
||||
elif self.box_type == "kwargs":
|
||||
return self._get_kwarg_parameters(device_object=device_object)
|
||||
|
||||
def _get_arg_parameterts(self, device_object: bool = True):
|
||||
def _get_arg_parameters(self, device_object: bool = True):
|
||||
args = []
|
||||
for i in range(1, self.layout.rowCount()):
|
||||
for j in range(self.layout.columnCount()):
|
||||
|
||||
@@ -1778,7 +1778,7 @@ class Waveform(PlotBase):
|
||||
if parent_curve is None:
|
||||
logger.warning(
|
||||
f"No device curve found for DAP curve '{dap_curve.name()}'!"
|
||||
) # TODO triggerd when DAP curve is removed from the curve dialog, why?
|
||||
) # TODO triggered when DAP curve is removed from the curve dialog, why?
|
||||
continue
|
||||
|
||||
x_data, y_data = parent_curve.get_data()
|
||||
|
||||
@@ -276,7 +276,7 @@ class Ring(BECConnector, QWidget):
|
||||
for obj in dev_obj._info["signals"].values()
|
||||
if obj["kind_str"] == "hinted"
|
||||
and obj["signal_class"]
|
||||
not in ["ProgressSignal", "AyncSignal", "AsyncMultiSignal", "DynamicSignal"]
|
||||
not in ["ProgressSignal", "AsyncSignal", "AsyncMultiSignal", "DynamicSignal"]
|
||||
]
|
||||
|
||||
normal_signals = [
|
||||
|
||||
@@ -88,7 +88,7 @@ class DeviceBrowser(BECWidget, QWidget):
|
||||
self.setLayout(layout)
|
||||
|
||||
def init_warning_label(self):
|
||||
self.ui.scan_running_warning.setText("Warning: editing diabled while scan is running!")
|
||||
self.ui.scan_running_warning.setText("Warning: editing disabled while scan is running!")
|
||||
self.ui.scan_running_warning.setStyleSheet(
|
||||
"background-color: #fcba03; color: rgb(0, 0, 0);"
|
||||
)
|
||||
|
||||
@@ -160,8 +160,8 @@ class ScanHistoryMetadataViewer(BECWidget, QtWidgets.QGroupBox):
|
||||
Clear the view by resetting the labels and values.
|
||||
"""
|
||||
layout = self.layout()
|
||||
lauout_counts = layout.count()
|
||||
for i in range(lauout_counts):
|
||||
layout_counts = layout.count()
|
||||
for i in range(layout_counts):
|
||||
item = layout.itemAt(i)
|
||||
if item.widget():
|
||||
item.widget().close()
|
||||
|
||||
@@ -305,7 +305,7 @@ class ScanHistoryView(BECWidget, QtWidgets.QTreeWidget):
|
||||
def remove_scan(self, index: int):
|
||||
"""
|
||||
Remove a scan entry from the tree widget.
|
||||
We supoprt negative indexing where -1, -2, etc.
|
||||
We support negative indexing where -1, -2, etc.
|
||||
|
||||
Args:
|
||||
index (int): The index of the scan entry to remove.
|
||||
|
||||
@@ -31,7 +31,7 @@ api_reference/api_reference.md
|
||||
|
||||
## Introduction
|
||||
|
||||
An introduction into the single-resposibility principle and the modular design of BEC Widgets.
|
||||
An introduction into the single-responsibility principle and the modular design of BEC Widgets.
|
||||
```
|
||||
|
||||
```{grid-item-card}
|
||||
|
||||
@@ -19,7 +19,7 @@ cd bec_widgets
|
||||
```
|
||||
**Install in Editable Mode**:
|
||||
|
||||
Please install the package in editable mode into your BEC Python environemnt.
|
||||
Please install the package in editable mode into your BEC Python environment.
|
||||
```bash
|
||||
pip install -e '.[dev,pyside6]'
|
||||
```
|
||||
|
||||
@@ -16,7 +16,7 @@ that the widgets are discoverable.
|
||||
- make sure that the widget class inherits from both `BECWidget` as well as `QWidget` or a subclass
|
||||
of it, such as `QComboBox` or `QLineEdit`.
|
||||
- make sure it initialises each of these superclasses in its `__init__()` method, and passes the
|
||||
`parent` keyword argumment on to `QWidget.__init__()`.
|
||||
`parent` keyword argument on to `QWidget.__init__()`.
|
||||
- add `PLUGIN = True` as a class variable to the widget class
|
||||
- add `USER_ACCESS = [...]`, including any methods and properties which should be accessible in the
|
||||
client to the list, as strings.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
````
|
||||
|
||||
````{tab} Examples - CLI
|
||||
In the following examples, we will use `BECIPythonClient` as the main object to interact with the `BECDockArea`. These tutorials focus on how to work with the `BECDockArea` framework, such as adding and removing docks, saving and restoring layouts, and managing the docked widgets. By default the `BECDockArea` is refered as `gui` in `BECIPythonClient`. For more detailed examples of each individual component, please refer to the example sections of each individual [`widget`](user.widgets).
|
||||
In the following examples, we will use `BECIPythonClient` as the main object to interact with the `BECDockArea`. These tutorials focus on how to work with the `BECDockArea` framework, such as adding and removing docks, saving and restoring layouts, and managing the docked widgets. By default the `BECDockArea` is referred to as `gui` in `BECIPythonClient`. For more detailed examples of each individual component, please refer to the example sections of each individual [`widget`](user.widgets).
|
||||
|
||||
## Example 1 - Adding Docks to BECDockArea
|
||||
|
||||
@@ -62,7 +62,7 @@ dock_area.waveform_dock
|
||||
dock_area.motor_dock
|
||||
dock_area.image_dock
|
||||
|
||||
# If objects were closed, we will keep a refernce that will indicate that the dock was deleted
|
||||
# If objects were closed, we will keep a reference that will indicate that the dock was deleted
|
||||
# Try closing the window with the dock_area via mouse click on x
|
||||
|
||||
dock_area
|
||||
|
||||
@@ -79,7 +79,7 @@ if __name__ == "__main__":
|
||||
|
||||
````
|
||||
|
||||
````{tab} Examples - BEC desginer
|
||||
````{tab} Examples - BEC designer
|
||||
The various properties can also be set when the SignalLabel widget is added to a UI in BEC designer:
|
||||
|
||||
```{figure} ./designer_screenshot.png
|
||||
|
||||
@@ -215,7 +215,7 @@ Display custom text or HTML content.
|
||||
Display website content.
|
||||
```
|
||||
|
||||
```{grid-item-card} Toogle Widget
|
||||
```{grid-item-card} Toggle Widget
|
||||
:link: user.widgets.toggle
|
||||
:link-type: ref
|
||||
:img-top: /assets/widget_screenshots/toggle.png
|
||||
@@ -244,7 +244,7 @@ Modern progress bar for BEC.
|
||||
:link-type: ref
|
||||
:img-top: /assets/widget_screenshots/position_indicator.png
|
||||
|
||||
Display position of motor withing its limits.
|
||||
Display position of motor within its limits.
|
||||
```
|
||||
|
||||
```{grid-item-card} LMFit Dialog
|
||||
|
||||
@@ -32,8 +32,8 @@ def threads_check_fixture(threads_check):
|
||||
|
||||
@pytest.fixture
|
||||
def gui_id():
|
||||
"""New gui id each time, to ensure no 'gui is alive' zombie key can perturbate"""
|
||||
return f"figure_{random.randint(0,100)}" # make a new gui id each time, to ensure no 'gui is alive' zombie key can perturbate
|
||||
"""New gui id each time, to ensure no 'gui is alive' zombie key can perturb"""
|
||||
return f"figure_{random.randint(0,100)}" # make a new gui id each time, to ensure no 'gui is alive' zombie key can perturb
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
|
||||
@@ -22,7 +22,7 @@ from bec_widgets.cli.client_utils import BECGuiClient
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def gui_id():
|
||||
"""New gui id each time, to ensure no 'gui is alive' zombie key can perturbate"""
|
||||
"""New gui id each time, to ensure no 'gui is alive' zombie key can perturb"""
|
||||
return f"figure_{random.randint(0,100)}"
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ def test_dap_combobox_set_axis(dap_combobox):
|
||||
container = []
|
||||
|
||||
def my_callback(msg: str):
|
||||
"""Calback function to store the messages."""
|
||||
"""Callback function to store the messages."""
|
||||
container.append(msg)
|
||||
|
||||
dap_combobox.x_axis_updated.connect(my_callback)
|
||||
@@ -51,7 +51,7 @@ def test_dap_combobox_select_fit(dap_combobox):
|
||||
container = []
|
||||
|
||||
def my_callback(msg: str):
|
||||
"""Calback function to store the messages."""
|
||||
"""Callback function to store the messages."""
|
||||
container.append(msg)
|
||||
|
||||
dap_combobox.fit_model_updated.connect(my_callback)
|
||||
@@ -66,7 +66,7 @@ def test_dap_combobox_currentTextchanged(dap_combobox):
|
||||
container = []
|
||||
|
||||
def my_callback(msg: str):
|
||||
"""Calback function to store the messages."""
|
||||
"""Callback function to store the messages."""
|
||||
container.append(msg)
|
||||
|
||||
assert dap_combobox.fit_model_combobox.currentText() == "GaussianModel"
|
||||
|
||||
@@ -1422,7 +1422,7 @@ class TestDeviceConfigTemplate:
|
||||
qtbot.waitExposed(template)
|
||||
yield template
|
||||
|
||||
def test_device_config_teamplate_default_init(
|
||||
def test_device_config_template_default_init(
|
||||
self, device_config_template: DeviceConfigTemplate, qtbot
|
||||
):
|
||||
"""Test DeviceConfigTemplate default initialization."""
|
||||
|
||||
@@ -113,7 +113,7 @@ def test_client_generator_with_black_formatting():
|
||||
|
||||
|
||||
class _WidgetsEnumType(str, enum.Enum):
|
||||
"""Enum for the available widgets, to be generated programatically"""
|
||||
"""Enum for the available widgets, to be generated programmatically"""
|
||||
|
||||
...
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ def metadata_widget(empty_metadata_widget: ScanMetadata):
|
||||
)
|
||||
|
||||
|
||||
def fill_commponents(components: dict[str, DynamicFormItem]):
|
||||
def fill_components(components: dict[str, DynamicFormItem]):
|
||||
components["sample_name"].setValue("test name")
|
||||
components["str_optional"].setValue(None)
|
||||
components["str_required"].setValue("something")
|
||||
@@ -147,7 +147,7 @@ def test_griditems_are_correct_class(
|
||||
|
||||
def test_grid_to_dict(metadata_widget: tuple[ScanMetadata, dict[str, DynamicFormItem]]):
|
||||
widget, components = metadata_widget = metadata_widget
|
||||
fill_commponents(components)
|
||||
fill_components(components)
|
||||
|
||||
assert widget._dict_from_grid() == TEST_DICT
|
||||
assert widget.get_form_data() == TEST_DICT | {"extra_field": "extra_data"}
|
||||
@@ -159,7 +159,7 @@ def test_validation(metadata_widget: tuple[ScanMetadata, dict[str, DynamicFormIt
|
||||
widget._validity.compact_status.default_led[:114]
|
||||
)
|
||||
|
||||
fill_commponents(components)
|
||||
fill_components(components)
|
||||
widget.validate_form()
|
||||
assert widget._validity_message.text() == "No errors!"
|
||||
|
||||
@@ -178,7 +178,7 @@ def test_numbers_clipped_to_limits(
|
||||
metadata_widget: tuple[ScanMetadata, dict[str, DynamicFormItem]],
|
||||
):
|
||||
widget, components = metadata_widget = metadata_widget
|
||||
fill_commponents(components)
|
||||
fill_components(components)
|
||||
|
||||
components["decimal_dp_limits_nodefault"].setValue(-56)
|
||||
assert components["decimal_dp_limits_nodefault"].getValue() == pytest.approx(1.01)
|
||||
|
||||
@@ -637,7 +637,7 @@ def test_fetch_scan_data_and_access(qtbot, mocked_client, monkeypatch):
|
||||
wf._fetch_scan_data_and_access()
|
||||
hist_mock.assert_called_once_with(-1)
|
||||
|
||||
# Ckeck live mode
|
||||
# Check live mode
|
||||
dummy_scan = create_dummy_scan_item()
|
||||
wf.scan_item = dummy_scan
|
||||
data_dict, access_key = wf._fetch_scan_data_and_access()
|
||||
|
||||
Reference in New Issue
Block a user