preset delete, rename, save updates both windows
This commit is contained in:
parent
9fe370d472
commit
4eb2bc9a41
|
@ -152,7 +152,7 @@ class Component(__base__.Component):
|
||||||
brush = QtGui.QLinearGradient(
|
brush = QtGui.QLinearGradient(
|
||||||
self.LG_start,
|
self.LG_start,
|
||||||
self.LG_start,
|
self.LG_start,
|
||||||
self.LG_start+width/3,
|
self.LG_end+width/3,
|
||||||
self.LG_end)
|
self.LG_end)
|
||||||
|
|
||||||
elif self.fillType == 2: # Radial Gradient
|
elif self.fillType == 2: # Radial Gradient
|
||||||
|
|
|
@ -158,7 +158,9 @@ class PresetManager(QtWidgets.QDialog):
|
||||||
self.createNewPreset(
|
self.createNewPreset(
|
||||||
componentName, vers, newName,
|
componentName, vers, newName,
|
||||||
saveValueStore, window=self.parent.window)
|
saveValueStore, window=self.parent.window)
|
||||||
self.openPreset(newName)
|
self.findPresets()
|
||||||
|
self.drawPresetList()
|
||||||
|
self.openPreset(newName, index)
|
||||||
break
|
break
|
||||||
|
|
||||||
def createNewPreset(
|
def createNewPreset(
|
||||||
|
@ -184,11 +186,11 @@ class PresetManager(QtWidgets.QDialog):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def openPreset(self, presetName):
|
def openPreset(self, presetName, compPos=None):
|
||||||
componentList = self.parent.window.listWidget_componentList
|
componentList = self.parent.window.listWidget_componentList
|
||||||
selectedComponents = self.parent.core.selectedComponents
|
selectedComponents = self.parent.core.selectedComponents
|
||||||
|
|
||||||
index = componentList.currentRow()
|
index = compPos if compPos is not None else componentList.currentRow()
|
||||||
if index == -1:
|
if index == -1:
|
||||||
return
|
return
|
||||||
componentName = str(selectedComponents[index]).strip()
|
componentName = str(selectedComponents[index]).strip()
|
||||||
|
@ -218,6 +220,10 @@ class PresetManager(QtWidgets.QDialog):
|
||||||
self.findPresets()
|
self.findPresets()
|
||||||
self.drawPresetList()
|
self.drawPresetList()
|
||||||
|
|
||||||
|
for i, comp in enumerate(self.core.selectedComponents):
|
||||||
|
if comp.currentPreset == name:
|
||||||
|
self.clearPreset(i)
|
||||||
|
|
||||||
def deletePreset(self, comp, vers, name):
|
def deletePreset(self, comp, vers, name):
|
||||||
filepath = os.path.join(self.presetDir, comp, str(vers), name)
|
filepath = os.path.join(self.presetDir, comp, str(vers), name)
|
||||||
os.remove(filepath)
|
os.remove(filepath)
|
||||||
|
@ -260,6 +266,11 @@ class PresetManager(QtWidgets.QDialog):
|
||||||
os.rename(oldPath, newPath)
|
os.rename(oldPath, newPath)
|
||||||
self.findPresets()
|
self.findPresets()
|
||||||
self.drawPresetList()
|
self.drawPresetList()
|
||||||
|
|
||||||
|
for i, comp in enumerate(self.core.selectedComponents):
|
||||||
|
if comp.currentPreset == oldName:
|
||||||
|
comp.currentPreset = newName
|
||||||
|
self.parent.updateComponentTitle(i, True)
|
||||||
break
|
break
|
||||||
|
|
||||||
def openImportDialog(self):
|
def openImportDialog(self):
|
||||||
|
|
Reference in New Issue