def save(self):
# We start off by getting the name in the text field
name = self.saveNameField.text()
# If the name is not given, then we will not continue and we'll warn the user
# The strip method will remove empty characters from the string, so that if the user entered spaces, it won't be valid
if not name.strip():
cmds.warning("You must give a name!")
return
# We use our library to save with the given name
self.library.save(name)
# Then we repopulate our UI with the new data
self.populate()
# And finally, lets remove the text in the name field so that they don't accidentally overwrite the file
self.saveNameField.setText('')
评论列表
文章目录