summaryrefslogtreecommitdiff
path: root/src/editorui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/editorui/doodads.py80
1 files changed, 76 insertions, 4 deletions
diff --git a/src/editorui/doodads.py b/src/editorui/doodads.py
index f57502a..d7f767f 100644
--- a/src/editorui/doodads.py
+++ b/src/editorui/doodads.py
@@ -125,15 +125,19 @@ class KPEditorDoodad(KPEditorItem):
self.anmTable.horizontalHeader().setVisible(True)
self.anmTable.verticalHeader().setVisible(False)
- BottomLayout.addWidget(self.anmTable, 0, 0, 1, 4)
+ BottomLayout.addWidget(self.anmTable, 0, 0, 1, 6)
# Add/Remove Animation Buttons
addbutton = QtGui.QPushButton("Add Animation")
rembutton = QtGui.QPushButton("Remove Animation")
+ presetbutton = QtGui.QPushButton("Add Preset")
+ newpbutton = QtGui.QPushButton("New Preset")
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)
# Annnnndddd we're spent.
@@ -142,6 +146,9 @@ class KPEditorDoodad(KPEditorItem):
addbutton.released.connect(self.addAnmItem)
rembutton.released.connect(self.remAnmItem)
+ presetbutton.released.connect(self.selectPreset)
+ newpbutton.released.connect(self.addToPreset)
+
def sizeHint(self):
return QtCore.QSize(591,300)
@@ -165,16 +172,81 @@ class KPEditorDoodad(KPEditorItem):
def remAnmItem(self):
- if self.anmTable.rows() == 0:
+ if self.model.rowCount() == 0:
return
rowNum, ok = QtGui.QInputDialog.getInteger(self,
- "Select A Row", "Delete This Row:", 0, 0, self.anmTable.rows(), 1)
+ "Select A Row", "Delete This Row:", 0, 0, self.model.rowCount(), 1)
if ok:
- rowNum = QtGui.Q
self.model.removeRows(rowNum, 1)
+ def selectPreset(self):
+ from dialogs import KPAnimationPresetChooser
+ presetList = KPAnimationPresetChooser.run()
+
+ if presetList is None: return
+ if presetList is []: return
+ if presetList is [[]]: return
+
+ q = QtGui.QStandardItem
+
+ for row in presetList:
+ a = q(row[0])
+ b = q(row[1])
+ c = q()
+ c.setData(row[2], Qt.EditRole)
+ d = q(row[3])
+ e = q()
+ e.setData(row[4], Qt.EditRole)
+ f = q()
+ f.setData(row[5], Qt.EditRole)
+
+ self.model.appendRow([a,b,c,d,e,f])
+
+
+ def addToPreset(self):
+ from dialogs import getTextDialog
+
+ name = getTextDialog()
+ if name == None:
+ print 'Returning'
+ return
+
+ print 'Adding.'
+ preset = []
+ for row in xrange(self.model.rowCount()):
+ listrow = []
+ for column in xrange(6):
+ item = self.model.item(row, column)
+ if (column == 0) or (column == 1) or (column == 2):
+ data = str(item.data(Qt.EditRole).toString())
+ else:
+ data = item.data(Qt.EditRole).toFloat()[0]
+
+ listrow.append(data)
+
+ preset.append(listrow)
+
+ settings = KP.app.settings
+
+ if settings.contains('AnimationPresets'):
+
+ presetList = settings.value('AnimationPresets').toPyObject()
+ presets = settings.value('AnimationPresetData').toPyObject()
+
+ else:
+
+ presetList = []
+ presets = []
+
+ presetList.append(name)
+ presets.append(preset)
+
+ settings.setValue('AnimationPresets', presetList)
+ settings.setValue('AnimationPresetData', presets)
+
+
def __init__(self, doodadRef):
QtGui.QPushButton.__init__(self)