session.selectionBox -> currentSelection

This commit is contained in:
David Vierra 2015-01-06 10:42:50 -10:00
parent 767a966bba
commit 2074faa840
5 changed files with 14 additions and 14 deletions

View File

@ -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

View File

@ -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)

View File

@ -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):

View File

@ -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)

View File

@ -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)