Prep ent
Some checks failed
Build Dusk / build-linux (push) Failing after 55s
Build Dusk / build-psp (push) Failing after 56s

This commit is contained in:
2025-11-20 16:45:50 -06:00
parent 51a1077fda
commit 3697cc3eef
7 changed files with 185 additions and 26 deletions

View File

@@ -0,0 +1,53 @@
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLineEdit, QLabel, QSizePolicy, QComboBox, QHBoxLayout, QSpacerItem
from PyQt5.QtCore import Qt, pyqtSignal
from .cutscenewait import CutsceneWaitEditor
from .cutscenetext import CutsceneTextEditor
EDITOR_MAP = (
( "wait", "Wait", CutsceneWaitEditor ),
( "text", "Text", CutsceneTextEditor )
)
class CutsceneItemEditor(QWidget):
def __init__(self, parent=None):
super().__init__(parent)
self.layout = QVBoxLayout(self)
self.layout.setAlignment(Qt.AlignTop | Qt.AlignLeft)
self.layout.addWidget(QLabel("Item Properties:"))
rowLayout = QHBoxLayout()
rowLayout.setSpacing(8)
rowLayout.addWidget(QLabel("Name:"))
self.nameInput = QLineEdit()
rowLayout.addWidget(self.nameInput)
rowLayout.addWidget(QLabel("Type:"))
self.typeDropdown = QComboBox()
self.typeDropdown.addItems([typeName for typeKey, typeName, editorClass in EDITOR_MAP])
rowLayout.addWidget(self.typeDropdown)
self.layout.addLayout(rowLayout)
self.activeEditor = None
# Events
self.typeDropdown.currentTextChanged.connect(self.onTypeChanged)
# First load
self.onTypeChanged(self.typeDropdown.currentText())
def onTypeChanged(self, typeText):
typeKey = typeText.lower()
# Remove existing editor
if self.activeEditor:
self.layout.removeWidget(self.activeEditor)
self.activeEditor.deleteLater()
self.activeEditor = None
# Create new editor
for key, name, editorClass in EDITOR_MAP:
if key == typeKey:
self.activeEditor = editorClass()
self.layout.addWidget(self.activeEditor)
break

View File

@@ -0,0 +1,21 @@
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QTextEdit
from PyQt5.QtCore import Qt
class CutsceneTextEditor(QWidget):
def __init__(self, parent=None):
super().__init__(parent)
layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
label = QLabel("Text:")
label.setSizePolicy(label.sizePolicy().Expanding, label.sizePolicy().Fixed)
layout.addWidget(label)
self.textInput = QTextEdit()
self.textInput.setSizePolicy(self.textInput.sizePolicy().Expanding, self.textInput.sizePolicy().Expanding)
layout.addWidget(self.textInput, stretch=1)
def setText(self, text):
self.textInput.setPlainText(text)
def getText(self):
return self.textInput.toPlainText()

View File

@@ -0,0 +1,20 @@
from PyQt5.QtWidgets import QWidget, QFormLayout, QDoubleSpinBox, QLabel
class CutsceneWaitEditor(QWidget):
def __init__(self, parent=None):
super().__init__(parent)
layout = QFormLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
self.waitTimeInput = QDoubleSpinBox()
self.waitTimeInput.setMinimum(0.0)
self.waitTimeInput.setMaximum(9999.0)
self.waitTimeInput.setDecimals(2)
self.waitTimeInput.setSingleStep(0.1)
layout.addRow(QLabel("Wait Time (seconds):"), self.waitTimeInput)
def setWaitTime(self, value):
self.waitTimeInput.setValue(value)
def getWaitTime(self):
return self.waitTimeInput.value()