本文整理汇总了Python中mceutils.setWindowCaption函数的典型用法代码示例。如果您正苦于以下问题:Python setWindowCaption函数的具体用法?Python setWindowCaption怎么用?Python setWindowCaption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setWindowCaption函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: confirm
def confirm(self):
box = self.selectionBox()
if None is box:
return
with setWindowCaption("REPLACING - "):
self.editor.freezeStatus("Replacing %0.1f million blocks" % (float(box.volume) / 1048576.,))
self.blockInfo = self.panel.blockButton.blockInfo
if self.replacing:
self.replaceBlockInfo = self.panel.replaceBlockButton.blockInfo
if self.blockInfo.wildcard:
print "Wildcard replace"
blocksToReplace = []
for i in range(16):
blocksToReplace.append(self.editor.level.materials.blockWithID(self.blockInfo.ID, i))
else:
blocksToReplace = [self.blockInfo]
op = BlockFillOperation(self.editor, self.editor.level, self.selectionBox(), self.replaceBlockInfo,
blocksToReplace, noData=self.noData)
else:
blocksToReplace = []
op = BlockFillOperation(self.editor, self.editor.level, self.selectionBox(), self.blockInfo,
blocksToReplace)
self.editor.addOperation(op)
self.editor.addUnsavedEdit()
self.editor.invalidateBox(box)
self.editor.toolbar.selectTool(-1)
示例2: confirm
def confirm(self, tool):
with setWindowCaption("Applying Macro..."):
options = []
filters = []
for step in sorted(self._macro_data.keys()):
if step != "Number of steps":
filters.append(tool.filterModules[self._macro_data[step]["Name"]])
for module_input in self._macro_data[step]["Inputs"].keys():
if not isinstance(self._macro_data[step]["Inputs"][module_input], (str, unicode)):
continue
if not self._macro_data[step]["Inputs"][module_input].startswith("block-"):
continue
toFind = self._macro_data[step]["Inputs"][module_input][6:].split(":")
block = tool.editor.materials.get((toFind[0], toFind[1]))
self._macro_data[step]["Inputs"][module_input] = block
options.append(self._macro_data[step]["Inputs"])
op = MacroOperation(tool.editor, tool.editor.level, tool.selectionBox(), filters, options)
tool.editor.level.showProgress = showProgress
tool.editor.addOperation(op)
tool.editor.addUnsavedEdit()
tool.editor.invalidateBox(tool.selectionBox())
示例3: perform
def perform(self, recordUndo=True):
if self.level.saving:
alert(_("Cannot perform action while saving is taking place"))
return
if recordUndo:
self.canUndo = True
self.undoLevel = self.extractUndo(self.level, BoundingBox(self.destPoint, self.sourceBox.size))
blocksToCopy = None
if not (self.copyAir and self.copyWater):
blocksToCopy = range(pymclevel.materials.id_limit)
if not self.copyAir:
blocksToCopy.remove(0)
if not self.copyWater:
blocksToCopy.remove(8)
if not self.copyWater:
blocksToCopy.remove(9)
with setWindowCaption("Copying - "):
i = self.level.copyBlocksFromIter(
self.sourceLevel,
self.sourceBox,
self.destPoint,
blocksToCopy,
create=True,
biomes=self.copyBiomes,
staticCommands=self.staticCommands,
moveSpawnerPos=self.moveSpawnerPos,
regenerateUUID=self.regenerateUUID,
first=False,
)
showProgress(_("Copying {0:n} blocks...").format(self.sourceBox.volume), i)
示例4: destroyChunks
def destroyChunks(self, chunks=None):
if "No" == ask("Really delete these chunks? This cannot be undone.", ("Yes", "No")):
return
if chunks is None:
chunks = self.selectedChunks()
chunks = list(chunks)
def _destroyChunks():
i = 0
chunkCount = len(chunks)
for cx, cz in chunks:
i += 1
yield (i, chunkCount)
if self.editor.level.containsChunk(cx, cz):
try:
self.editor.level.deleteChunk(cx, cz)
except Exception as e:
print "Error during chunk delete: ", e
with setWindowCaption("DELETING - "):
showProgress("Deleting chunks...", _destroyChunks())
self.editor.renderer.invalidateChunkMarkers()
self.editor.renderer.discardAllChunks()
示例5: updateSchematic
def updateSchematic(self):
# extract blocks
with setWindowCaption("COPYING - "):
self.editor.freezeStatus("Copying to clone buffer...")
box = self.selectionBox()
self.level = self.editor.level.extractSchematic(box)
self.originalLevel = self.level
# self.level.cloneToolScaleFactor = 1.0
self.rescaleLevel(self.scaleFactor)
self.setupPreview()
示例6: perform
def perform(self, recordUndo=True):
with setWindowCaption("COPYING - "):
self.editor.freezeStatus(_("Copying %0.1f million blocks") % (float(self._dirtyBox.volume) / 1048576.,))
if recordUndo:
chunks = set()
for op in self.blockCopyOps:
chunks.update(op.dirtyBox().chunkPositions)
self.undoLevel = self.extractUndoChunks(self.level, chunks)
[i.perform(False) for i in self.blockCopyOps]
[i.perform(recordUndo) for i in self.selectionOps]
示例7: relightChunks
def relightChunks(self):
def _relightChunks():
for i in self.editor.level.generateLightsIter(self.selectedChunks()):
yield i
with setWindowCaption("RELIGHTING - "):
showProgress(_("Lighting {0} chunks...").format(len(self.selectedChunks())),
_relightChunks(), cancel=True)
self.editor.invalidateChunks(self.selectedChunks())
self.editor.addUnsavedEdit()
示例8: confirm
def confirm(self):
with setWindowCaption("APPLYING FILTER - "):
filterModule = self.filterModules[self.panel.filterSelect.selectedChoice]
op = FilterOperation(self.editor, self.editor.level, self.selectionBox(), filterModule, self.panel.filterOptionsPanel.options)
self.editor.level.showProgress = showProgress
self.editor.addOperation(op)
self.editor.addUnsavedEdit()
self.editor.invalidateBox(self.selectionBox())
示例9: createChunks
def createChunks(self):
panel = GeneratorPanel()
col = [panel]
label = Label("Create chunks using the settings above? This cannot be undone.")
col.append(Row([Label("")]))
col.append(label)
col = Column(col)
if Dialog(client=col, responses=["OK", "Cancel"]).present() == "Cancel":
return
chunks = self.selectedChunks()
createChunks = panel.generate(self.editor.level, chunks)
try:
with setWindowCaption("CREATING - "):
showProgress("Creating {0} chunks...".format(len(chunks)), createChunks, cancel=True)
except Exception, e:
traceback.print_exc()
alert(_("Failed to start the chunk generator. {0!r}").format(e))
示例10: perform
def perform(self, recordUndo=True):
sourceBox = self.sourceBox
if recordUndo:
self.undoLevel = self.extractUndo(self.level, BoundingBox(self.destPoint, self.sourceBox.size))
blocksToCopy = None
if not (self.copyAir and self.copyWater):
blocksToCopy = range(256)
if not self.copyAir:
blocksToCopy.remove(0)
if not self.copyWater:
blocksToCopy.remove(8)
if not self.copyWater:
blocksToCopy.remove(9)
with setWindowCaption("Copying - "):
i = self.level.copyBlocksFromIter(self.sourceLevel, self.sourceBox, self.destPoint, blocksToCopy, create=True)
showProgress("Copying {0:n} blocks...".format(self.sourceBox.volume), i)
示例11: confirm
def confirm(self):
destPoint = self.destPoint
if destPoint is None:
return
sourceLevel = self.sourceLevel()
sourceBox = sourceLevel.bounds
destLevel = self.editor.level
destVolume = BoundingBox(destPoint, sourceBox.size).volume
op = CloneOperation(editor=self.editor,
sourceLevel=sourceLevel,
sourceBox=sourceBox,
originSourceBox=self.selectionBox(),
destLevel=destLevel,
destPoint=self.destPoint,
copyAir=self.copyAir,
copyWater=self.copyWater,
copyBiomes=self.copyBiomes,
repeatCount=self.repeatCount)
self.editor.toolbar.selectTool(-1) # deselect tool so that the clone tool's selection change doesn't update its schematic
with setWindowCaption("COPYING - "):
self.editor.freezeStatus("Copying %0.1f million blocks" % (float(destVolume) / 1048576.,))
self.performWithRetry(op)
self.editor.addUnsavedEdit()
self.editor.addOperation(op)
dirtyBox = op.dirtyBox()
if dirtyBox:
self.editor.invalidateBox(dirtyBox)
self.editor.renderer.invalidateChunkMarkers()
self.editor.currentOperation = None
self.destPoint = None
self.level = None
示例12: pruneChunks
def pruneChunks(self):
if "No" == ask("Save these chunks and remove the rest? This cannot be undone.", ("Yes", "No")):
return
self.editor.saveFile()
def _pruneChunks():
maxChunks = self.editor.level.chunkCount
selectedChunks = self.selectedChunks()
for i, cPos in enumerate(list(self.editor.level.allChunks)):
if cPos not in selectedChunks:
try:
self.editor.level.deleteChunk(*cPos)
except Exception as e:
print "Error during chunk delete: ", e
yield i, maxChunks
with setWindowCaption("PRUNING - "):
showProgress("Pruning chunks...", _pruneChunks())
self.editor.renderer.invalidateChunkMarkers()
self.editor.discardAllChunks()
示例13: _pruneChunks
self.editor.saveFile()
def _pruneChunks():
maxChunks = self.editor.level.chunkCount
selectedChunks = self.selectedChunks()
for i, cPos in enumerate(list(self.editor.level.allChunks)):
if cPos not in selectedChunks:
try:
self.editor.level.deleteChunk(*cPos)
except Exception, e:
print "Error during chunk delete: ", e
yield i, maxChunks
with setWindowCaption("PRUNING - "):
showProgress("Pruning chunks...", _pruneChunks())
self.editor.renderer.invalidateChunkMarkers()
self.editor.discardAllChunks()
# self.editor.addUnsavedEdit()
@alertException
def relightChunks(self):
def _relightChunks():
for i in self.editor.level.generateLightsIter(self.selectedChunks()):
yield i
with setWindowCaption("RELIGHTING - "):