diff options
-rw-r--r-- | Resources/AddPreset.png | bin | 0 -> 1427 bytes | |||
-rw-r--r-- | Resources/ClearPreset.png | bin | 0 -> 1987 bytes | |||
-rw-r--r-- | Resources/LoadPreset.png | bin | 0 -> 1752 bytes | |||
-rw-r--r-- | Resources/Minus.png | bin | 0 -> 1114 bytes | |||
-rw-r--r-- | Resources/NewPreset.png | bin | 0 -> 1679 bytes | |||
-rw-r--r-- | Resources/Plus.png | bin | 0 -> 1427 bytes | |||
-rw-r--r-- | Resources/SavePreset.png | bin | 0 -> 1713 bytes | |||
-rw-r--r-- | src/dialogs.py | 10 | ||||
-rw-r--r-- | src/editorui/doodads.py | 29 | ||||
-rw-r--r-- | src/ui.py | 33 |
10 files changed, 48 insertions, 24 deletions
diff --git a/Resources/AddPreset.png b/Resources/AddPreset.png Binary files differnew file mode 100644 index 0000000..4ddfa6b --- /dev/null +++ b/Resources/AddPreset.png diff --git a/Resources/ClearPreset.png b/Resources/ClearPreset.png Binary files differnew file mode 100644 index 0000000..b196cb4 --- /dev/null +++ b/Resources/ClearPreset.png diff --git a/Resources/LoadPreset.png b/Resources/LoadPreset.png Binary files differnew file mode 100644 index 0000000..1b1e9f0 --- /dev/null +++ b/Resources/LoadPreset.png diff --git a/Resources/Minus.png b/Resources/Minus.png Binary files differnew file mode 100644 index 0000000..439f371 --- /dev/null +++ b/Resources/Minus.png diff --git a/Resources/NewPreset.png b/Resources/NewPreset.png Binary files differnew file mode 100644 index 0000000..e229063 --- /dev/null +++ b/Resources/NewPreset.png diff --git a/Resources/Plus.png b/Resources/Plus.png Binary files differnew file mode 100644 index 0000000..b6fb157 --- /dev/null +++ b/Resources/Plus.png diff --git a/Resources/SavePreset.png b/Resources/SavePreset.png Binary files differnew file mode 100644 index 0000000..7412d49 --- /dev/null +++ b/Resources/SavePreset.png 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): @@ -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 |