Merge pull request #937 from MikeTheWatchGuy/Dev-latest
Spinner - add protection against bad key being provided
This commit is contained in:
commit
589ee63b9f
|
@ -1003,8 +1003,11 @@ class Spin(Element):
|
||||||
# self.QT_Spinner.setRange(self.Values[0], self.Values[1])
|
# self.QT_Spinner.setRange(self.Values[0], self.Values[1])
|
||||||
if value is not None:
|
if value is not None:
|
||||||
# self.QT_Spinner.setValue(value)
|
# self.QT_Spinner.setValue(value)
|
||||||
|
try:
|
||||||
self.QT_Spinner.setValue(self.QT_Spinner.valueFromText(value))
|
self.QT_Spinner.setValue(self.QT_Spinner.valueFromText(value))
|
||||||
self.DefaultValue = value
|
self.DefaultValue = value
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if disabled == True:
|
if disabled == True:
|
||||||
self.QT_Spinner.setDisabled(True)
|
self.QT_Spinner.setDisabled(True)
|
||||||
elif disabled == False:
|
elif disabled == False:
|
||||||
|
@ -4912,13 +4915,13 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
||||||
qt_row_layout.addWidget(element.QT_Radio_Button)
|
qt_row_layout.addWidget(element.QT_Radio_Button)
|
||||||
# ------------------------- INPUT SPIN Box element ------------------------- #
|
# ------------------------- INPUT SPIN Box element ------------------------- #
|
||||||
elif element_type == ELEM_TYPE_INPUT_SPIN:
|
elif element_type == ELEM_TYPE_INPUT_SPIN:
|
||||||
width, height = element_size
|
# element.QT_Spinner = QSpinBox()
|
||||||
width = 0 if auto_size_text else element_size[0]
|
|
||||||
element.QT_Spinner = QSpinBox()
|
|
||||||
element.QT_Spinner = Spin.StringBox(element.Values)
|
element.QT_Spinner = Spin.StringBox(element.Values)
|
||||||
if element.DefaultValue is not None:
|
if element.DefaultValue is not None: # try to set the default value without crashing on error
|
||||||
print(element.DefaultValue)
|
try:
|
||||||
element.QT_Spinner.setValue(element.QT_Spinner.valueFromText(element.DefaultValue))
|
element.QT_Spinner.setValue(element.QT_Spinner.valueFromText(element.DefaultValue))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
style = 'QSpinBox {'
|
style = 'QSpinBox {'
|
||||||
style += create_style_from_font(font)
|
style += create_style_from_font(font)
|
||||||
if element.TextColor is not None:
|
if element.TextColor is not None:
|
||||||
|
|
Loading…
Reference in New Issue