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


Python Collection.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
    def __init__(self, dash_atlas=None):
        self.dash_atlas = dash_atlas
        self.vtype = np.dtype([('a_center', 'f4', 2),
                               ('a_texcoord', 'f4', 2)])
        self.utype = np.dtype([('fg_color', 'f4', 4),
                               ('bg_color', 'f4', 4),
                               ('translate', 'f4', 2),
                               ('scale', 'f4', 1),
                               ('rotate', 'f4', 1),
                               ('radius', 'f4', 1),
                               ('linewidth', 'f4', 1),
                               ('antialias', 'f4', 1),
                               ('dash_phase', 'f4', 1),
                               ('dash_period', 'f4', 1),
                               ('dash_index', 'f4', 1),
                               ('dash_caps', 'f4', 2)])
        Collection.__init__(self, self.vtype, self.utype)

        if dash_atlas is None:
            self.dash_atlas = DashAtlas()
        else:
            self.dash_atlas = dash_atlas

        shaders = os.path.join(os.path.dirname(__file__),'shaders')
        vertex_shader= os.path.join( shaders, 'circles.vert')
        fragment_shader= os.path.join( shaders, 'circles.frag')

        self.shader = Shader( open(vertex_shader).read(),
                              open(fragment_shader).read() )
开发者ID:Eric89GXL,项目名称:gl-agg,代码行数:31,代码来源:circle_collection.py

示例2: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
    def __init__(self):
        self.vtype = np.dtype([('a_curr',      'f4', 3),
                               ('a_texcoord',  'f4', 2)])
        self.utype = np.dtype([('fg_color',    'f4', 4),
                               ('length',      'f4', 1),
                               ('linewidth',   'f4', 1),
                               ('antialias',   'f4', 1),
                               ('caps',        'f4', 2)])
        Collection.__init__(self, self.vtype, self.utype)
        dsize = self.vbuffer._dsize
        a_curr = self.vbuffer.attribute('a_curr')
        a_texcoord = self.vbuffer.attribute('a_texcoord')
        a_index = self.vbuffer.attribute('a_index')
        a_next = VertexAttribute(
            'a_next', a_curr.count, a_curr.gltype, a_curr.stride, a_curr.offset)
        a_prev = VertexAttribute(
            'a_prev', a_curr.count, a_curr.gltype, a_curr.stride, a_curr.offset)
        self.attributes.extend([a_prev, a_next])
        a_index.offset    += 2*dsize
        a_curr.offset     += 2*dsize
        a_texcoord.offset += 2*dsize
        a_next.offset     += 4*dsize

        shaders = os.path.join(os.path.dirname(__file__),'.')
        vertex_shader= os.path.join( shaders, 'lines.vert')
        fragment_shader= os.path.join( shaders, 'lines.frag')
        self.shader = Shader( open(vertex_shader).read(),
                              open(fragment_shader).read() )
开发者ID:gabr1e11,项目名称:GLSL-Examples,代码行数:30,代码来源:lines.py

示例3: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
    def __init__(self, base):
        Collection.__init__(self, Artist)

        self.base = base
        self.model = base.model

        self.populate()
开发者ID:dignan,项目名称:telemote,代码行数:9,代码来源:artist.py

示例4: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
    def __init__(self, shell):
        Collection.__init__(self, Source)

        self.shell = shell
        self.sources = {}
        self.sources_rev = {}
        self.source_id = 0

        self.add_source(self.shell.props.library_source)

        pm = self.shell.get_playlist_manager()

        for pl in pm.get_playlists():
            self.add_source(pl)

        pm.connect('playlist-added', self.on_playlist_added)
开发者ID:dignan,项目名称:telemote,代码行数:18,代码来源:source.py

示例5: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
 def __init__(self):
     self.vtype = np.dtype([('a_center',    'f4', 3),
                            ('a_texcoord',  'f4', 2)])
     self.utype = np.dtype([('fg_color',    'f4', 4),
                            ('bg_color',    'f4', 4),
                            ('translate',   'f4', 3),
                            ('scale',       'f4', 1),
                            ('radius',      'f4', 1),
                            ('linewidth',   'f4', 1),
                            ('antialias',   'f4', 1)])
     Collection.__init__(self, self.vtype, self.utype)
     shaders = os.path.join(os.path.dirname(__file__),'.')
     vertex_shader= os.path.join( shaders, 'scatter.vert')
     fragment_shader= os.path.join( shaders, 'scatter.frag')
     self.shader = Shader( open(vertex_shader).read(),
                           open(fragment_shader).read() )
开发者ID:gabr1e11,项目名称:GLSL-Examples,代码行数:18,代码来源:scatter.py

示例6: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
 def __init__(self, dash_atlas = None):
     self.vtype = np.dtype( [('a_texcoord', 'f4', 2)] )
     self.utype = np.dtype( [('translate',        'f4', 2),
                             ('scale',            'f4', 1),
                             ('rotate',           'f4', 1),
                             ('major_grid',       'f4', 2),
                             ('minor_grid',       'f4', 2),
                             ('major_tick_size',  'f4', 2),
                             ('minor_tick_size',  'f4', 2),
                             ('major_grid_color', 'f4', 4),
                             ('minor_grid_color', 'f4', 4),
                             ('major_tick_color', 'f4', 4),
                             ('minor_tick_color', 'f4', 4),
                             ('major_grid_width', 'f4', 1),
                             ('minor_grid_width', 'f4', 1),
                             ('major_tick_width', 'f4', 1),
                             ('minor_tick_width', 'f4', 1),
                             ('size',             'f4', 2),
                             ('offset',           'f4', 2),
                             ('zoom',             'f4', 1),
                             ('antialias',        'f4', 1),
                             ('major_dash_phase', 'f4', 1),
                             ('minor_dash_phase', 'f4', 1),
                             ('major_dash_index', 'f4', 1),
                             ('major_dash_period','f4', 1),
                             ('major_dash_caps',  'f4', 2),
                             ('minor_dash_period','f4', 1),
                             ('minor_dash_index', 'f4', 1),
                             ('minor_dash_caps',  'f4', 2)
                             ] )
     self.gtype = np.dtype( [('name', 'f4', (1024,4))] )
     Collection.__init__(self, self.vtype, self.utype)
     if dash_atlas is None:
         self.dash_atlas = DashAtlas()
     else:
         self.dash_atlas = dash_atlas
     shaders = os.path.join(os.path.dirname(__file__),'shaders')
     vertex_shader= os.path.join( shaders, 'grid.vert')
     fragment_shader= os.path.join( shaders, 'grid.frag')
     self.shader = Shader( open(vertex_shader).read(),
                           open(fragment_shader).read() )
     self._gbuffer = DynamicBuffer( self.gtype )
     self._gbuffer_shape = [0,4*1024]
     self._gbuffer_id = 0
开发者ID:Eric89GXL,项目名称:gl-agg,代码行数:46,代码来源:grid_collection.py

示例7: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
 def __init__(self, pid, metadata=True, stats=True, auth=None, def_name=None, cache=False, reset_cache=False):
     # set project
     self.cache = Ipy.NB_DIR+'/'+pid if cache else None
     project = None
     # hack to get variable name
     if def_name == None:
         try:
             (filename,line_number,function_name,text)=traceback.extract_stack()[-2]
             def_name = text[:text.find('=')].strip()
         except:
             pass
     self.defined_name = def_name        
     # reset cache if asked
     if reset_cache and os.path.isdir(self.cache):
         shutil.rmtree(self.cache)
     # make cache dir
     if self.cache and (not os.path.isdir(self.cache)):
         os.mkdir(self.cache)
     # try load from cached
     if self.cache and os.path.isdir(self.cache) and os.path.isfile(self.cache+'/'+pid+'.json'):
         try:
             project = json.load(open(self.cache+'/'+pid+'.json', 'rU'))
             sys.stdout.write("project '%s' loaded from cache %s\n"%(self.defined_name, pid))
         except:
             pass
     # load from api
     if project is None:
         project = self._get_project(pid, metadata, auth)
         if project and self.cache and os.path.isdir(self.cache):
             # cache it if dir given and not loaded from file
             try:
                 json.dump(project, open(self.cache+'/'+pid+'.json', 'w'))
                 sys.stdout.write("project '%s' saved to cache %s\n"%(self.defined_name, pid))
             except:
                 pass
     if project is None:
         self.id = pid
         self.name = None
         return
     for key, val in project.iteritems():
         setattr(self, key, val)
     # call collection init - from cache if given
     Collection.__init__(self, self.mgids(), metadata=metadata, stats=stats, auth=auth, def_name=self.defined_name, cache=self.cache)
开发者ID:paczian,项目名称:ipy-mkmq,代码行数:45,代码来源:project.py

示例8: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
 def __init__(self, pid, auth=None, def_name=None, cache=False):
     # set project
     self._cfile = Ipy.CCH_DIR+'/'+pid+'.json'
     project = None
     if cache and os.path.isfile(self._cfile):
         # try load from cache if given
         try:
             project = json.load(open(self._cfile, 'rU'))
             if Ipy.DEBUG:
                 sys.stdout.write("project %s loaded from cached file (%s)\n"%(pid, self._cfile))
         except:
             pass
     if project is None:
         # load from api
         project = self._get_project(pid, auth)
         if project and cache and os.path.isdir(Ipy.CCH_DIR):
             # save to cache if given
             try:
                 json.dump(project, open(self._cfile, 'w'))
                 if Ipy.DEBUG:
                     sys.stdout.write("project %s saved to cached file (%s)\n"%(pid, self._cfile))
             except:
                 pass
     if project is not None:
         for key, val in project.iteritems():
             setattr(self, key, val)
     else:
         self.id = pid
         self.name = None
         return
     # hack to get variable name
     if def_name == None:
         try:
             (filename,line_number,function_name,text)=traceback.extract_stack()[-2]
             def_name = text[:text.find('=')].strip()
         except:
             pass
     self.defined_name = def_name
     # call collection init - from cache if given
     Collection.__init__(self, self.mgids(), auth=auth, def_name=self.defined_name, cache=cache)
开发者ID:MG-RAST,项目名称:ipy-mkmq,代码行数:42,代码来源:project.py

示例9: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
 def __init__(self, storage, data=None, subs=None, table=None):
     Collection.__init__(self, storage, table)
     Model.__init__(self, data, subs)
开发者ID:ogoodman,项目名称:serf,代码行数:5,代码来源:collection_model.py

示例10: __init__

# 需要导入模块: from collection import Collection [as 别名]
# 或者: from collection.Collection import __init__ [as 别名]
    def __init__(self, base):
        Collection.__init__(self, Album)

        self.base = base

        self.populate()
开发者ID:jessevdk,项目名称:telemote,代码行数:8,代码来源:album.py


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