Skip to content

Commit

Permalink
Add controlo layout dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritiusdadd committed Mar 21, 2024
1 parent 92dfcc5 commit ff62a57
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/redmost/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ class GlobalState(Enum):
REUQUEST_CANCEL = 5


class ControlMappingDialog(qt_api.QtWidgets.QDialog):
control_table_widget: QtWidgets.QTableWidget


class AboutDialog(qt_api.QtWidgets.QDialog):

def __init__(
Expand Down Expand Up @@ -1026,6 +1030,11 @@ def __init__(self) -> None:
self.restoreSettings
)

self.control_mapping_wnd = cast(
ControlMappingDialog,
qt_api.loadUiWidget("control_mapping_dialog.ui")
)

self.main_wnd.setWindowTitle("redmost")
self.main_wnd.setWindowIcon(
qt_api.QtGui.QIcon(utils.get_data_file("redmost.png"))
Expand Down Expand Up @@ -1227,6 +1236,10 @@ def __init__(self) -> None:

# Connect signals

self.main_wnd.action_controls_layout.triggered.connect(
self.control_mapping_wnd.open
)

self.main_wnd.log_y_check_box.toggled.connect(
self.redrawCurrentSpec
)
Expand Down
2 changes: 1 addition & 1 deletion src/redmost/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def get_redshift_from_lines(
Best estimations of the redshift sorted from the most probable to the
least probable.
:return z_probs:
Pseudo-probabilities of the estimation (the higher the better).
Pseudo-probabilities of the estimation (the higher, the better).
"""
if len(identifications) < 2:
return None
Expand Down
219 changes: 219 additions & 0 deletions src/redmost/ui/control_mapping_dialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableWidget" name="control_table_widget">
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="showGrid">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="cornerButtonEnabled">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>310</number>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<row>
<property name="text">
<string>LMB</string>
</property>
</row>
<row>
<property name="text">
<string>RMB</string>
</property>
</row>
<row>
<property name="text">
<string>MMB</string>
</property>
</row>
<row>
<property name="text">
<string>MW</string>
</property>
</row>
<row>
<property name="text">
<string>SHIFT+MV</string>
</property>
</row>
<row>
<property name="text">
<string>CTRL+MV</string>
</property>
</row>
<column>
<property name="text">
<string>CONTROL</string>
</property>
</column>
<column>
<property name="text">
<string>ACTION</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>Left Mouse Button (LMB)</string>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string>Select area to zoom; Add a new line</string>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>Right Mouse Button (RMB)</string>
</property>
</item>
<item row="1" column="1">
<property name="text">
<string>Nothing</string>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>Middle Mouse Button (MMB)</string>
</property>
</item>
<item row="2" column="1">
<property name="text">
<string>Pan</string>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>Mouse Wheel (MW)</string>
</property>
</item>
<item row="3" column="1">
<property name="text">
<string>Vertical scroll</string>
</property>
</item>
<item row="4" column="0">
<property name="text">
<string>SHIFT + MW</string>
</property>
</item>
<item row="4" column="1">
<property name="text">
<string>Horizontal scroll</string>
</property>
</item>
<item row="5" column="0">
<property name="text">
<string>CTRL + MV</string>
</property>
</item>
<item row="5" column="1">
<property name="text">
<string>Zoom</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="button_box">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>button_box</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>button_box</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
2 changes: 1 addition & 1 deletion src/redmost/ui/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ li.checked::marker { content: &quot;\2612&quot;; }
</action>
<action name="action_import_zcat">
<property name="text">
<string>Import spectroscopi &amp;catalogue</string>
<string>Import spectroscopic &amp;catalogue</string>
</property>
</action>
<action name="action_export_zcat">
Expand Down

0 comments on commit ff62a57

Please sign in to comment.