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

Add option to clear panel buffer #1248

Merged
merged 2 commits into from
Jun 20, 2022
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
10 changes: 10 additions & 0 deletions hexrd/ui/calibration/panel_buffer_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, detector, parent=None):
def setup_connections(self):
self.ui.select_file_button.pressed.connect(self.select_file)
self.ui.config_mode.currentIndexChanged.connect(self.update_mode_tab)
self.ui.clear_panel_buffer.clicked.connect(self.clear_panel_buffer)
self.ui.accepted.connect(self.on_accepted)
self.ui.rejected.connect(self.on_rejected)

Expand Down Expand Up @@ -160,3 +161,12 @@ def mode(self, v):
def update_mode_tab(self):
mode_tab = getattr(self.ui, self.mode + '_tab')
self.ui.tab_widget.setCurrentWidget(mode_tab)

def clear_panel_buffer(self):
# Clear the config options on the internal config
detector_config = HexrdConfig().detector(self.detector)

buffer_default = {'status': 0}
buffer = detector_config.setdefault('buffer', buffer_default)

buffer['value'] = buffer['value'] = [0., 0.]
psavery marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions hexrd/ui/resources/ui/panel_buffer_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@
</item>
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="clear_panel_buffer">
<property name="text">
<string>Clear Panel Buffer</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="button_box">
<property name="standardButtons">
Expand Down Expand Up @@ -234,5 +241,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>clear_panel_buffer</sender>
<signal>clicked()</signal>
<receiver>detector_panel_buffer</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>76</x>
<y>273</y>
</hint>
<hint type="destinationlabel">
<x>238</x>
<y>147</y>
</hint>
</hints>
</connection>
</connections>
</ui>