mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-29 10:50:34 +05:00
best warning test qlineedit (for float value)
This commit is contained in:
parent
e7fd27bf38
commit
c4c5fe1af4
@ -78,24 +78,28 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
|||||||
#v1.setTop(10000.)
|
#v1.setTop(10000.)
|
||||||
v1.setDecimals(4)
|
v1.setDecimals(4)
|
||||||
self.SP_MinHoleSize.setValidator(v1)
|
self.SP_MinHoleSize.setValidator(v1)
|
||||||
|
self.SP_MinHoleSize.titleForWarning="MinHoleSize"
|
||||||
|
|
||||||
v2=QDoubleValidator(self)
|
v2=QDoubleValidator(self)
|
||||||
v2.setBottom(0.)
|
v2.setBottom(0.)
|
||||||
#v2.setTop(10000.)
|
#v2.setTop(10001.)
|
||||||
v2.setDecimals(4)
|
v2.setDecimals(4)
|
||||||
self.SP_ToleranceDisplacement.setValidator(v2)
|
self.SP_ToleranceDisplacement.setValidator(v2)
|
||||||
|
self.SP_ToleranceDisplacement.titleForWarning="ToleranceDisplacement"
|
||||||
|
|
||||||
v3=QDoubleValidator(self)
|
v3=QDoubleValidator(self)
|
||||||
v3.setBottom(0.)
|
v3.setBottom(0.)
|
||||||
#v3.setTop(10000.)
|
#v3.setTop(10000.)
|
||||||
v3.setDecimals(4)
|
v3.setDecimals(4)
|
||||||
self.SP_ResolutionLength.setValidator(v3)
|
self.SP_ResolutionLength.setValidator(v3)
|
||||||
|
self.SP_ResolutionLength.titleForWarning="ResolutionLength"
|
||||||
|
|
||||||
v4=QDoubleValidator(self)
|
v4=QDoubleValidator(self)
|
||||||
v4.setBottom(0.)
|
v4.setBottom(0.)
|
||||||
#v4.setTop(10000.)
|
#v4.setTop(10000.)
|
||||||
v4.setDecimals(4)
|
v4.setDecimals(4)
|
||||||
self.SP_OverlapDistance.setValidator(v4)
|
self.SP_OverlapDistance.setValidator(v4)
|
||||||
|
self.SP_OverlapDistance.titleForWarning="OverlapDistance"
|
||||||
|
|
||||||
self.resize(800, 500)
|
self.resize(800, 500)
|
||||||
self.clean()
|
self.clean()
|
||||||
@ -253,12 +257,30 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def SP_toStr(self, widget):
|
def SP_toStr(self, widget):
|
||||||
|
"""only for a QLineEdit widget"""
|
||||||
#cr, pos=widget.validator().validate(res, 0) #n.b. "1,3" is acceptable !locale!
|
#cr, pos=widget.validator().validate(res, 0) #n.b. "1,3" is acceptable !locale!
|
||||||
try:
|
try:
|
||||||
return str(float(widget.text()))
|
val=float(widget.text())
|
||||||
except:
|
except:
|
||||||
widget.setProperty("text", "0.0")
|
QMessageBox.warning(self, widget.titleForWarning, "float value is incorrect: '"+widget.text()+"'")
|
||||||
return "0.0"
|
res=str(widget.validator().bottom())
|
||||||
|
widget.setProperty("text", res)
|
||||||
|
return res
|
||||||
|
valtest=widget.validator().bottom()
|
||||||
|
if valtest!=None:
|
||||||
|
if val<valtest:
|
||||||
|
QMessageBox.warning(self, widget.titleForWarning, "float value is under minimum: "+str(val)+" < "+str(valtest))
|
||||||
|
res=str(valtest)
|
||||||
|
widget.setProperty("text", res)
|
||||||
|
return res
|
||||||
|
valtest=widget.validator().top()
|
||||||
|
if valtest!=None:
|
||||||
|
if val>valtest:
|
||||||
|
QMessageBox.warning(self, widget.titleForWarning, "float value is over maximum: "+str(val)+" > "+str(valtest))
|
||||||
|
res=str(valtest)
|
||||||
|
widget.setProperty("text", res)
|
||||||
|
return res
|
||||||
|
return str(val)
|
||||||
|
|
||||||
def getResumeData(self, separator="\n"):
|
def getResumeData(self, separator="\n"):
|
||||||
text=""
|
text=""
|
||||||
|
@ -558,13 +558,13 @@ Default is computed from model.</string>
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>360</double>
|
<double>90</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<double>0</double>
|
<double>0</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<double>0.01</double>
|
<double>1</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<double>15</double>
|
<double>15</double>
|
||||||
@ -652,7 +652,7 @@ Default is computed from model.</string>
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>360</double>
|
<double>90</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<double>0</double>
|
<double>0</double>
|
||||||
|
Loading…
Reference in New Issue
Block a user