Skip to content

Commit

Permalink
Merge pull request #586 from ZLLentz/fix_positioner_setpoint
Browse files Browse the repository at this point in the history
FIX: make setpoint work for original positioner widget, adjust sizing
  • Loading branch information
ZLLentz authored Sep 15, 2023
2 parents e767bb4 + cff5365 commit 5535282
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 30 deletions.
23 changes: 23 additions & 0 deletions docs/source/upcoming_release_notes/585-fix_positioner_setpoint.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
585 fix_positioner_setpoint
###########################

API Changes
-----------
- N/A

Features
--------
- N/A

Bugfixes
--------
- Fix an issue where setpoint widgets in the full positioner
widget had become zero-width.

Maintenance
-----------
- N/A

Contributors
------------
- zllentz
21 changes: 10 additions & 11 deletions typhos/positioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,25 +479,30 @@ def _define_setpoint_widget(self):
self.ui.set_value.addItems(setpoint_signal.enum_strs)
# Activated signal triggers only when the user selects an option
self.ui.set_value.activated.connect(self.set)
self.ui.set_value.setSizePolicy(
QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Fixed,
)
self.ui.set_value.setMinimumContentsLength(20)
self.ui.tweak_widget.setVisible(False)
else:
self.ui.set_value = QtWidgets.QLineEdit()
self.ui.set_value.setAlignment(QtCore.Qt.AlignCenter)
self.ui.set_value.returnPressed.connect(self.set)

self.ui.set_value.setSizePolicy(
QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Fixed,
)
self.ui.set_value.setMinimumWidth(
self.ui.user_setpoint.minimumWidth()
)
self.ui.set_value.setMaximumWidth(
self.ui.user_setpoint.maximumWidth()
)

self.ui.setpoint_layout.addWidget(
self.ui.set_value,
alignment=QtCore.Qt.AlignHCenter,
)
self.ui.set_value.setObjectName('set_value')
# Because set_value is used instead
self.ui.user_setpoint.setVisible(False)

@property
def device(self):
Expand Down Expand Up @@ -1053,12 +1058,6 @@ def update_status_visibility(
self.ui.error_label.setVisible(has_error)
self.ui.error_prefix.setVisible(has_error)

def _define_setpoint_widget(self):
super()._define_setpoint_widget()
if isinstance(self.ui.user_setpoint, QtWidgets.QLineEdit):
# Because set_value is used instead
self.ui.user_setpoint.setVisible(False)


def clear_error_in_background(device):
def inner():
Expand Down
71 changes: 52 additions & 19 deletions typhos/ui/widgets/positioner.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>343</width>
<height>212</height>
<width>369</width>
<height>277</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -319,17 +319,23 @@ Screen</string>
<item>
<widget class="PyDMLabel" name="user_readback">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<width>201</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>201</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string/>
</property>
Expand All @@ -350,17 +356,32 @@ Screen</string>
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="PyDMLineEdit" name="user_setpoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>201</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>0</width>
<height>0</height>
<width>201</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
Expand Down Expand Up @@ -397,9 +418,21 @@ Screen</string>
</item>
<item>
<widget class="QLineEdit" name="tweak_value">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<width>125</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>125</width>
<height>25</height>
</size>
</property>
Expand Down Expand Up @@ -473,7 +506,7 @@ Screen</string>
<string/>
</property>
<property name="text">
<string>error_label</string>
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand Down Expand Up @@ -718,16 +751,6 @@ Error</string>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>TyphosAlarmCircle</class>
<extends>QWidget</extends>
<header>typhos.alarm</header>
</customwidget>
<customwidget>
<class>TyphosRelatedSuiteButton</class>
<extends>QPushButton</extends>
<header>typhos.related_display</header>
</customwidget>
<customwidget>
<class>PyDMLabel</class>
<extends>QLabel</extends>
Expand All @@ -743,6 +766,16 @@ Error</string>
<extends>QLineEdit</extends>
<header>pydm.widgets.line_edit</header>
</customwidget>
<customwidget>
<class>TyphosAlarmCircle</class>
<extends>QWidget</extends>
<header>typhos.alarm</header>
</customwidget>
<customwidget>
<class>TyphosRelatedSuiteButton</class>
<extends>QPushButton</extends>
<header>typhos.related_display</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down

0 comments on commit 5535282

Please sign in to comment.