Skip to content

implement fixes #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion src/snapred/backend/dao/request/ReductionRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from snapred.backend.dao.state.FocusGroup import FocusGroup
from snapred.backend.error.ContinueWarning import ContinueWarning
from snapred.meta.mantid.WorkspaceNameGenerator import WorkspaceName
from snapred.meta.mantid.WorkspaceNameGenerator import WorkspaceNameGenerator as wng

Versions = NamedTuple("Versions", [("calibration", Optional[int]), ("normalization", Optional[int])])

Expand All @@ -17,7 +18,7 @@ class ReductionRequest(BaseModel):
focusGroups: List[FocusGroup] = []

keepUnfocused: bool = False
convertUnitsTo: str = None
convertUnitsTo: str = wng.Units.DSP

# Calibration and normalization versions:
# `None` => <use latest version>
Expand Down
2 changes: 1 addition & 1 deletion src/snapred/ui/presenter/TestPanelPresenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def __init__(self, view):
self.normalizationCalibrationWidget = self._addWorkflowWidget(self.normalizationCalibrationWorkflow.widget)
self.reductionWidget = self._addWorkflowWidget(self.reductionWorkflow.widget)

self.view.tabWidget.addTab(self.reductionWidget, "Reduction")
self.view.tabWidget.addTab(self.diffractionCalibrationWidget, "Diffraction Calibration")
self.view.tabWidget.addTab(self.normalizationCalibrationWidget, "Normalization")
self.view.tabWidget.addTab(self.reductionWidget, "Reduction")

def _addWorkflowWidget(self, widget_):
layout = QGridLayout()
Expand Down
11 changes: 9 additions & 2 deletions src/snapred/ui/view/TestPanelView.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qtpy.QtCore import Slot
from qtpy.QtWidgets import QGridLayout, QMainWindow, QTabWidget, QWidget
from qtpy.QtWidgets import QDesktopWidget, QGridLayout, QMainWindow, QTabWidget, QWidget


class TestPanelView(QMainWindow):
Expand All @@ -17,7 +17,8 @@ def __init__(self, parent=None):
self.tabWidget = QTabWidget()
self.tabWidget.setTabPosition(QTabWidget.West)
self.grid.addWidget(self.tabWidget)
self.adjustSize()
self.resize(1280, 720)
self.center()

@Slot()
def enableAllWorkflows(self):
Expand All @@ -32,3 +33,9 @@ def disableOtherWorkflows(self):
for n in range(self.tabWidget.count()):
if n != currentTab:
self.tabWidget.setTabEnabled(n, False)

def center(self):
qr = self.frameGeometry()
cp = QDesktopWidget().availableGeometry().center()
qr.moveCenter(cp)
self.move(qr.topLeft())
2 changes: 2 additions & 0 deletions src/snapred/ui/view/reduction/ReductionRequestView.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
# Horizontal layout for run number input and button
self.runNumberLayout = QHBoxLayout()
self.runNumberInput = QLineEdit()
self.runNumberInput.returnPressed.connect(self.addRunNumber)
self.enterRunNumberButton = QPushButton("Enter Run Number")
self.clearButton = QPushButton("Clear")
self.runNumberButtonLayout = QVBoxLayout()
Expand All @@ -57,6 +58,7 @@ def __init__(
self.convertUnitsDropdown = self._sampleDropDown(
"Convert Units", ["TOF", "dSpacing", "Wavelength", "MomentumTransfer"]
)
self.convertUnitsDropdown.setCurrentIndex(2)

# Set field properties
self.liteModeToggle.setEnabled(False)
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/test_workflow_panels_happy_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def test_calibration_and_reduction_panels_happy_path(
##########################################################################################################

# Diffraction calibration:
calibrationPanelTabs.setCurrentIndex(0)
calibrationPanelTabs.setCurrentIndex(1)
diffractionCalibrationWidget = calibrationPanelTabs.currentWidget()

### The use of this next signal is somewhat cryptic, but it makes testing the GUI much more stable:
Expand Down Expand Up @@ -442,7 +442,7 @@ def test_calibration_and_reduction_panels_happy_path(
#####################################################################################################

# Normalization calibration:
calibrationPanelTabs.setCurrentIndex(1)
calibrationPanelTabs.setCurrentIndex(2)
normalizationCalibrationWidget = calibrationPanelTabs.currentWidget()

#################################################################
Expand Down Expand Up @@ -589,7 +589,7 @@ def test_calibration_and_reduction_panels_happy_path(
#################################################################################################

# Reduction:
calibrationPanelTabs.setCurrentIndex(2)
calibrationPanelTabs.setCurrentIndex(1)
reductionWidget = calibrationPanelTabs.currentWidget()

#################################################################
Expand Down Expand Up @@ -762,7 +762,7 @@ def test_diffraction_calibration_panel_happy_path(self, qtbot, qapp, calibration
##########################################################################################################

# Diffraction calibration:
calibrationPanelTabs.setCurrentIndex(0)
calibrationPanelTabs.setCurrentIndex(1)
diffractionCalibrationWidget = calibrationPanelTabs.currentWidget()

### The use of this next signal is somewhat cryptic, but it makes testing the GUI much more stable:
Expand Down Expand Up @@ -995,7 +995,7 @@ def test_normalization_panel_happy_path(self, qtbot, qapp, calibration_home_from
#####################################################################################################

# Normalization calibration:
calibrationPanelTabs.setCurrentIndex(1)
calibrationPanelTabs.setCurrentIndex(2)
normalizationCalibrationWidget = calibrationPanelTabs.currentWidget()

#################################################################
Expand Down Expand Up @@ -1234,7 +1234,7 @@ def completionMessageBoxAssert(*args, **kwargs): # noqa: ARG001
#################################################################################################

# Reduction:
calibrationPanelTabs.setCurrentIndex(2)
calibrationPanelTabs.setCurrentIndex(0)
reductionWidget = calibrationPanelTabs.currentWidget()

#################################################################
Expand Down