aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/actions.py3
-rw-r--r--src/gui/mainwindow.py26
-rw-r--r--src/gui/presetmanager.py2
3 files changed, 24 insertions, 7 deletions
diff --git a/src/gui/actions.py b/src/gui/actions.py
index 1444569..f101bd7 100644
--- a/src/gui/actions.py
+++ b/src/gui/actions.py
@@ -3,6 +3,7 @@
'''
from PyQt5.QtWidgets import QUndoCommand
import os
+from copy import copy
from core import Core
@@ -132,7 +133,7 @@ class OpenPreset(QUndoCommand):
comp = self.parent.core.selectedComponents[compI]
self.store = comp.savePreset()
- self.store['preset'] = str(comp.currentPreset)
+ self.store['preset'] = copy(comp.currentPreset)
def redo(self):
self.parent._openPreset(self.presetName, self.compI)
diff --git a/src/gui/mainwindow.py b/src/gui/mainwindow.py
index 76c53af..833d2d1 100644
--- a/src/gui/mainwindow.py
+++ b/src/gui/mainwindow.py
@@ -387,30 +387,46 @@ class MainWindow(QtWidgets.QMainWindow):
@QtCore.pyqtSlot(int, dict)
def updateComponentTitle(self, pos, presetStore=False):
+ '''
+ Sets component title to modified or unmodified when given boolean.
+ If given a preset dict, compares it against the component to
+ determine if it is modified.
+ A component with no preset is always unmodified.
+ '''
if type(presetStore) is dict:
name = presetStore['preset']
if name is None or name not in self.core.savedPresets:
modified = False
else:
modified = (presetStore != self.core.savedPresets[name])
+ if modified:
+ log.verbose(
+ 'Differing values between presets: %s',
+ ", ".join([
+ '%s: %s' % item for item in presetStore.items()
+ if val != self.core.savedPresets[name][key]
+ ])
+ )
else:
modified = bool(presetStore)
if pos < 0:
pos = len(self.core.selectedComponents)-1
- name = str(self.core.selectedComponents[pos])
+ name = self.core.selectedComponents[pos].name
title = str(name)
if self.core.selectedComponents[pos].currentPreset:
title += ' - %s' % self.core.selectedComponents[pos].currentPreset
if modified:
title += '*'
if type(presetStore) is bool:
- log.debug('Forcing %s #%s\'s modified status to %s: %s' % (
+ log.debug(
+ 'Forcing %s #%s\'s modified status to %s: %s',
name, pos, modified, title
- ))
+ )
else:
- log.debug('Setting %s #%s\'s title: %s' % (
+ log.debug(
+ 'Setting %s #%s\'s title: %s',
name, pos, title
- ))
+ )
self.window.listWidget_componentList.item(pos).setText(title)
def updateCodecs(self):
diff --git a/src/gui/presetmanager.py b/src/gui/presetmanager.py
index befa7cd..2445760 100644
--- a/src/gui/presetmanager.py
+++ b/src/gui/presetmanager.py
@@ -210,7 +210,7 @@ class PresetManager(QtWidgets.QDialog):
def _openPreset(self, presetName, index):
selectedComponents = self.core.selectedComponents
- componentName = str(selectedComponents[index]).strip()
+ componentName = selectedComponents[index].name.strip()
version = selectedComponents[index].version
dirname = os.path.join(self.presetDir, componentName, str(version))
filepath = os.path.join(dirname, presetName)