summaryrefslogtreecommitdiff
path: root/src/editorui
diff options
context:
space:
mode:
authorColin Noga <Tempus@Spectrum-Song.local>2011-12-01 00:59:42 -0600
committerColin Noga <Tempus@Spectrum-Song.local>2011-12-01 00:59:42 -0600
commit1b0e3e2ea94b6093c777f62e8eea8c8adf0294aa (patch)
tree3fc166f37ba13881c3575848753e9a99be8b85be /src/editorui
parentbd717ccde431369e25272404d0aff89ef6ffd530 (diff)
downloadkoopatlas-1b0e3e2ea94b6093c777f62e8eea8c8adf0294aa.tar.gz
koopatlas-1b0e3e2ea94b6093c777f62e8eea8c8adf0294aa.zip
Node type Exit was added for transitioning between maps.
Diffstat (limited to 'src/editorui')
-rw-r--r--src/editorui/editormain.py2
-rw-r--r--src/editorui/paths.py126
2 files changed, 115 insertions, 13 deletions
diff --git a/src/editorui/editormain.py b/src/editorui/editormain.py
index 92bfda2..b74967b 100644
--- a/src/editorui/editormain.py
+++ b/src/editorui/editormain.py
@@ -21,7 +21,7 @@ class KPMapScene(QtGui.QGraphicsScene):
self.ticker.setCurveShape(4)
self.ticker.setFrameRange(0,100000)
self.ticker.valueChanged.connect(self.thing)
- self.ticker.setUpdateInterval(1)
+ self.ticker.setUpdateInterval(16.6666666666667)
def playPause(self):
diff --git a/src/editorui/paths.py b/src/editorui/paths.py
index fd27a9c..c1579be 100644
--- a/src/editorui/paths.py
+++ b/src/editorui/paths.py
@@ -66,12 +66,38 @@ class KPEditorNode(KPEditorItem):
self.setRange(1, 99)
- if not hasattr(KPEditorNode.LevelSlotSpinner, 'PALETTE'):
- palette = QtGui.QApplication.palette(self)
- palette.setColor(QtGui.QPalette.Window, Qt.transparent)
- KPEditorNode.LevelSlotSpinner.PALETTE = palette
+ palette = self.palette()
+ palette.setColor(QtGui.QPalette.ButtonText, Qt.black)
+ palette.setColor(QtGui.QPalette.Window, Qt.transparent)
- self.setPalette(self.PALETTE)
+ self.setPalette(palette)
+
+
+ class TransitionBox(QtGui.QComboBox):
+ def __init__(self):
+ QtGui.QComboBox.__init__(self)
+
+ self.addItems(['Fade Out', 'Circle Wipe', 'Bowser Wipe', 'Goo Wipe Down',
+ 'Mario Wipe', 'Circle Wipe Slow', 'Glitchgasm'])
+
+ palette = self.palette()
+ palette.setColor(QtGui.QPalette.ButtonText, Qt.black)
+ palette.setColor(QtGui.QPalette.Window, Qt.transparent)
+
+ self.setPalette(palette)
+
+
+ class mapArcEdit(QtGui.QLineEdit):
+ def __init__(self):
+ QtGui.QLineEdit.__init__(self)
+
+ self.setText('None.arc')
+
+ palette = self.palette()
+ palette.setColor(QtGui.QPalette.ButtonText, Qt.black)
+ palette.setColor(QtGui.QPalette.Window, Qt.transparent)
+
+ self.setPalette(palette)
def __init__(self, node):
@@ -105,6 +131,19 @@ class KPEditorNode(KPEditorItem):
self.stage.valueChanged.connect(self.stageChange)
+ self.foreignID = self.LevelSlotSpinner()
+ self.foreignIDProxy = self.HiddenProxy(self.foreignID, self, 60, 24)
+ self.foreignID.valueChanged.connect(self.foreignIDChange)
+
+ self.mapChange = self.mapArcEdit()
+ self.mapChangeProxy = self.HiddenProxy(self.mapChange, self, -100, 60)
+ self.mapChange.textEdited.connect(self.mapChangeChange)
+
+ self.transition = self.TransitionBox()
+ self.transitionProxy = self.HiddenProxy(self.transition, self, -102, 24)
+ self.transition.currentIndexChanged.connect(self.transitionChange)
+
+
self._updatePosition()
@@ -116,6 +155,7 @@ class KPEditorNode(KPEditorItem):
node.transition = 0
node.mapChange = None
node.mapID = None
+ node.foreignID = None
node.isStop = True
node.level = [0,0]
@@ -128,12 +168,28 @@ class KPEditorNode(KPEditorItem):
pass
elif state == 3:
- node.isStop = False
-
- else:
node.transition = 0
node.mapChange = 'None.arc'
- node.mapID = 0
+ node.foreignID = 0
+
+ usedIDs = []
+ for nodesPicker in KP.map.pathLayer.nodes:
+ usedIDs.append(nodesPicker.mapID)
+
+ i = 1
+ while i in usedIDs:
+ i += 1
+
+ node.mapID = i
+
+ self.foreignID.setValue(1)
+ self.mapChange.setText('None.arc')
+ self.transition.setCurrentIndex(0)
+
+
+ else:
+ node.isStop = False
+
self.update()
@@ -152,6 +208,27 @@ class KPEditorNode(KPEditorItem):
node.level[1] = stage
+ @QtCore.pyqtSlot(int)
+ def foreignIDChange(self, ID):
+
+ node = self._nodeRef()
+ node.foreignID = ID
+
+
+ @QtCore.pyqtSlot(int)
+ def transitionChange(self, index):
+
+ node = self._nodeRef()
+ node.transition = index
+
+
+ @QtCore.pyqtSlot(str)
+ def mapChangeChange(self, mapname):
+
+ node = self._nodeRef()
+ node.mapChange = mapname
+
+
def _updatePosition(self):
node = self._nodeRef()
x, y = node.position
@@ -183,6 +260,19 @@ class KPEditorNode(KPEditorItem):
painter.setBrush(QtGui.QColor(0, 0, 0, 0))
painter.setPen(QtGui.QColor(0, 0, 0, 0))
painter.drawPixmap(self._boundingRect.topLeft(), QtGui.QPixmap("Resources/ExitWorld.png"))
+
+ textPath = QtGui.QPainterPath()
+ font = QtGui.QFont("Times", 22)
+ font.setStyleStrategy(QtGui.QFont.ForceOutline)
+ textPath.addText(-6, 3, font, str(node.mapID))
+
+ painter.setBrush(QtGui.QColor(140, 140, 255))
+ pen = QtGui.QPen(QtGui.QColor(80, 80, 255))
+ pen.setWidth(1)
+ pen.setStyle(Qt.SolidLine)
+ painter.setPen(pen)
+ painter.drawPath(textPath)
+
selectionRect = self._boundingRect.adjusted(1,5,-1,-5)
elif node.isStop:
@@ -200,8 +290,6 @@ class KPEditorNode(KPEditorItem):
selectionRect = self._tinyRect.adjusted(-1,-1,1,1)
-
-
if self.isSelected():
painter.setPen(self.SELECTION_PEN)
painter.setBrush(QtGui.QColor(0,0,0,0))
@@ -217,11 +305,25 @@ class KPEditorNode(KPEditorItem):
self.worldProxy.hide()
self.stageProxy.hide()
+
+ if node.mapChange != None:
+ self.foreignID.show()
+ self.transition.show()
+ self.mapChange.show()
+
+ else:
+ self.foreignID.hide()
+ self.transition.hide()
+ self.mapChange.hide()
+
else:
self.buttonProxy.hide()
self.worldProxy.hide()
self.stageProxy.hide()
-
+ self.foreignID.hide()
+ self.transition.hide()
+ self.mapChange.hide()
+
def remove(self, withItem=False):
node = self._nodeRef()