Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/_dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
pipx run build

- name: Upload sdist and wheel as artifacts
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: dist
path: dist
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: rm build/html/.doctrees/environment.pickle

- name: Upload built docs artifact
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: docs
path: build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:

steps:
- name: Download artifacts
uses: actions/download-artifact@v6
uses: actions/download-artifact@v7
with:
merge-multiple: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- if: inputs.python-version == 'dev'
name: Upload dev-requirements.txt
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: dev-requirements
path: /tmp/dev-requirements.txt
Expand Down
20 changes: 20 additions & 0 deletions src/i19serial_ui/gui/serial_gui_eh2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
log_to_gui,
tidy_up_logging,
)
from i19serial_ui.parameters.general_utils import ApertureOptions

WINDOW_SIZE = (600, 1200)
LOG_HANDLERS = []
Expand Down Expand Up @@ -126,9 +127,27 @@ def _setup_title(self):
self.i19_label.setFont(QtGui.QFont(FONT, 13))
self.i19_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)

def _create_dropdown(self):
self.aperturedropdown = QtWidgets.QComboBox()
self.aperturedropdown.addItems(list(ApertureOptions))
self.selected_aperture = self.read_aperture_dropdown()

def read_aperture_dropdown(self):
return self.aperturedropdown.currentText()

def _create_top_group(self):
# move arrows, phi step, focuse, backlight etc
self._create_dropdown()
self.top_group = QtWidgets.QGroupBox()
top_layout = QtWidgets.QGridLayout()
self.ddb_label = QtWidgets.QLabel("Select aperture size:")
self.ddb_label.setFont(QtGui.QFont(FONT, 10))
self.ddb_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)
top_layout.addWidget(self.ddb_label)
top_layout.addWidget(self.aperturedropdown)
self.top_group.setLayout(top_layout)
self.aperturedropdown.setFixedWidth(150)
top_layout.setColumnStretch(2, 1)

def _create_coordinate_system_group(self):
self.cs_group = QtWidgets.QGroupBox("Coordinate System")
Expand Down Expand Up @@ -233,6 +252,7 @@ def run_panda(self):
num_images = float(self.inputs.num_images.text())
rotation_increment = float(self.inputs.image_width.text())
rotation_end = rotation_start + num_images + rotation_increment

params = {
"phi_start": rotation_start,
"phi_end": rotation_end,
Expand Down
8 changes: 8 additions & 0 deletions src/i19serial_ui/parameters/general_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from enum import StrEnum


class ApertureOptions(StrEnum):
UM_20 = "20um"
UM_40 = "40um"
UM_100 = "100um"
UM_3000 = "3000um"
12 changes: 12 additions & 0 deletions tests/gui/test_eh2_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,25 @@ def test_all_widgets_initialised(mock_eh2_gui):
assert mock_eh2_gui.inputs and isinstance(mock_eh2_gui.inputs, InputPanel)
assert mock_eh2_gui.wells and isinstance(mock_eh2_gui.wells, WellsSelectionPanel)
assert mock_eh2_gui.grid and isinstance(mock_eh2_gui.grid, GridOptions)
assert mock_eh2_gui.aperturedropdown and isinstance(
mock_eh2_gui.aperturedropdown, QtWidgets.QComboBox
)


def test_general_layout(mock_eh2_gui):
assert mock_eh2_gui.general_layout is not None
assert isinstance(mock_eh2_gui.general_layout, QtWidgets.QGridLayout)
title = mock_eh2_gui.general_layout.children()[0]
assert isinstance(title, QtWidgets.QHBoxLayout)
assert isinstance(mock_eh2_gui.top_group, QtWidgets.QGroupBox)


@pytest.mark.parametrize(
"aperture,index", [("20um", 0), ("40um", 1), ("100um", 2), ("3000um", 3)]
)
def test_dropdown_update(mock_eh2_gui, aperture, index):
mock_eh2_gui.aperturedropdown.setCurrentIndex(index)
assert mock_eh2_gui.read_aperture_dropdown() == aperture


def test_select_visit(mock_eh2_gui):
Expand Down
4 changes: 3 additions & 1 deletion tests/gui/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
from pathlib import Path

import pytest
Expand All @@ -19,9 +20,10 @@ def test_create_icon():


def test_get_data_main_path():
year = datetime.now().year
res = get_data_main_path()

assert res.as_posix() == "/dls/i19-2/data/2025"
assert res.as_posix() == f"/dls/i19-2/data/{year}"


def test_get_config_file_path_for_eh2():
Expand Down
Loading