aboutsummaryrefslogtreecommitdiff
path: root/src/presetmanager.py
diff options
context:
space:
mode:
authortassaron2017-07-23 01:53:54 -0400
committertassaron2017-07-23 01:53:54 -0400
commitbf0890e7c87c730b8970c1a20c5b6a9a1a55d203 (patch)
treebc66d222a5f04598db97df419f5affa35b723f6f /src/presetmanager.py
parent450b944b87487aa60a935bbeee3908e2a62cd45b (diff)
components auto-connect & track widgets, less autosave spam
importing toolkit from live interpreter now works
Diffstat (limited to 'src/presetmanager.py')
-rw-r--r--src/presetmanager.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/presetmanager.py b/src/presetmanager.py
index 64e2203..643e180 100644
--- a/src/presetmanager.py
+++ b/src/presetmanager.py
@@ -6,7 +6,8 @@ from PyQt5 import QtCore, QtWidgets
import string
import os
-import toolkit
+from toolkit import badName
+from core import Core
class PresetManager(QtWidgets.QDialog):
@@ -151,7 +152,7 @@ class PresetManager(QtWidgets.QDialog):
currentPreset
)
if OK:
- if toolkit.badName(newName):
+ if badName(newName):
self.warnMessage(self.parent.window)
continue
if newName:
@@ -236,7 +237,6 @@ class PresetManager(QtWidgets.QDialog):
os.remove(filepath)
def warnMessage(self, window=None):
- print(window)
self.parent.showMessage(
msg='Preset names must contain only letters, '
'numbers, and spaces.',
@@ -272,7 +272,7 @@ class PresetManager(QtWidgets.QDialog):
self.presetRows[index][2]
)
if OK:
- if toolkit.badName(newName):
+ if badName(newName):
self.warnMessage()
continue
if newName:
@@ -289,7 +289,7 @@ class PresetManager(QtWidgets.QDialog):
self.findPresets()
self.drawPresetList()
for i, comp in enumerate(self.core.selectedComponents):
- if toolkit.getPresetDir(comp) == path \
+ if getPresetDir(comp) == path \
and comp.currentPreset == oldName:
self.core.openPreset(newPath, i, newName)
self.parent.updateComponentTitle(i, False)
@@ -338,3 +338,8 @@ class PresetManager(QtWidgets.QDialog):
def clearPresetListSelection(self):
self.window.listWidget_presets.setCurrentRow(-1)
+
+
+def getPresetDir(comp):
+ '''Get the preset subdir for a particular version of a component'''
+ return os.path.join(Core.presetDir, str(comp), str(comp.version))