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

FIX: make setpoint work for original positioner widget, adjust sizing #586

Merged
merged 3 commits into from
Sep 15, 2023

Conversation

ZLLentz
Copy link
Member

@ZLLentz ZLLentz commented Sep 12, 2023

Description

Fixes an issue where the setpoint widgets for the detailed views were coming up with zero width.

The root cause of the issue was that the sizing of the user_setpoint placeholder widget was set to the defaults, so the setMinimumWidth call was setting the minimum width of the combobox to 0.

The reason why these various widgets refuse to expand here despite having their size policy set to "Expanding" eludes me, so I've set them to fixed with.

This also incidentally combines some previously diverging code paths that fixes a sizing issue where the detailed view had a vestigial/unused pydm line edit taking up space.

Motivation and Context

closes #585

How Has This Been Tested?

Interactively only

Where Has This Been Documented?

I need to make a release notes docs entry

Screenshots (if appropriate):

Master:
image

This PR:
image

Copy link
Contributor

@tangkong tangkong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me, good catch. Had a few questions but no problems with the contents at large

<height>25</height>
</size>
</property>
<property name="maximumSize">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With dynamic sizing I wonder if setting maximum sizes will ever come back to bite us. Admittedly I don't remember enough of the dynamic sizing details to answer this myself...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out that these input sub-widgets don't resize at all anyway, even with the size policy set to "expanding". I don't have any idea why this is the case. Before I went to fixed mode, the widget wasn't even taking up all of the available space.

In addition:
For the row widget: we want the readback to expand instead of the setpoint
For the square widget: we don't want anything to resize, e.g. we don't want to see the whole middle section balloon out and we don't want the square to stretch up and down.

self.ui.setpoint_layout.addWidget(
self.ui.set_value,
alignment=QtCore.Qt.AlignHCenter,
)
self.ui.set_value.setObjectName('set_value')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know Ken was doing this for testing, but should we be doing this more uniformly in our UI's? What does setting the object name here do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two things this does:

  1. The widget now has a name when inspected via gammaray. This is the only reason I did this here, technically I could remove it. I suspect this could also be helpful for tracebacks/other debug like Ken was doing for testing.
  2. There are some qt functions for collecting child widgets based on their name: https://doc.qt.io/qt-6/qobject.html#findChild, and they use this qt object name rather than the python attribute name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, it can be used as a method of differentiating widgets in the stylesheet

@ZLLentz ZLLentz merged commit 5535282 into pcdshub:master Sep 15, 2023
9 checks passed
@ZLLentz ZLLentz deleted the fix_positioner_setpoint branch September 15, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

State positioner devices in the non-row (classic?) form do not get visible combo boxes.
3 participants