aboutsummaryrefslogtreecommitdiff
path: root/src/presetmanager.py
diff options
context:
space:
mode:
authortassaron2017-06-25 19:38:58 -0400
committertassaron2017-06-25 19:38:58 -0400
commit4eb2bc9a41f0c066cf3d6493c0b3c829e66dc74a (patch)
tree7c858968be00b9dba7928d1155f4b3b266c8ae1f /src/presetmanager.py
parent9fe370d472b84a693187316716bf7201df930b0c (diff)
preset delete, rename, save updates both windows
Diffstat (limited to 'src/presetmanager.py')
-rw-r--r--src/presetmanager.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/presetmanager.py b/src/presetmanager.py
index 3ab49ef..300b534 100644
--- a/src/presetmanager.py
+++ b/src/presetmanager.py
@@ -158,7 +158,9 @@ class PresetManager(QtWidgets.QDialog):
self.createNewPreset(
componentName, vers, newName,
saveValueStore, window=self.parent.window)
- self.openPreset(newName)
+ self.findPresets()
+ self.drawPresetList()
+ self.openPreset(newName, index)
break
def createNewPreset(
@@ -184,11 +186,11 @@ class PresetManager(QtWidgets.QDialog):
return False
- def openPreset(self, presetName):
+ def openPreset(self, presetName, compPos=None):
componentList = self.parent.window.listWidget_componentList
selectedComponents = self.parent.core.selectedComponents
- index = componentList.currentRow()
+ index = compPos if compPos is not None else componentList.currentRow()
if index == -1:
return
componentName = str(selectedComponents[index]).strip()
@@ -218,6 +220,10 @@ class PresetManager(QtWidgets.QDialog):
self.findPresets()
self.drawPresetList()
+ for i, comp in enumerate(self.core.selectedComponents):
+ if comp.currentPreset == name:
+ self.clearPreset(i)
+
def deletePreset(self, comp, vers, name):
filepath = os.path.join(self.presetDir, comp, str(vers), name)
os.remove(filepath)
@@ -260,6 +266,11 @@ class PresetManager(QtWidgets.QDialog):
os.rename(oldPath, newPath)
self.findPresets()
self.drawPresetList()
+
+ for i, comp in enumerate(self.core.selectedComponents):
+ if comp.currentPreset == oldName:
+ comp.currentPreset = newName
+ self.parent.updateComponentTitle(i, True)
break
def openImportDialog(self):