Smart rotation panel: Make it looking a bit nicer
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from PySide6.QtCore import Slot, Qt
|
||||
from PySide6.QtWidgets import QWidget, QGridLayout, QLabel, QFrame, QPushButton
|
||||
from PySide6.QtWidgets import QWidget, QGridLayout, QLabel, QFrame, QPushButton, QSpacerItem, QSizePolicy
|
||||
|
||||
from aaredaqlib.models import DAQStatusModel
|
||||
from aaregui.widgets.number_line_edit import NumberLineEdit
|
||||
@@ -12,9 +12,7 @@ class SimpleRotationSettingsPanel(QWidget):
|
||||
self.__d = None
|
||||
|
||||
self._layout = QGridLayout(self)
|
||||
self._layout.setContentsMargins(4, 4, 4, 4)
|
||||
self._layout.setHorizontalSpacing(6)
|
||||
self._layout.setVerticalSpacing(4)
|
||||
|
||||
# Visible resolution (entry)
|
||||
self._layout.addWidget(QLabel("Visible resolution", parent=self), 0, 0)
|
||||
self.visible_res_enter = NumberLineEdit(
|
||||
@@ -56,6 +54,7 @@ class SimpleRotationSettingsPanel(QWidget):
|
||||
self.transmission_label = QLabel("--", parent=self)
|
||||
self.transmission_label.setAlignment(Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter)
|
||||
self._layout.addWidget(self.transmission_label, 5, 1, 1, 3)
|
||||
self._layout.addWidget(QLabel("%", parent=self), 5, 4)
|
||||
|
||||
self._layout.addWidget(QLabel("Detector distance", parent=self), 6, 0)
|
||||
self.dtz_label = QLabel(f"--", parent=self)
|
||||
@@ -63,10 +62,14 @@ class SimpleRotationSettingsPanel(QWidget):
|
||||
self._layout.addWidget(self.dtz_label, 6, 1, 1, 3)
|
||||
self._layout.addWidget(QLabel("mm", parent=self), 6, 4)
|
||||
|
||||
# add vertical stretch between detector distance and the run button
|
||||
self._layout.addItem(QSpacerItem(0, 0, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding), 7, 0, 1, 6)
|
||||
|
||||
# Run rotation button
|
||||
self.run_rotation_button = QPushButton("Run rotation", parent=self)
|
||||
self.run_rotation_button.setStyleSheet("color: rgb(78, 154, 6);")
|
||||
self._layout.addWidget(self.run_rotation_button, 7, 0, 1, 6)
|
||||
self._layout.addWidget(self.run_rotation_button, 8, 0, 1, 6)
|
||||
|
||||
@Slot(DAQStatusModel)
|
||||
def update_daq_status(self, s: DAQStatusModel):
|
||||
self.__d = s
|
||||
@@ -85,7 +88,7 @@ class SimpleRotationSettingsPanel(QWidget):
|
||||
total_angle = self.angular_range_enter.value
|
||||
d_vis = self.visible_res_enter.value
|
||||
d_tar = 1/(1/d_vis + 0.1)
|
||||
self.target_res_label.setText(f"{d_tar}")
|
||||
self.target_res_label.setText(f"{d_tar:.2f}")
|
||||
|
||||
Kdose = 2000 / (self.__d.diffraction.wavelength_angstrom**2)
|
||||
dose_rate_MGy_s = (flux / (self.__d.geom.beam_size_mm.x * 1000 * self.__d.geom.beam_size_mm.y * 1000 * Kdose)) / 1e6
|
||||
@@ -103,6 +106,12 @@ class SimpleRotationSettingsPanel(QWidget):
|
||||
|
||||
dtz = self.__d.diffraction.calc_dtz_mm(d_tar)
|
||||
|
||||
self.transmission_label.setText(f"{transmission * 100:.1f}%")
|
||||
self.transmission_label.setText(f"{transmission * 100:.1f}")
|
||||
self.image_time_label.setText(f"{image_time_s:.4f}")
|
||||
self.dtz_label.setText(f"{dtz:.2f}")
|
||||
|
||||
if dtz <= 0.0:
|
||||
self.dtz_label.setText(f"""<span style="color: red ; ">-</span>""")
|
||||
elif dtz < self.__d.bl.dtz_min:
|
||||
self.dtz_label.setText(f"""<span style="color: red ; ">{dtz:.2f}</span>""")
|
||||
else:
|
||||
self.dtz_label.setText(f"{dtz:.2f}")
|
||||
|
||||
Reference in New Issue
Block a user