diff --git a/src/mcedit2/editorcommands/find_replace/nbt.py b/src/mcedit2/editorcommands/find_replace/nbt.py index 3db2b45..3e3ca48 100644 --- a/src/mcedit2/editorcommands/find_replace/nbt.py +++ b/src/mcedit2/editorcommands/find_replace/nbt.py @@ -202,10 +202,6 @@ class ReplaceValueTagType(object): DOUBLE = 7 -class NBTReplaceCommand(SimpleRevisionCommand): - pass - - class FindReplaceNBTResults(QtGui.QWidget, Ui_findNBTResults): pass @@ -565,12 +561,9 @@ class FindReplaceNBT(QtGui.QWidget, Ui_findNBTWidget): yield - command = NBTReplaceCommand(self.editorSession, "Replace NBT data") # xxx replace details - with command.begin(): + with self.editorSession.beginSimpleCommand(self.tr("Replace NBT data")): showProgress("Replacing NBT data...", _replace()) - self.editorSession.pushCommand(command) - def replaceAll(self): self.replaceEntries(self.resultsModel.results) diff --git a/src/mcedit2/widgets/inspector/__init__.py b/src/mcedit2/widgets/inspector/__init__.py index b17daf2..7dce977 100644 --- a/src/mcedit2/widgets/inspector/__init__.py +++ b/src/mcedit2/widgets/inspector/__init__.py @@ -334,45 +334,36 @@ class InspectorWidget(QtGui.QWidget, Ui_inspectorWidget): if self.currentChunk.TerrainPopulated == value: return - command = InspectPropertyChangeCommand(self.editorSession, - self.tr("Change chunk (%s, %s) property TerrainPopulated") - % self.currentChunk.chunkPosition) - with command.begin(): + with self.editorSession.beginSimpleCommand(self.tr("Change chunk (%s, %s) property TerrainPopulated") + % self.currentChunk.chunkPosition): self.currentChunk.TerrainPopulated = value - self.editorSession.pushCommand(command) def lightPopulatedDidChange(self, value): if self.currentChunk.rootTag["Level"]["LightPopulated"].value == value: return - command = InspectPropertyChangeCommand(self.editorSession, - self.tr("Change chunk (%s, %s) property LightPopulated") - % self.currentChunk.chunkPosition) - with command.begin(): + with self.editorSession.beginSimpleCommand(self.tr("Change chunk (%s, %s) property LightPopulated") + % self.currentChunk.chunkPosition): self.currentChunk.rootTag["Level"]["LightPopulated"].value = value - self.editorSession.pushCommand(command) + def inhabitedTimeDidChange(self, value): if self.currentChunk.rootTag["Level"]["InhabitedTime"].value == value: return - command = InspectPropertyChangeCommand(self.editorSession, - self.tr("Change chunk (%s, %s) property InhabitedTime") - % self.currentChunk.chunkPosition) - with command.begin(): + with self.editorSession.beginSimpleCommand(self.tr("Change chunk (%s, %s) property InhabitedTime") + % self.currentChunk.chunkPosition): self.currentChunk.rootTag["Level"]["InhabitedTime"].value = value - self.editorSession.pushCommand(command) + def updateTimeDidChange(self, value): if self.currentChunk.rootTag["Level"]["LastUpdate"].value == value: return - command = InspectPropertyChangeCommand(self.editorSession, - self.tr("Change chunk (%s, %s) property LastUpdate") - % self.currentChunk.chunkPosition) - with command.begin(): + with self.editorSession.beginSimpleCommand(self.tr("Change chunk (%s, %s) property LastUpdate") + % self.currentChunk.chunkPosition): self.currentChunk.rootTag["Level"]["LastUpdate"].value = value - self.editorSession.pushCommand(command) + def chunkTabDidChange(self, index): if self.chunkTabWidget.widget(index) is self.chunkPropertiesTab: @@ -392,6 +383,3 @@ class InspectorWidget(QtGui.QWidget, Ui_inspectorWidget): # cx = self.cxSpinBox.value() # cz = self.czSpinBox.value() # self.selectChunk(cx, cz) - -class InspectPropertyChangeCommand(SimpleRevisionCommand): - pass \ No newline at end of file diff --git a/src/mcedit2/widgets/nbttree/nbteditor.py b/src/mcedit2/widgets/nbttree/nbteditor.py index 0580793..2ed6c2d 100644 --- a/src/mcedit2/widgets/nbttree/nbteditor.py +++ b/src/mcedit2/widgets/nbttree/nbteditor.py @@ -65,10 +65,6 @@ class NBTEditorItemDelegate(QtGui.QStyledItemDelegate): super(NBTEditorItemDelegate, self).setModelData(editor, model, index) -class NBTDataChangeCommand(SimpleRevisionCommand): - pass - - @registerCustomWidget class NBTEditorWidget(QtGui.QWidget): """ @@ -268,22 +264,18 @@ class NBTEditorWidget(QtGui.QWidget): else: text = "Unknown data changed." - command = NBTDataChangeCommand(self.editorSession, text) - with command.begin(): + with self.editorSession.beginSimpleCommand(text): self.rootTagRef.dirty = True self.editorSession.worldEditor.syncToDisk() - self.editorSession.pushCommand(command) self.tagValueChanged.emit(index.data(NBTTreeModel.NBTPathRole)) def rowsDidInsert(self, index): name = self.tagNameForUndo(index.parent()) text = "%sInsert NBT tag under %s" % (self.undoCommandPrefixText, name) - command = NBTDataChangeCommand(self.editorSession, text) - with command.begin(): + with self.editorSession.beginSimpleCommand(text): self.rootTagRef.dirty = True self.editorSession.worldEditor.syncToDisk() - self.editorSession.pushCommand(command) doomedTagName = None @@ -291,11 +283,9 @@ class NBTEditorWidget(QtGui.QWidget): name = self.tagNameForUndo(index) text = "%sRemove NBT tag %s from %s" % (self.undoCommandPrefixText, self.doomedTagName, name) - command = NBTDataChangeCommand(self.editorSession, text) - with command.begin(): + with self.editorSession.beginSimpleCommand(text): self.rootTagRef.dirty = True self.editorSession.worldEditor.syncToDisk() - self.editorSession.pushCommand(command) tagValueChanged = QtCore.Signal(list) tagAdded = QtCore.Signal(list)