From 2074faa8400243b961f6137ca22f913fe55cb9f9 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Tue, 6 Jan 2015 10:42:50 -1000 Subject: [PATCH] session.selectionBox -> currentSelection --- src/mcedit2/editorcommands/fill.py | 2 +- src/mcedit2/editorcommands/replace.py | 2 +- src/mcedit2/editorsession.py | 12 ++++++------ src/mcedit2/editortools/move.py | 8 ++++---- src/mcedit2/editortools/select.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mcedit2/editorcommands/fill.py b/src/mcedit2/editorcommands/fill.py index 55164ed..7fc97b0 100644 --- a/src/mcedit2/editorcommands/fill.py +++ b/src/mcedit2/editorcommands/fill.py @@ -31,7 +31,7 @@ def fillCommand(editorSession): :type editorSession: mcedit2.editorsession.EditorSession """ - box = editorSession.selectionBox + box = editorSession.currentSelection if box is None or box.volume == 0: return diff --git a/src/mcedit2/editorcommands/replace.py b/src/mcedit2/editorcommands/replace.py index e960cb0..8d9bdc9 100644 --- a/src/mcedit2/editorcommands/replace.py +++ b/src/mcedit2/editorcommands/replace.py @@ -136,6 +136,6 @@ def replaceCommand(editorSession): replacements = dialog.getReplacements() command = SimpleRevisionCommand(editorSession, "Replace") with command.begin(): - task = editorSession.currentDimension.fillBlocksIter(editorSession.selectionBox, replacements) + task = editorSession.currentDimension.fillBlocksIter(editorSession.currentSelection, replacements) showProgress("Replacing...", task) editorSession.pushCommand(command) diff --git a/src/mcedit2/editorsession.py b/src/mcedit2/editorsession.py index 1e667f6..7b93740 100644 --- a/src/mcedit2/editorsession.py +++ b/src/mcedit2/editorsession.py @@ -191,11 +191,11 @@ class EditorSession(QtCore.QObject): self.worldEditor = None @property - def selectionBox(self): + def currentSelection(self): return self.selectionTool.currentSelection - @selectionBox.setter - def selectionBox(self, value): + @currentSelection.setter + def currentSelection(self, value): self.selectionTool.currentSelection = value # --- Menu commands --- @@ -213,14 +213,14 @@ class EditorSession(QtCore.QObject): def cut(self): command = SimpleRevisionCommand(self, "Cut") with command.begin(): - task = self.currentDimension.exportSchematicIter(self.selectionBox) + task = self.currentDimension.exportSchematicIter(self.currentSelection) self.copiedSchematic = showProgress("Cutting...", task) - task = self.currentDimension.fillBlocksIter(self.selectionBox, "air") + task = self.currentDimension.fillBlocksIter(self.currentSelection, "air") showProgress("Cutting...", task) self.undoStack.push(command) def copy(self): - task = self.currentDimension.exportSchematicIter(self.selectionBox) + task = self.currentDimension.exportSchematicIter(self.currentSelection) self.copiedSchematic = showProgress("Copying...", task) def paste(self): diff --git a/src/mcedit2/editortools/move.py b/src/mcedit2/editortools/move.py index be68a5c..2e323a9 100644 --- a/src/mcedit2/editortools/move.py +++ b/src/mcedit2/editortools/move.py @@ -236,16 +236,16 @@ class MoveTool(EditorTool): if self.currentCommand is None and self.movingSchematic is None: # Need to cut out selection # xxxx for huge selections, don't cut, just do everything at the end? - if self.editorSession.selectionBox is None: + if self.editorSession.currentSelection is None: return - export = self.editorSession.currentDimension.exportSchematicIter(self.editorSession.selectionBox) + export = self.editorSession.currentDimension.exportSchematicIter(self.editorSession.currentSelection) self.movingSchematic = showProgress("Lifting...", export) - self.movePosition = self.editorSession.selectionBox.origin + self.movePosition = self.editorSession.currentSelection.origin self.currentCommand = SimpleRevisionCommand(self.editorSession, self.tr("Move")) self.currentCommand.previousRevision = self.editorSession.currentRevision self.editorSession.beginUndo() - fill = self.editorSession.currentDimension.fillBlocksIter(self.editorSession.selectionBox, "air") + fill = self.editorSession.currentDimension.fillBlocksIter(self.editorSession.currentSelection, "air") showProgress("Lifting...", fill) self.editorSession.commitUndo() self.editorSession.setUndoBlock(self.completeMove) diff --git a/src/mcedit2/editortools/select.py b/src/mcedit2/editortools/select.py index 1f63346..fe2c62f 100644 --- a/src/mcedit2/editortools/select.py +++ b/src/mcedit2/editortools/select.py @@ -231,8 +231,8 @@ class SelectionTool(EditorTool): def deleteSelection(self): command = SimpleRevisionCommand(self.editorSession, "Delete") with command.begin(): - fillTask = self.editorSession.currentDimension.fillBlocksIter(self.editorSession.selectionBox, "air") - entitiesTask = RemoveEntitiesOperation(self.editorSession.currentDimension, self.editorSession.selectionBox) + fillTask = self.editorSession.currentDimension.fillBlocksIter(self.editorSession.currentSelection, "air") + entitiesTask = RemoveEntitiesOperation(self.editorSession.currentDimension, self.editorSession.currentSelection) task = ComposeOperations(fillTask, entitiesTask) showProgress("Deleting...", task) self.editorSession.pushCommand(command)