mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Only write scripts to stack upon pressing close button
This is more efficient, because we're not writing every time you modify the list of scripts. It's also more complete, since if you don't modify the list of scripts but just modify one of the settings, that setting change also gets written to the stack after closing the window.
This commit is contained in:
parent
bebcd78db0
commit
927f193270
2 changed files with 11 additions and 2 deletions
|
@ -39,7 +39,7 @@ class PostProcessingPlugin(QObject, Extension):
|
|||
Application.getInstance().getOutputDeviceManager().writeStarted.connect(self.execute)
|
||||
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged) #When the current printer changes, update the list of scripts.
|
||||
Application.getInstance().mainWindowChanged.connect(self._createView) #When the main window is created, create the view so that we can display the post-processing icon if necessary.
|
||||
self.scriptListChanged.connect(self._writeScriptsToStack) #Whenever there is a change, save it into the stack.
|
||||
#self.scriptListChanged.connect(self.writeScriptsToStack) #Whenever there is a change, save it into the stack.
|
||||
|
||||
selectedIndexChanged = pyqtSignal()
|
||||
@pyqtProperty("QVariant", notify = selectedIndexChanged)
|
||||
|
@ -219,7 +219,8 @@ class PostProcessingPlugin(QObject, Extension):
|
|||
self.setSelectedScriptIndex(0)
|
||||
self.scriptListChanged.emit()
|
||||
|
||||
def _writeScriptsToStack(self):
|
||||
@pyqtSlot()
|
||||
def writeScriptsToStack(self):
|
||||
script_list_strs = []
|
||||
for script in self._script_list:
|
||||
parser = configparser.ConfigParser(interpolation = None) #We'll encode the script as a config with one section. The section header is the key and its values are the settings.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue