pydm icon indicating copy to clipboard operation
pydm copied to clipboard

consistency problems

Open prjemian opened this issue 6 years ago • 5 comments

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?

prjemian avatar Nov 15 '19 00:11 prjemian

@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.

hhslepicka avatar Nov 15 '19 00:11 hhslepicka

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 avatar Nov 15 '19 00:11 prjemian

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.

prjemian avatar Nov 15 '19 05:11 prjemian

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

klauer avatar May 10 '22 23:05 klauer

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

prjemian avatar May 10 '22 23:05 prjemian