Open prjemian opened 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.
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"
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.
(May be a codeathon-addressable issue - with a nudge from @prjemian)
@Ryan-McClanahan: I agree with your suggestion to use userMaximum
and userMinimum
.
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.
userDefinedLimits
userDefinedLimits
limitsFromChannel
not userDefinedLimits
userUpperLimit
userMaximum
userLowerLimit
userMinimum
It may be too late to make these consistent, but maybe not?