From bb12ddfb35aedf9bdabe522fbc718b876addc106 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 23 Sep 2012 05:05:15 +0200 Subject: added editing of background names --- src/dialogs.py | 4 ++-- src/editorui/doodads.py | 2 +- src/ui.py | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dialogs.py b/src/dialogs.py index 99abcbb..30a2870 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -156,9 +156,9 @@ class KPAnimationPresetChooser(QtGui.QDialog): -def getTextDialog(): +def getTextDialog(title, label, existingText=''): - text, ok = QtGui.QInputDialog.getText(KP.mainWindow, "Choose Preset Name", "Preset name:") + text, ok = QtGui.QInputDialog.getText(KP.mainWindow, title, label, QtGui.QLineEdit.Normal, existingText) print text if ok and text != '': diff --git a/src/editorui/doodads.py b/src/editorui/doodads.py index 7e150cd..e6ee03e 100644 --- a/src/editorui/doodads.py +++ b/src/editorui/doodads.py @@ -239,7 +239,7 @@ class KPEditorDoodad(KPEditorItem): def addToPreset(self): from dialogs import getTextDialog - name = getTextDialog() + name = getTextDialog('Choose Preset Name', 'Preset name:') if name == None: print 'Returning' return diff --git a/src/ui.py b/src/ui.py index 864b9ed..05923e3 100644 --- a/src/ui.py +++ b/src/ui.py @@ -1138,6 +1138,9 @@ class KPMainWindow(QtGui.QMainWindow): self.ae = a.addAction('Save Animation Presets...', self.saveAnimPresets) self.af = a.addAction('Clear Animation Presets', self.clearAnimPresets) + m = mb.addMenu('Map') + self.ma = m.addAction('Set Background...', self.setMapBackground) + w = mb.addMenu('Window') self.wa = w.addAction('Show Grid', self.showGrid, QKeySequence("Ctrl+G")) self.wa.setCheckable(True) @@ -1623,6 +1626,15 @@ class KPMainWindow(QtGui.QMainWindow): settings.setValue('AnimationPresetData', mapfile.dump([])) +# Map +######################## + @QtCore.pyqtSlot() + def setMapBackground(self): + from dialogs import getTextDialog + newBG = getTextDialog('Map Background', 'Enter a path (ex. /Maps/Water.brres):', KP.map.bgName) + if newBG is not None: + KP.map.bgName = newBG + # Window ######################## @QtCore.pyqtSlot() -- cgit v1.2.3