summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dialogs.py10
-rw-r--r--src/editorui/doodads.py29
-rw-r--r--src/ui.py33
3 files changed, 48 insertions, 24 deletions
diff --git a/src/dialogs.py b/src/dialogs.py
index 0419f4f..54f5de8 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -82,10 +82,11 @@ class KPAnimationPresetChooser(QtGui.QDialog):
self.chooser = QtGui.QListWidget()
settings = KP.app.settings
+ import mapfile
if settings.contains('AnimationPresets'):
- self.presetList = settings.value('AnimationPresets').toPyObject()
- self.presets = settings.value('AnimationPresetData').toPyObject()
+ self.presetList = mapfile.load(str(settings.value('AnimationPresets').toPyObject()))
+ self.presets = mapfile.load(str(settings.value('AnimationPresetData').toPyObject()))
else:
self.presetList = ["Circle", "Wiggle", "Drifting Cloud"]
@@ -100,9 +101,8 @@ class KPAnimationPresetChooser(QtGui.QDialog):
["Loop", "Sinusoidial", 200.0, "Y Position", 10.0, -10.0],
["Reversible Loop", "Linear", 500.0, "Opacity", 80.0, 40.0]] ]
-
- settings.setValue('AnimationPresets', self.presetList)
- settings.setValue('AnimationPresetData', self.presets)
+ settings.setValue('AnimationPresets', mapfile.dump(self.presetList))
+ settings.setValue('AnimationPresetData', mapfile.dump(self.presets))
self.chooser.addItems(self.presetList)
diff --git a/src/editorui/doodads.py b/src/editorui/doodads.py
index d7f767f..7b9e222 100644
--- a/src/editorui/doodads.py
+++ b/src/editorui/doodads.py
@@ -129,15 +129,21 @@ class KPEditorDoodad(KPEditorItem):
# Add/Remove Animation Buttons
- addbutton = QtGui.QPushButton("Add Animation")
- rembutton = QtGui.QPushButton("Remove Animation")
- presetbutton = QtGui.QPushButton("Add Preset")
- newpbutton = QtGui.QPushButton("New Preset")
+ addbutton = QtGui.QPushButton(QtGui.QIcon("Resources/Plus.png"), "")
+ rembutton = QtGui.QPushButton(QtGui.QIcon("Resources/Minus.png"), "")
+ presetbutton = QtGui.QPushButton(QtGui.QIcon("Resources/AddPreset.png"), "Add Preset")
+ newpbutton = QtGui.QPushButton(QtGui.QIcon("Resources/NewPreset.png"), "New Preset")
+ # savebutton = QtGui.QPushButton(QtGui.QIcon("Resources/SavePreset.png"), "Save")
+ # loadbutton = QtGui.QPushButton(QtGui.QIcon("Resources/LoadPreset.png"), "Load")
+ # clearbutton = QtGui.QPushButton(QtGui.QIcon("Resources/ClearPreset.png"), "Clear")
BottomLayout.addWidget(addbutton, 1, 0, 1, 1)
BottomLayout.addWidget(rembutton, 1, 1, 1, 1)
BottomLayout.addWidget(QtGui.QLabel(""), 1, 2, 1, 2)
BottomLayout.addWidget(presetbutton, 1, 4, 1, 1)
BottomLayout.addWidget(newpbutton, 1, 5, 1, 1)
+ # BottomLayout.addWidget(savebutton, 1, 6, 1, 1)
+ # BottomLayout.addWidget(loadbutton, 1, 7, 1, 1)
+ # BottomLayout.addWidget(clearbutton, 1, 8, 1, 1)
# Annnnndddd we're spent.
@@ -148,13 +154,15 @@ class KPEditorDoodad(KPEditorItem):
presetbutton.released.connect(self.selectPreset)
newpbutton.released.connect(self.addToPreset)
+ # savebutton.released.connect(KP.mainWindow.saveAnimPresets)
+ # loadbutton.released.connect(KP.mainWindow.loadAnimPresets)
+ # clearbutton.released.connect(KP.mainWindow.clearAnimPresets)
def sizeHint(self):
return QtCore.QSize(591,300)
-
def addAnmItem(self):
itemA = QtGui.QStandardItem()
@@ -229,11 +237,12 @@ class KPEditorDoodad(KPEditorItem):
preset.append(listrow)
settings = KP.app.settings
-
+ import mapfile
+
if settings.contains('AnimationPresets'):
- presetList = settings.value('AnimationPresets').toPyObject()
- presets = settings.value('AnimationPresetData').toPyObject()
+ presetList = mapfile.load(str(settings.value('AnimationPresets').toPyObject()))
+ presets = mapfile.load(str(settings.value('AnimationPresetData').toPyObject()))
else:
@@ -243,8 +252,8 @@ class KPEditorDoodad(KPEditorItem):
presetList.append(name)
presets.append(preset)
- settings.setValue('AnimationPresets', presetList)
- settings.setValue('AnimationPresetData', presets)
+ settings.setValue('AnimationPresets', mapfile.dump(presetList))
+ settings.setValue('AnimationPresetData', mapfile.dump(presets))
def __init__(self, doodadRef):
diff --git a/src/ui.py b/src/ui.py
index 9327bd1..6106e2a 100644
--- a/src/ui.py
+++ b/src/ui.py
@@ -751,18 +751,31 @@ class KPMainWindow(QtGui.QMainWindow):
loaded = mapfile.load(data)
file.close()
+ print loaded
settings = KP.app.settings
+ presetList = []
+ presets = []
+
if settings.contains('AnimationPresets'):
- presetList = list(settings.value('AnimationPresets').toPyObject())
- presets = list(settings.value('AnimationPresetData').toPyObject())
+ presetList = mapfile.load(str(settings.value('AnimationPresets').toPyObject()))
+ presets = mapfile.load(str(settings.value('AnimationPresetData').toPyObject()))
- else:
+ if presetList == None:
presetList = []
presets = []
+
+ print presetList, presets
+ print dir(presetList)
+
+ presetList.extend(loaded[0])
+ presets.extend(loaded[1])
- settings.setValue('AnimationPresets', presetList.extend(loaded[0]))
- settings.setValue('AnimationPresetData', presets.extend(loaded[1]))
+ print presetList
+ print presets
+
+ settings.setValue('AnimationPresets', mapfile.dump(presetList))
+ settings.setValue('AnimationPresetData', mapfile.dump(presets))
@@ -770,13 +783,14 @@ class KPMainWindow(QtGui.QMainWindow):
def saveAnimPresets(self):
settings = KP.app.settings
+ import mapfile
msg = QtGui.QMessageBox()
msg.setText("No Animation Presets Found.")
if settings.contains('AnimationPresets'):
- presetList = list(settings.value('AnimationPresets').toPyObject())
- presets = list(settings.value('AnimationPresetData').toPyObject())
+ presetList = mapfile.load(str(settings.value('AnimationPresets').toPyObject()))
+ presets = mapfile.load(str(settings.value('AnimationPresetData').toPyObject()))
else:
msg._exec()
return
@@ -802,9 +816,10 @@ class KPMainWindow(QtGui.QMainWindow):
@QtCore.pyqtSlot()
def clearAnimPresets(self):
settings = KP.app.settings
+ import mapfile
- settings.setValue('AnimationPresets', [])
- settings.setValue('AnimationPresetData', [])
+ settings.setValue('AnimationPresets', mapfile.dump([]))
+ settings.setValue('AnimationPresetData', mapfile.dump([]))
# Window