slaclab / pydm

Python Display Manager
http://slaclab.github.io/pydm/
Other
112 stars 77 forks source link

consistency problems #577

Open prjemian opened 4 years ago

prjemian commented 4 years ago

One of the things I love about Qt is the consistency of the attribute names across the widgets. Inconsistency as shown below is troublesome as I develop a translator for screens defined with a different program. Here are the ones I've found so far.

PyDMScaleIndicator PyDMSlider meaning
userDefinedLimits userDefinedLimits use limits defined by the user and not from the channel
limitsFromChannel ? redundant with not userDefinedLimits
userUpperLimit userMaximum highest value
userLowerLimit userMinimum lowest value

It may be too late to make these consistent, but maybe not?

hhslepicka commented 4 years ago

@prjemian it is not late at all. Qt offers a nice feature in which we can make properties be Designable=False and create a new one with the proper name and make it compatible with existing screens.

prjemian commented 4 years ago

I'd love to avoid the kind of code I just wrote:

            if qw.attrib["class"] == "PyDMScaleIndicator":
                self.writePropertyBoolean(qw, "limitsFromChannel", False, stdset="0")
                hiLimitName = "userUpperLimit"
                loLimitName = "userLowerLimit"
            elif qw.attrib["class"] == "PyDMSlider":
                hiLimitName = "userMaximum"
                loLimitName = "userMinimum"
prjemian commented 4 years ago

That sad block of code just grew another case:

            if qw.attrib["class"] == "PyDMScaleIndicator":
                self.writePropertyBoolean(qw, "limitsFromChannel", False, stdset="0")
                hiLimitName = "userUpperLimit"
                loLimitName = "userLowerLimit"
            elif qw.attrib["class"] == "PyDMSlider":
                hiLimitName = "userMaximum"
                loLimitName = "userMinimum"
            elif qw.attrib["class"] == "PyDMSpinbox":
                hiLimitName = "maximum"
                loLimitName = "minimum"

where the new names come from the underlying QDoubleSpinBox. If I were going to make a consistent set of names, it would be maximum and minimum. Those come from Qt and also seem quite reasonable descriptions of what is intended.

klauer commented 2 years ago

(May be a codeathon-addressable issue - with a nudge from @prjemian)

prjemian commented 2 years ago

@Ryan-McClanahan: I agree with your suggestion to use userMaximum and userMinimum.