当前位置: 首页>>代码示例>>Python>>正文


Python Camera.cleanup方法代码示例

本文整理汇总了Python中Camera.Camera.cleanup方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.cleanup方法的具体用法?Python Camera.cleanup怎么用?Python Camera.cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Camera.Camera的用法示例。


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

示例1: SVGBuild

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import cleanup [as 别名]

#.........这里部分代码省略.........
                    self.options['height'] = self.svg.root.attrib['height']

            except Exception as e:
                print 'error'
                self.finished.emit()
                return
            
            if self.options['fullpath']:
                defs_element = self.svg.root.find('{http://www.w3.org/2000/svg}defs')
                markers = defs_element.findall('{http://www.w3.org/2000/svg}marker')
                
                if len(markers) == 0:
                    self.addMarker(defs_element, self.options['marker'])
                else:
                   self.marker = '%s' % markers[0].attrib['id']

            self.printText.emit('Surveyed %d elements.' % elementCount)
            
            self.camera = Camera(self.options)
            self.camera.printText.connect(self.printText)
#            self.finished.emit()
#            return 0
            
            if self.camera.survey(self.svg):
                #self.printText.emit('ok')
                self.camera.move(self.svg.root.attrib['id'])
                self.build(self.svg, self.camera, self.svg.root, self.options)
                
                if self.isRunning:
                    self.printText.emit('Finishing...')
                    self.options['camera'] = False
                    self.camera.shoot(self.svg)
                    self.camera.hold(self.options['hold'])
                    self.camera.cleanup()
                else:
                    self.printText.emit('Canceled...')
            
            finish = time.time()
            hours = int((finish - start) / 60) / 60
            minutes = int((finish - start) / 60) % 60
            folder = self.options['folder']
            self.printText.emit('Finished %s to %s in %dh:%02dm.' % (self.filename, folder, hours, minutes))
            
        self.finished.emit()
        
    def build(self, svg, camera, entity, options):
        '''Recursively build up the given entity, by removing all its children
        and adding them back in one at a time, and shooting the progress with
        the given camera.
        '''
        
        if not self.isRunning: return

        id = entity.attrib['id']
        name = id
        label = 'http://www.inkscape.org/namespaces/inkscape}label'
        if label in entity.attrib:
            name = entity.attrib[label]
        print '%05d - Building up <%s id="%s"> (%s)...' % (camera.time, entity.tag, id, name)
        self.printText.emit('%05d - Building up <%s id="%s"> (%s)...' % (camera.time, entity.tag, id, name))

        nobuild = set([ '{http://www.w3.org/2000/svg}defs',
                        '{http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}namedview',
                        '{http://www.w3.org/2000/svg}metadata',
                        ])
开发者ID:fpermana,项目名称:svgbuild-gui,代码行数:69,代码来源:SVGBuild.py


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