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

Python pyformex.debug函数代码示例

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

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



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

示例1: setToolbarPlacement

def setToolbarPlacement(store=None):
    """Ask placement of toolbars.

    Items in list should be existing toolbar widgets.
    """
    if store is None:
        store = GD.cfg
    toolbar = [ GD.gui.modebar, GD.gui.viewbar ]
    setting = ['gui/modebar', 'gui/viewbar' ]
    options = [ None, 'default', 'left', 'right', 'top', 'bottom' ]
    label = [ str(tb.windowTitle()) for tb in toolbar ]
    current = [ store[s] for s in setting ]
    itemlist = [(l, options[1], 'select', options) for (l,c) in zip(label,setting)]
    itemlist.append(('Store these settings as defaults', False))
    res = widgets.InputDialog(itemlist,'Config Dialog',GD.gui).getResult()
    if res:
        GD.debug(res)
        if res['Store these settings as defaults']:
            # The following  does not work for our Config class!
            #    store.update(res)
            # Therefore, we set the items individually
            for s,l in zip(setting,label):
                val = res[l]
                if val == "None":
                    val = None
                store[s] = val
        GD.debug(store)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:27,代码来源:prefMenu.py


示例2: __init__

 def __init__(self):
     """Initialize an empty canvas with default settings."""
     self.actors = ActorList(self,'actor')
     self.highlights = ActorList(self,'highlight')
     self.annotations = ActorList(self,'annotation')
     self.decorations = ActorList(self,'decoration')
     self.triade = None
     self.bbox = None
     self.resetLighting()
     self.resetLights()
     self.setBbox()
     self.settings = CanvasSettings()
     self.mode2D = False
     self.rendermode = 'wireframe'
     self.polygonfill = False
     self.lighting = True
     self.avgnormals = False
     self.alphablend = False
     self.dynamouse = True  # dynamic mouse action works on mouse move
     self.dynamic = None    # what action on mouse move
     self.camera = None
     self.view_angles = camera.view_angles
     self.cursor = None
     self.focus = False
     GD.debug("Canvas Setting:\n%s"% self.settings)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:25,代码来源:canvas.py


示例3: setToolbarPlacement

def setToolbarPlacement(store=None):
    """Ask placement of toolbars.

    Items in list should be existing toolbar widgets.
    """
    if store is None:
        store = GD.cfg
    toolbar = GD.GUI.toolbardefs
    label = [i[0] for i in toolbar]
    setting = ["gui/%s" % i[1] for i in toolbar]
    options = [None, "default", "left", "right", "top", "bottom"]
    current = [store[s] for s in setting]
    itemlist = [(l, options[1], "select", options) for (l, c) in zip(label, setting)]
    itemlist.append(("Store these settings as defaults", False))
    res = widgets.InputDialog(itemlist, "Config Dialog", GD.GUI).getResult()
    if res:
        GD.debug(res)
        if res["Store these settings as defaults"]:
            # The following  does not work for our Config class!
            #    store.update(res)
            # Therefore, we set the items individually
            for s, l in zip(setting, label):
                val = res[l]
                if val == "None":
                    val = None
                store[s] = val
        GD.debug(store)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:27,代码来源:prefMenu.py


示例4: drawFaces

def drawFaces(x,e,faces,mode,color=None,alpha=1.0):
    """Draw the faces of a geometry.

    This function draws the faces of a geometry collection, usually of a higher
    dimensionality (i.c. a volume).
    The faces are identified by a constant indices into all element vertices.

    The geometry is specified by x or (x,e)
    The faces are specified by a list of lists. Each list defines a single
    face of the solid, in local vertex numbers (0..nplex-1). The faces are
    sorted and collected according to their plexitude before drawing them. 
    """
    GD.debug("drawFaces")
    # We may have faces with different plexitudes!
    for fac in olist.collectOnLength(faces).itervalues():
        fa = asarray(fac)
        nplex = fa.shape[1]
        if e is None:
            coords = x[:,fa,:]
            elems = None
        else:
            coords = x
            elems = e[:,fa]
        GD.debug("COORDS SHAPE: %s" % str(coords.shape))
        if elems is not None:
            GD.debug("ELEMS SHAPE: %s" % str(elems.shape))
        if color is not None and color.ndim==3:
            GD.debug("COLOR SHAPE BEFORE EXTRACTING: %s" % str(color.shape))
            # select the colors of the matching points
            color = color[:,fa,:]
            color = color.reshape((-1,)+color.shape[-2:])
            GD.debug("COLOR SHAPE AFTER EXTRACTING: %s" % str(color.shape))
        draw_parts(coords,elems,mode,color,alpha)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:33,代码来源:drawable.py


示例5: draw

 def draw(self,*args,**kargs):
     clear()
     GD.debug("Drawing SELECTION: %s" % self.names)
     self._actors = draw(self.names,clear=False,shrink=self.shrink,*args,**kargs)
     for i,a in enumerate(self.annotations):
         if a[1]:
             self.drawAnnotation(i)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:objects.py


示例6: startGui

def startGui(args=[]):
    """Start the gui"""
    if pf.GUI is None:
        pf.debug("Starting the pyFormex GUI")
        from gui import guimain
        if guimain.startGUI(args) == 0:
            guimain.runGUI()
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:script.py


示例7: draw_parts

def draw_parts(x,e,mode,color=None,alpha=1.0):
    """Draw a collection of faces.

    (x,e) are one of:
    - x is a (nelems,nfaces,nplex,3) shaped coordinates and e is None,
    - x is a (ncoords,3) shaped coordinates and e is a (nelems,nfaces,nplex)
    connectivity array.
       
    Each of the nfaces sets of nplex points defines a polygon. 

    If color is given it is an (nel,3) array of RGB values. This function
    will multiplex the colors, so that n faces are drawn in the same color.
    This is e.g. convenient when drawing faces of a solid element.
    """
    if e is None:
        nfaces,nplex = x.shape[1:3]
        x = x.reshape(-1,nplex,3)
    else:
        nfaces,nplex = e.shape[1:3]
        e = e.reshape(-1,nplex)

    if color is not None:
        if color.ndim < 3:
            GD.debug("COLOR SHAPE BEFORE MULTIPLEXING %s" % str(color.shape))
            color = color_multiplex(color,nfaces)
            GD.debug("COLOR SHAPE AFTER  MULTIPLEXING %s" % str(color.shape))

    drawPolygons(x,e,mode,color,alpha)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:28,代码来源:drawable.py


示例8: flyAlong

def flyAlong(path='flypath',upvector=[0.,1.,0.],sleeptime=None):
    """Fly through the scene along the flypath."""
    if type(path) is str:
        path = named(path)
    if not path:
        warning("You have to define a flypath first!")
        return
    if path.nplex() != 2:
        warning("The flypath should be a plex-2 Formex!")
        
    for eye,center in path:
        GD.debug("Eye: %s; Center: %s" % (eye,center))
        GD.canvas.camera.lookAt(eye,center,upvector)
        GD.canvas.display()
        GD.canvas.update()
        image.saveNext()
        if sleeptime is None:
            sleeptime = GD.cfg['draw/flywait']
        sleeptime = float(sleeptime)
        if sleeptime > 0.0:
            sleep(sleeptime)

    GD.canvas.camera.setCenter(*center)
    GD.canvas.camera.setDist(coords.length(center-eye))
    GD.canvas.update()
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:25,代码来源:draw.py


示例9: draw

 def draw(self,**kargs):
     clear()
     pf.debug("Drawing SELECTION: %s" % self.names,pf.DEBUG.DRAW)
     self._actors = draw(self.names,clear=False,shrink=self.shrink,wait=False,**kargs)
     for f in self.annotations:
         pf.debug("Drawing ANNOTATION: %s" % f,pf.DEBUG.DRAW)
         self.drawAnnotation(f)
开发者ID:dladd,项目名称:pyFormex,代码行数:7,代码来源:objects.py


示例10: viewportSettings

def viewportSettings():
    """Interactively set the viewport settings."""
    mode = GD.canvas.rendermode
    modes = canvas.Canvas.rendermodes
    s = GD.canvas.settings
    if s.bgcolor2 is None:
        s.bgcolor2 = s.bgcolor
    itemlist = [('rendermode', mode, 'select', modes),
                ('linewidth', s.linewidth, 'float'),
                ('bgcolor', s.bgcolor, 'color'),
                ('bgcolor2', s.bgcolor2, 'color'),
                ('fgcolor', s.fgcolor, 'color'),
                ('slcolor', s.slcolor, 'color'),
                ('Store these settings as defaults', False),
                ]
    res = widgets.InputDialog(itemlist,'Config Dialog').getResult()
    if res:
        GD.debug(res)
        GD.canvas.updateSettings(res)
        GD.canvas.setRenderMode(res['rendermode'])
        #GD.canvas.clear()
        GD.canvas.redrawAll()
        GD.canvas.update()
        if res['Store these settings as defaults']:
            GD.cfg.update(GD.canvas.settings.__dict__,name='canvas')
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:25,代码来源:viewportMenu.py


示例11: createMovie

def createMovie(encoder='ffmpeg'):
    """Create a movie from a saved sequence of images.

    encoder is one of: 'ffmpeg, mencoder, convert'
    """
    if not multisave:
        pf.warning('You need to start multisave mode first!')
        return

    names,format,quality,window,border,hotkey,autosave,rootcrop = multisave
    glob = names.glob()
    ## if glob.split('.')[-1] != 'jpg':
    ##     pf.warning("Currently you need to save in 'jpg' format to create movies")
    ##     return

    if encoder == 'convert':
        cmd = "convert -delay 1 -colors 256 %s output.gif" % names.glob()
    elif encoder == 'mencoder':
        cmd = "mencoder -ovc lavc -fps 5 -o output.avi %s" % names.glob()
    elif encoder == 'mencoder1':
        cmd = "mencoder \"mf://%s\" -mf fps=10 -o output1.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800" % names.glob()
    else:
        cmd = "ffmpeg -qscale 1 -r 1 -i %s output.mp4" % names.glob()
    pf.debug(cmd)
    utils.runCommand(cmd)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:25,代码来源:image.py


示例12: runGUI

def runGUI():
    """Go into interactive mode"""
    
    egg = pf.cfg.get('gui/easter_egg',None)
    pf.debug('EGG: %s' % str(egg))
    if egg:
        pf.debug('EGG')
        if type(egg) is str:
            pye = egg.endswith('pye')
            egg = file(egg).read()
        else:
            pye = True
            egg = ''.join(egg)
        draw.playScript(egg,pye=True)

    if os.path.isdir(pf.cfg['workdir']):
        # Make the workdir the current dir
        os.chdir(pf.cfg['workdir'])
        pf.debug("Setting workdir to %s" % pf.cfg['workdir'])
    else:
        # Save the current dir as workdir
        prefMenu.updateSettings({'workdir':os.getcwd(),'Save changes':True})

    pf.interactive = True
    pf.debug("Start main loop")

    #utils.procInfo('runGUI')
    #from multiprocessing import Process
    #p = Process(target=pf.app.exec_)
    #p.start()
    #res = p.join()
    res = pf.app.exec_()
    pf.debug("Exit main loop with value %s" % res)
    return res
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:34,代码来源:guimain.py


示例13: save

    def save(self,quiet=False):
        """Save the project to file."""
        if 'w' not in self.access:
            pf.debug("Not saving because Project file opened readonly",pf.DEBUG.PROJECT)
            return

        if not quiet:
            print("Project variables changed: %s" % self.hits)

        if self.filename is None:
            import tempfile
            fd,fn = tempfile.mkstemp(prefix='pyformex_',suffix='.pyf')
            self.filename = fn
        else:
            if not quiet:
                print("Saving project %s with mode %s and compression %s" % (self.filename,self.mode,self.gzip))
            #print("  Contents: %s" % self.keys())
        f = open(self.filename,'w'+self.mode)
        # write header
        f.write("%s\n" % self.header_data())
        f.flush()
        if self.mode == 'b':
            # When using binary, can as well use highest protocol
            protocol = cPickle.HIGHEST_PROTOCOL
        else:
            protocol = 0
        if self.gzip:
            pyf = gzip.GzipFile(mode='w'+self.mode,compresslevel=self.gzip,fileobj=f)
            cPickle.dump(self,pyf,protocol)
            pyf.close()
        else:
            cPickle.dump(self,f,protocol)
        f.close()
        self.hits = 0
开发者ID:dladd,项目名称:pyFormex,代码行数:34,代码来源:project.py


示例14: viewportSettings

def viewportSettings():
    """Interactively set the viewport settings."""
    mode = pf.canvas.rendermode
    modes = canvas.Canvas.rendermodes
    s = pf.canvas.settings
    if s.bgcolor2 is None:
        s.bgcolor2 = s.bgcolor
    itemlist = [I('rendermode', mode, choices=modes),
                I('linewidth', s.linewidth, itemtype='float'),
                I('bgcolor', s.bgcolor, itemtype='color'),
                I('bgcolor2', s.bgcolor2, itemtype='color'),
                I('fgcolor', s.fgcolor, itemtype='color'),
                I('slcolor', s.slcolor, itemtype='color'),
                I('Store these settings as defaults', False),
                ]
    res = widgets.InputDialog(itemlist,'Config Dialog').getResult()
    if res:
        pf.debug(res)
        pf.canvas.setRenderMode(res['rendermode'])
        pf.canvas.settings.update(res,strict=False)
        #pf.canvas.clear()
        pf.canvas.redrawAll()
        pf.canvas.update()
        if res['Store these settings as defaults']:
            pf.cfg.update(pf.canvas.settings.__dict__,name='canvas')
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:25,代码来源:viewportMenu.py


示例15: refLookup

def refLookup(key):
    """Lookup a key in the reference configuration."""
    try:
        return pyformex.refcfg[key]
    except:
        pyformex.debug("!There is no key '%s' in the reference config!"%key)
        return None
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:main.py


示例16: cleanup

 def cleanup(self):
     """Cleanup the GUI (restore default state)."""
     GD.debug('GUI cleanup')
     self.drawlock.release()
     GD.canvas.cancel_selection()
     draw.clear_canvas()
     self.setBusy(False)
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:gui.py


示例17: raiseExit

def raiseExit():
    print "EEEEEEEEEEEEXXXXXXXXXXXXXXXXIIIIIIIIIIIIIIIITTTTTTTTTTTTTTTTTTT"
    pf.debug("RAISED EXIT")
    print scriptlock
    if pf.GUI:
        pf.GUI.drawlock.release()   
    raise _Exit,"EXIT REQUESTED FROM SCRIPT"
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:script.py


示例18: runGUI

def runGUI():
    """Go into interactive mode"""
    
    GD.debug("Start main loop")
    res = GD.app.exec_()
    GD.debug("Exit main loop")
    return res
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:7,代码来源:gui.py


示例19: saneColorSet

def saneColorSet(color=None,colormap=None,shape=(1,),canvas=None):
    """Return a sane set of colors.

    A sane set of colors is one that guarantees correct use by the
    draw functions. This means either
    - no color (None)
    - a single color
    - at least as many colors as the shape argument specifies
    - a color index and a color map with enough colors to satisfy the index.
    The return value is a tuple color,colormap. colormap will be None,
    unless color is an integer array, meaning a color index.
    """
    if isInt(shape):  # make sure we get a tuple
        shape = (shape,)
    color = saneColor(color)
    if color is not None:
        pf.debug("SANECOLORSET: color %s, shape %s" % (color.shape,shape),pf.DEBUG.DRAW)
        if color.dtype.kind == 'i':
            ncolors = color.max()+1
            if colormap is None:
                if canvas:
                    colormap = canvas.settings.colormap
                else:
                    colormap = pf.canvas.settings.colormap
                    #cfg['canvas/colormap']
            colormap = saneColor(colormap)
            colormap = saneColorArray(colormap,(ncolors,))
        else:
            color = saneColorArray(color,shape)
            colormap = None

        pf.debug("SANECOLORSET RESULT: %s" % str(color.shape),pf.DEBUG.DRAW)
    return color,colormap
开发者ID:dladd,项目名称:pyFormex,代码行数:33,代码来源:drawable.py


示例20: initialize

def initialize():
    """Initialize the image module."""
    global image_formats_qt, image_formats_qtr, image_formats_gl2ps, image_formats_fromeps, gl2ps, _producer, _gl2ps_types

    # Find interesting supporting software
    utils.hasExternal("ImageMagick")
    # Set some globals
    GD.debug("LOADING IMAGE FORMATS")
    image_formats_qt = map(str, QtGui.QImageWriter.supportedImageFormats())
    image_formats_qtr = map(str, QtGui.QImageReader.supportedImageFormats())
    if GD.cfg.get("imagesfromeps", False):
        GD.image_formats_qt = []

    if utils.hasModule("gl2ps"):

        import gl2ps

        _producer = GD.Version + " (http://pyformex.berlios.de)"
        _gl2ps_types = {"ps": gl2ps.GL2PS_PS, "eps": gl2ps.GL2PS_EPS, "tex": gl2ps.GL2PS_TEX, "pdf": gl2ps.GL2PS_PDF}
        if utils.checkVersion("gl2ps", "1.03") >= 0:
            _gl2ps_types.update({"svg": gl2ps.GL2PS_SVG, "pgf": gl2ps.GL2PS_PGF})
        image_formats_gl2ps = _gl2ps_types.keys()
        image_formats_fromeps = ["ppm", "png", "jpeg", "rast", "tiff", "xwd", "y4m"]
    if GD.options.debug:
        print "Qt image types for saving: ", image_formats_qt
        print "Qt image types for input: ", image_formats_qtr
        print "gl2ps image types:", image_formats_gl2ps
        print "image types converted from EPS:", image_formats_fromeps
开发者ID:BackupTheBerlios,项目名称:pyformex-svn,代码行数:28,代码来源:image.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pyformex.message函数代码示例发布时间:2022-05-25
下一篇:
Python pyAst.PyAstFreeVariableAnalyses类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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