• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python showprogress.showProgress函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mcedit2.util.showprogress.showProgress函数的典型用法代码示例。如果您正苦于以下问题:Python showProgress函数的具体用法?Python showProgress怎么用?Python showProgress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了showProgress函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: confirmImport

    def confirmImport(self):
        if self.currentImport is None:
            return

        command = MoveFinishCommand(self, self.currentImport)
        destDim = self.editorSession.currentDimension
        with command.begin():
            log.info("Move: starting")
            sourceDim, selection = self.currentImport.getSourceForDim(destDim)

            # Copy to destination
            log.info("Move: copying")
            task = destDim.copyBlocksIter(sourceDim, selection,
                                          self.currentImport.importPos,
                                          biomes=True, create=True,
                                          copyAir=self.copyAirCheckbox.isChecked())

            showProgress(self.tr("Pasting..."), task)

            log.info("Move: clearing")
            # Clear source
            if self.currentImport.isMove:
                fill = destDim.fillBlocksIter(self.currentImport.selection, "air")
                showProgress(self.tr("Clearing..."), fill)

        self.editorSession.pushCommand(command)
开发者ID:pamunoz,项目名称:mcedit2,代码行数:26,代码来源:move.py


示例2: applyToSelections

    def applyToSelections(self, command, selections):
        """

        :type command: BrushCommand
        """
        fill = command.editorSession.currentDimension.fillBlocksIter(selections[0], command.options['blockInfo'])
        showProgress("Applying brush...", fill)
开发者ID:skinny121,项目名称:mcedit2,代码行数:7,代码来源:__init__.py


示例3: generateClicked

    def generateClicked(self):
        if self.currentGenerator is None:
            return

        if self.schematicBounds is None:
            log.info("schematicBounds is None, not generating")
            return

        if self.currentSchematic is None:
            log.info("Generating new schematic for import")
            currentSchematic = self.currentGenerator.generate(self.schematicBounds, self.editorSession.worldEditor.blocktypes)
        else:
            log.info("Importing previously generated schematic.")
            currentSchematic = self.currentSchematic

        command = GenerateCommand(self, self.schematicBounds)
        try:
            with command.begin():
                if currentSchematic is not None:
                    task = self.editorSession.currentDimension.importSchematicIter(currentSchematic, self.schematicBounds.origin)
                    showProgress(self.tr("Importing generated object..."), task)
                else:
                    task = self.currentGenerator.generateInWorld(self.schematicBounds, self.editorSession.currentDimension)
                    showProgress(self.tr("Generating object in world..."), task)
        except Exception as e:
            log.exception("Error while importing or generating in world: %r" % e)
            command.undo()
        else:
            self.editorSession.pushCommand(command)
开发者ID:hgroene,项目名称:mcedit2,代码行数:29,代码来源:generate.py


示例4: replaceEntries

    def replaceEntries(self, entries):
        shouldReplaceName = self.widget.replaceNameCheckbox.isChecked()
        newName = self.widget.replaceNameField.text()
        shouldReplaceValue = self.widget.replaceValueCheckbox.isChecked()
        newValue = self.widget.replaceValueField.text()
        # newTagType = self.widget.replaceTagTypeComboBox.currentIndex()

        def _replaceInTag(result, tag):
            for component in result.path:
                tag = tag[component]

            if shouldReplaceName:
                subtag = tag.pop(result.tagName)
                tag[newName] = subtag
                result.setTagName(newName)

            if shouldReplaceValue:
                subtag = tag[result.tagName]
                # xxx newTagType
                if subtag.tagID in (nbt.ID_BYTE, nbt.ID_SHORT, nbt.ID_INT, nbt.ID_LONG):
                    try:
                        value = int(newValue)
                    except ValueError:
                        log.warn("Could not assign value %s to tag %s (could not convert to int)", newValue, subtag)
                        return
                elif subtag.tagID in (nbt.ID_FLOAT, nbt.ID_DOUBLE):
                    try:
                        value = float(newValue)
                    except ValueError:
                        log.warn("Could not assign value %s to tag %s (could not convert to float)", newValue, subtag)
                        return
                else:
                    value = newValue
                subtag.value = value

        def _replace():
            for result in entries:
                if result.resultType == result.TileEntityResult:
                    tileEntity = self.editorSession.currentDimension.getTileEntity(result.position)
                    if tileEntity:
                        tag = tileEntity.raw_tag()
                        _replaceInTag(result, tag)
                        tileEntity.dirty()

                if result.resultType == result.EntityResult:
                    entity = result.getEntity(self.editorSession.currentDimension)  # xxx put dimension in result!!!!
                    if entity:
                        tag = entity.raw_tag()
                        _replaceInTag(result, tag)
                        entity.dirty()

                # if result.resultType == result.ItemResult:  # xxx
                yield

        command = NBTReplaceCommand(self.editorSession, "Replace NBT data")  # xxx replace details
        with command.begin():
            replacer = _replace()
            showProgress("Replacing NBT data...", replacer)

        self.editorSession.pushCommand(command)
开发者ID:upidea,项目名称:mcedit2,代码行数:60,代码来源:nbt.py


示例5: begin

    def begin(self):
        self.previousRevision = self.editorSession.currentRevision
        self.editorSession.beginUndo()
        yield
        task = self.editorSession.commitUndoIter()
        showProgress(QtGui.qApp.tr("Writing undo history"), task)

        self.currentRevision = self.editorSession.currentRevision
开发者ID:Dester-Dasqwe,项目名称:mcedit2,代码行数:8,代码来源:command.py


示例6: cut

 def cut(self):
     command = SimpleRevisionCommand(self, "Cut")
     with command.begin():
         task = self.currentDimension.exportSchematicIter(self.currentSelection)
         self.copiedSchematic = showProgress("Cutting...", task)
         task = self.currentDimension.fillBlocksIter(self.currentSelection, "air")
         showProgress("Cutting...", task)
     self.undoStack.push(command)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:8,代码来源:editorsession.py


示例7: deleteSelection

 def deleteSelection(self):
     command = SimpleRevisionCommand(self, "Delete")
     with command.begin():
         fillTask = self.currentDimension.fillBlocksIter(self.currentSelection, "air")
         entitiesTask = RemoveEntitiesOperation(self.currentDimension, self.currentSelection)
         task = ComposeOperations(fillTask, entitiesTask)
         showProgress("Deleting...", task)
     self.pushCommand(command)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:8,代码来源:editorsession.py


示例8: _copy

            def _copy():
                # Copy to destination
                log.info("Move: copying")
                task = destDim.copyBlocksIter(sourceDim, selection,
                                              self.currentImport.importPos,
                                              biomes=True, create=True,
                                              copyAir=self.copyAirCheckbox.isChecked())

                showProgress(self.tr("Pasting..."), task)
开发者ID:mcedit,项目名称:mcedit2,代码行数:9,代码来源:move.py


示例9: doReplace

 def doReplace(self):
     replacements = self.getReplacements()
     command = SimpleRevisionCommand(self.editorSession, "Replace")
     selection = self.editorSession.currentDimension.bounds
     # selection = self.editorSession.currentSelection
     with command.begin():
         task = self.editorSession.currentDimension.fillBlocksIter(selection, replacements, updateLights=False)
         showProgress("Replacing...", task)
     self.editorSession.pushCommand(command)
开发者ID:cagatayikim,项目名称:mcedit2,代码行数:9,代码来源:find_replace.py


示例10: analyze

 def analyze(self):
     if self.currentSelection is None:
         return
     task = self.currentDimension.analyzeIter(self.currentSelection)
     showProgress("Analyzing...", task)
     outputDialog = AnalyzeOutputDialog(self, task.blocks,
                                        task.entityCounts,
                                        task.tileEntityCounts,
                                        task.dimension.worldEditor.displayName)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:9,代码来源:editorsession.py


示例11: redo

    def redo(self):
        if not self.performed:
            self.editorSession.beginUndo()
            self.perform()
            task = self.editorSession.commitUndoIter()
            showProgress(QtGui.qApp.tr("Writing undo history"), task)

        else:
            self.editorSession.undoForward()
开发者ID:KevinKelley,项目名称:mcedit2,代码行数:9,代码来源:command.py


示例12: doReplace

 def doReplace(self):
     replacements = self.widget.replacementList.getReplacements()
     command = SimpleRevisionCommand(self.editorSession, "Replace")
     if self.widget.replaceBlocksInSelectionCheckbox.isChecked():
         selection = self.editorSession.currentSelection
     else:
         selection = self.editorSession.currentDimension.bounds
     with command.begin():
         task = self.editorSession.currentDimension.fillBlocksIter(selection, replacements, updateLights=False)
         showProgress("Replacing...", task)
     self.editorSession.pushCommand(command)
开发者ID:shatteredsword,项目名称:mcedit2,代码行数:11,代码来源:replace_blocks.py


示例13: confirmImport

    def confirmImport(self):
        if self.currentImport is None:
            return

        command = MoveFinishCommand(self, self.currentImport)

        with command.begin():
            task = self.editorSession.currentDimension.importSchematicIter(self.currentImport.schematic, self.currentImport.pos)
            showProgress(self.tr("Pasting..."), task)

        self.editorSession.pushCommand(command)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:11,代码来源:move.py


示例14: replaceEntries

    def replaceEntries(self, entries):
        shouldReplaceName = nbtReplaceSettings.replaceNameEnabled.value()
        newName = nbtReplaceSettings.replaceNameField.value()
        shouldReplaceValue = nbtReplaceSettings.replaceValueEnabled.value()
        newValue = nbtReplaceSettings.replaceValueField.value()
        # newTagType = self.replaceTagTypeComboBox.currentIndex()

        def _replaceInTag(result, tag):
            for component in result.path:
                tag = tag[component]

            if shouldReplaceName:
                subtag = tag.pop(result.tagName)
                tag[newName] = subtag
                result.setTagName(newName)

            if shouldReplaceValue:
                subtag = tag[result.tagName]
                # xxx newTagType
                if subtag.tagID in (nbt.ID_BYTE, nbt.ID_SHORT, nbt.ID_INT, nbt.ID_LONG):
                    try:
                        value = int(newValue)
                    except ValueError:
                        log.warn("Could not assign value %s to tag %s (could not convert to int)", newValue, subtag)
                        return
                elif subtag.tagID in (nbt.ID_FLOAT, nbt.ID_DOUBLE):
                    try:
                        value = float(newValue)
                    except ValueError:
                        log.warn("Could not assign value %s to tag %s (could not convert to float)", newValue, subtag)
                        return
                else:
                    value = newValue
                subtag.value = value
                result.value = value

        def _replace():
            for result in entries:
                ref = result.getTargetRef()

                tag = result.getTargetTag()
                _replaceInTag(result, tag)
                ref.dirty = True

                yield

        with self.editorSession.beginSimpleCommand(self.tr("Replace NBT data")):
            showProgress("Replacing NBT data...", _replace())
开发者ID:mcedit,项目名称:mcedit2,代码行数:48,代码来源:nbt.py


示例15: generate

    def generate(self, bounds, blocktypes):
        # self.systemsBox.value()
        schematic = createSchematic(bounds.size, blocktypes)
        dim = schematic.getDimension()
        system = koch.Snowflake(dim.bounds, blocktype=self.blocktypeButton.block)
        symbol_list = [system]

        max_iterations = self.iterationsSlider.value()
        def process(_symbol_list):
            for iteration, _symbol_list in applyReplacementsIterated(_symbol_list, max_iterations):
                yield iteration, max_iterations

            yield _symbol_list

        symbol_list = showProgress("Generating...", process(symbol_list), cancel=True)
        if symbol_list is False:
            return

        import pprint
        pprint.pprint(symbol_list)
        rendering = renderBlocks(symbol_list)

        print("Rendering %d blocks" % len(rendering))
        for x, y, z, blockType in rendering:
            dim.setBlock(x, y, z, blockType)

        return schematic
开发者ID:sadeksadek,项目名称:mcedit2,代码行数:27,代码来源:l_system_plugin.py


示例16: fillCommand

def fillCommand(editorSession):
    """

    :type editorSession: mcedit2.editorsession.EditorSession
    """
    box = editorSession.currentSelection
    if box is None or box.volume == 0:
        return

    widget = getFillWidget(editorSession)
    if widget.exec_():
        command = SimpleRevisionCommand(editorSession, "Fill")
        with command.begin():
            task = editorSession.currentDimension.fillBlocksIter(box, widget.blockTypeInput.block)
            showProgress("Filling...", task)
        editorSession.pushCommand(command)
开发者ID:101baja202,项目名称:mcedit2,代码行数:16,代码来源:fill.py


示例17: removeEntries

    def removeEntries(self, entries):
        def _remove():
            for result in entries:
                ref = result.getTargetRef()
                tag = result.getTargetTag()
                
                for component in result.path[:-1]:
                    tag = tag[component]
                
                del tag[result.tagName]
                ref.dirty = True
                
                yield
            
            self.resultsModel.removeEntries(entries)

        with self.editorSession.beginSimpleCommand(self.tr("Remove NBT tags")):
            showProgress("Removing NBT tags...", _remove())
开发者ID:mcedit,项目名称:mcedit2,代码行数:18,代码来源:nbt.py


示例18: toolActive

    def toolActive(self):
        self.editorSession.selectionTool.hideSelectionWalls = True
        if self.currentImport is None:
            # Need to cut out selection
            # xxxx for huge selections, don't cut, just do everything at the end?
            if self.editorSession.currentSelection is None:
                return
            export = self.editorSession.currentDimension.exportSchematicIter(self.editorSession.currentSelection)
            schematic = showProgress("Copying...", export)
            pos = self.editorSession.currentSelection.origin
            pendingImport = PendingImport(schematic, pos, self.tr("<Moved Object>"))
            moveCommand = MoveSelectionCommand(self, pendingImport)

            with moveCommand.begin():
                fill = self.editorSession.currentDimension.fillBlocksIter(self.editorSession.currentSelection, "air")
                showProgress("Clearing...", fill)

            self.editorSession.pushCommand(moveCommand)
开发者ID:EvilSupahFly,项目名称:mcedit2,代码行数:18,代码来源:move.py


示例19: confirmClone

    def confirmClone(self):
        if self.mainPendingClone is None:
            return

        command = CloneFinishCommand(self, self.mainPendingClone, self.originPoint)

        with command.begin():
            tasks = []
            for clone in self.pendingClones:
                # TODO don't use intermediate schematic...
                destDim = self.editorSession.currentDimension
                dim, selection = clone.getSourceForDim(destDim)

                task = destDim.copyBlocksIter(dim, selection, clone.importPos,
                                              biomes=True, create=True, copyAir=False)
                tasks.append(task)

            showProgress(self.tr("Pasting..."), *tasks)

        self.editorSession.pushCommand(command)
开发者ID:mcedit,项目名称:mcedit2,代码行数:20,代码来源:clone.py


示例20: confirmImport

    def confirmImport(self):
        if self.currentImport is None:
            return

        command = MoveFinishCommand(self, self.currentImport)
        destDim = self.editorSession.currentDimension
        with command.begin():
            log.info("Move: starting")
            if self.currentImport.isMove:
                sourceDim = self.currentImport.importDim
                destBox = BoundingBox(self.currentImport.importPos, sourceDim.bounds.size)

                # Use intermediate schematic only if source and destination overlap.
                if sourceDim.bounds.intersect(destBox).volume:
                    log.info("Move: using temporary")
                    export = extractSchematicFromIter(sourceDim, self.currentImport.selection)
                    schematic = showProgress(self.tr("Copying..."), export)
                    sourceDim = schematic.getDimension()

            else:
                # Use source as-is
                sourceDim = self.currentImport.importDim

            # Copy to destination
            log.info("Move: copying")
            task = destDim.copyBlocksIter(sourceDim, sourceDim.bounds,
                                          self.currentImport.importPos,
                                          biomes=True, create=True,
                                          copyAir=self.copyAirCheckbox.isChecked())

            showProgress(self.tr("Pasting..."), task)

            log.info("Move: clearing")
            # Clear source
            if self.currentImport.isMove:
                fill = destDim.fillBlocksIter(self.currentImport.selection, "air")
                showProgress(self.tr("Clearing..."), fill)

        self.editorSession.pushCommand(command)
开发者ID:dzkdev,项目名称:mcedit2,代码行数:39,代码来源:move.py



注:本文中的mcedit2.util.showprogress.showProgress函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python nbt.load函数代码示例发布时间:2022-05-27
下一篇:
Python settings.Settings类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap