@@ -44,7 +44,8 @@ def command_created(args: adsk.core.CommandCreatedEventArgs):
44
44
OPTIONS .restoreDefaults ()
45
45
INPUTS = args .command .commandInputs
46
46
47
- args .command .setDialogInitialSize (400 , 500 )
47
+ args .command .setDialogMinimumSize (400 , 450 )
48
+ args .command .setDialogSize (400 , 450 )
48
49
49
50
initializeInputs ()
50
51
enableDisableInputs ()
@@ -83,9 +84,9 @@ def onCommandInputChanged(args: adsk.core.InputChangedEventArgs):
83
84
OPTIONS .restoreDefaults ()
84
85
updateInputsFromOptions ()
85
86
elif changedInputId == 'saveDefaults' :
86
- OPTIONS .saveDefaults ()
87
+ if not OPTIONS .saveDefaults (): ui . messageBox ( f'Unable to save defaults file { OPTIONS . persistFile } . Is it writable?' , 'Warning' )
87
88
elif changedInputId == 'eraseDefaults' :
88
- OPTIONS .eraseDefaults ()
89
+ if not OPTIONS .eraseDefaults (): ui . messageBox ( f'Unable to erase defaults file { OPTIONS . persistFile } . Is it writable?' , 'Warning' )
89
90
90
91
# This event handler is called when the user interacts with any of the inputs in the dialog
91
92
# which allows you to verify that all of the inputs are valid and enables the OK button.
@@ -139,15 +140,14 @@ def initializeInputs():
139
140
supportGroup .children .addValueInput ('supportShellWallThickness' , 'Shell wall thickness' , defaultLengthUnits , adsk .core .ValueInput .createByReal (OPTIONS .supportShellWallThickness ))
140
141
141
142
# Save, restore and erase defaults
142
- restoreDefaultsInput = INPUTS .addBoolValueInput ('restoreDefaults' , 'Reset' , False , '' , False )
143
- restoreDefaultsInput .text = 'Reset all panel settings to defaults'
144
-
145
- persistGroup = INPUTS .addGroupCommandInput ('persistGroup' , 'Save defaults' )
146
- persistGroup .isExpanded = False
143
+ persistGroup = INPUTS .addGroupCommandInput ('persistGroup' , 'Defaults' )
144
+ persistGroup .isExpanded = True
145
+ restoreDefaultsInput = persistGroup .children .addBoolValueInput ('restoreDefaults' , 'Reset' , False , '' , False )
146
+ restoreDefaultsInput .text = 'Reset all inputs to default values'
147
147
saveDefaultsInput = persistGroup .children .addBoolValueInput ('saveDefaults' , 'Update defaults' , False , '' , False )
148
- saveDefaultsInput .text = 'Save current panel settings as new defaults'
148
+ saveDefaultsInput .text = 'Save current input values as new defaults'
149
149
eraseDefaultsInput = persistGroup .children .addBoolValueInput ('eraseDefaults' , 'Factory reset' , False , '' , False )
150
- eraseDefaultsInput .text = 'Erase saved panel settings defaults'
150
+ eraseDefaultsInput .text = 'Erase saved input value defaults'
151
151
152
152
message = 'Does this add-in save you time? Say thanks by <a href="https://buymeacoffee.com/benalman">buying me a coffee.</a>'
153
153
coffeeTextBox = INPUTS .addTextBoxCommandInput ('coffeeTextBox' , 'Thanks' , message , 1 , True )
0 commit comments