Skip to content
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

GUI side for RITS export 2d binned mode #2010

Merged
merged 3 commits into from
Jan 22, 2024
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
46 changes: 44 additions & 2 deletions mantidimaging/gui/ui/spectrum_viewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,23 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="image_output_mode">
<widget class="QComboBox" name="image_output_mode_combobox">
<item>
<property name="text">
<string>Single Spectrum</string>
</property>
</item>
<item>
<property name="text">
<string>2D Binned</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Error mode</string>
<string>Error Mode</string>
</property>
</widget>
</item>
Expand All @@ -284,6 +289,43 @@
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="bin_size_label">
<property name="text">
<string>Bin Size</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bin_size_spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="bin_step_label">
<property name="text">
<string>Bin Step</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bin_step_spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
Expand Down
26 changes: 25 additions & 1 deletion mantidimaging/gui/windows/spectrum_viewer/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QCheckBox, QVBoxLayout, QFileDialog, QPushButton, QLabel, QAbstractItemView, QHeaderView, \
QTabWidget, QComboBox
QTabWidget, QComboBox, QSpinBox

from mantidimaging.core.utility import finder
from mantidimaging.gui.mvp_base import BaseMainWindowView
Expand Down Expand Up @@ -36,7 +36,10 @@ class SpectrumViewerWindowView(BaseMainWindowView):
normaliseErrorIcon: QLabel
_current_dataset_id: Optional['UUID']
normalise_error_issue: str = ""
image_output_mode_combobox: QComboBox
transmission_error_mode_combobox: QComboBox
bin_size_spinBox: QSpinBox
bin_step_spinBox: QSpinBox

def __init__(self, main_window: 'MainWindowView'):
super().__init__(None, 'gui/ui/spectrum_viewer.ui')
Expand Down Expand Up @@ -68,6 +71,8 @@ def __init__(self, main_window: 'MainWindowView'):
self.normaliseCheckBox.stateChanged.connect(self.presenter.handle_button_enabled)

self.exportTabs.currentChanged.connect(self.presenter.handle_export_tab_change)
self.image_output_mode_combobox.currentTextChanged.connect(self.set_binning_visibility)
self.set_binning_visibility()

# ROI action buttons
self.addBtn.clicked.connect(self.set_new_roi)
Expand Down Expand Up @@ -310,3 +315,22 @@ def clear_all_rois(self) -> None:
@property
def transmission_error_mode(self) -> str:
return self.transmission_error_mode_combobox.currentText()

@property
def image_output_mode(self) -> str:
return self.image_output_mode_combobox.currentText()

@property
def bin_size(self) -> int:
return self.bin_size_spinbox.value()

@property
def bin_step(self) -> int:
return self.bin_step_spinbox.value()

def set_binning_visibility(self) -> None:
hide_binning = self.image_output_mode != "2D Binned"
self.bin_size_label.setHidden(hide_binning)
self.bin_size_spinBox.setHidden(hide_binning)
self.bin_step_label.setHidden(hide_binning)
self.bin_step_spinBox.setHidden(hide_binning)
Loading