コード例 #1
0
 def __init__(self):
     Component.__init__(self)
     #Any method and property missing will be given user feedback by python's traceback
     self.new(subsysA())
     self.new(subsysB())
     self.link(....)
     ...
コード例 #2
0
ファイル: Annotation.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr=None):
   Component.__init__(self,sschema,xrpr)
   if xrpr is not None:
     if xrpr.documentation is not None:
       self.documentation=map(lambda a:a.elt.elt,xrpr.documentation)
     if xrpr.appinfo is not None:
       self.appinfo=map(lambda a:a.elt.elt,xrpr.appinfo)
コード例 #3
0
    def __init__(self, obj, system, material, part):
        Component.__init__(self, obj, system, material)
        #obj.addProperty("App::PropertyFloat", "BendingStiffness", "Component", "Bending stiffness of the Component")

        obj.addProperty("App::PropertyFloat", "AreaMomentOfInertia",
                        "Structural", "Area moment of intertia.")
        obj.setEditorMode("AreaMomentOfInertia", 1)
        obj.addProperty("App::PropertyFloat", "RadiusOfGyration", "Structural",
                        "Radius of gyration.")
        obj.setEditorMode("RadiusOfGyration", 1)
        obj.addProperty("App::PropertyLink", "Part", "Structural",
                        "Reference to Part")
        obj.setEditorMode("Part", 1)
        obj.addProperty("App::PropertyLinkSub", "ShapeLink", "Structural",
                        "Reference to Shape of Part")

        obj.addProperty("App::PropertyFloatList", "Velocity", "Subsystem",
                        "Mean velocity.")
        obj.setEditorMode('Velocity', 1)
        obj.addProperty("App::PropertyFloatList", "VelocityLevel", "Subsystem",
                        "Velocity level.")
        obj.setEditorMode('VelocityLevel', 1)

        obj.Part = part
        obj.ShapeLink = (obj.Part, ['Shape'])

        obj.Label = part.Label + '_' + obj.ClassName
コード例 #4
0
    def __init__(self, src, actor=None):
        Component.__init__(self, actor)

        # TODO Include a mesh name (e.g. 'Dragon') as ID as well as src (e.g. '../res/models/Dragon.obj')
        self.src = src
        self.filepath = Context.getInstance().getResourcePath('models', src)

        # OpenGL version-dependent code (NOTE assumes major version = 3)
        self.vao = None
        if Context.getInstance().GL_version_minor > 0:  # 3.1 (or greater?)
            self.vao = glGenVertexArrays(1)
        else:  # 3.0 (or less?)
            self.vao = GLuint(0)
            glGenVertexArrays(1, self.vao)
        glBindVertexArray(self.vao)

        self.loadModel(self.filepath)

        self.vbo = VBO(self.meshData, GL_STATIC_DRAW)
        self.vbo.bind()

        glEnableVertexAttribArray(0)
        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * 4, self.vbo + 0)

        glEnableVertexAttribArray(1)
        glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * 4, self.vbo + 12)

        self.ebo = glGenBuffers(1)
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, self.ebo)
        glBufferData(GL_ELEMENT_ARRAY_BUFFER,
                     len(self.elements) * 4, self.elements, GL_STATIC_DRAW)
コード例 #5
0
    def __init__(self,
                 fanout,
                 depth,
                 spread=default_spread,
                 rootColor=default_rootColor,
                 edgeColor=default_edgeColor,
                 scale=default_scale,
                 actor=None):
        Component.__init__(self, actor)
        self.fanout = fanout
        self.depth = depth
        self.spread = spread
        self.rootColor = rootColor
        self.edgeColor = edgeColor
        self.scale = scale
        self.rootScale = self.scale  # NOTE this will also apply to children
        #self.childScale = np.float32([1.0, 1.0, 1.0])  # NOTE this will get compounded if the radial tree is a true hierarchy, better to use scale = 1 (default)

        # Recursively generate radial tree
        treeRoot = self.createRadialTree(
            self.fanout, self.depth, self.spread,
            isRoot=True)  # creates full hierarchy and returns root actor
        treeRoot.components['Transform'] = Transform(
            rotation=np.random.uniform(-pi / 2, pi / 2, size=3),
            scale=self.rootScale,
            actor=treeRoot
        )  # NOTE random rotation ensures child vectors are not always generated close to the same canonical vectors
        treeRoot.components['Material'] = Material(color=self.rootColor,
                                                   actor=treeRoot)
        treeRoot.components['Mesh'] = Mesh.getMesh(src=self.treeRootModelFile,
                                                   actor=treeRoot)

        # Attach this hierarchy to current actor
        self.actor.children.append(treeRoot)
コード例 #6
0
ファイル: Collider.py プロジェクト: Pallavistar/pyTANG
 def __init__(self, radius=default_radius, highlight=None, actor=None):
   Component.__init__(self, actor)
   self.radius = radius
   self.highlight = highlight
   
   self.isHighlighted = False  # a runtime property indicating whether this actor should be highlighted (due to a collision)
   self.normalColor = None  # will be set on first highlight
コード例 #7
0
ファイル: Mesh.py プロジェクト: Pallavistar/pyTANG
    def __init__(self, src, actor=None):
        Component.__init__(self, actor)

        # TODO Include a mesh name (e.g. 'Dragon') as ID as well as src (e.g. '../res/models/Dragon.obj')
        self.src = src
        self.filepath = Context.getInstance().getResourcePath('models', src)
        
        # OpenGL version-dependent code (NOTE assumes major version = 3)
        self.vao = None
        if Context.getInstance().GL_version_minor > 0:  # 3.1 (or greater?)
          self.vao = glGenVertexArrays(1)
        else:  # 3.0 (or less?)
          self.vao = GLuint(0)
          glGenVertexArrays(1, self.vao)
        glBindVertexArray(self.vao)

        self.loadModel(self.filepath)

        self.vbo = VBO(self.meshData, GL_STATIC_DRAW)
        self.vbo.bind()

        glEnableVertexAttribArray(0)
        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6*4, self.vbo+0)

        glEnableVertexAttribArray(1)
        glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6*4, self.vbo+12)
        
        self.ebo = glGenBuffers(1)
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, self.ebo)
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, len(self.elements)*4, self.elements, GL_STATIC_DRAW)
コード例 #8
0
ファイル: Collider.py プロジェクト: rbgross/pyTANG
    def __init__(self, radius=default_radius, highlight=None, actor=None):
        Component.__init__(self, actor)
        self.radius = radius
        self.highlight = highlight

        self.isHighlighted = False  # a runtime property indicating whether this actor should be highlighted (due to a collision)
        self.normalColor = None  # will be set on first highlight
コード例 #9
0
ファイル: Container.py プロジェクト: buzztiaan/mediabox
    def __init__(self, plugins):
        """
        @param paths: paths where to look for components
        """
    
        self.__components = []
        self.__devices = []
        self.__whitelist = []
        
        Component.__init__(self)
        
        mods = self.__load_modules(plugins)
        delayed_mods = [ mod for mod in mods if hasattr(mod, "delayed") ]
        other_mods = [ mod for mod in mods if not hasattr(mod, "delayed") ]

        for mod in mods:
            self.__register_messages(mod)

        for mod in other_mods:
            self.__load_components(mod)

        self.__report_loadings()
        #self.emit_message(msgs.COM_EV_APP_STARTED)
        if (delayed_mods):
            gobject.idle_add(self.__load_delayed_modules, delayed_mods)
コード例 #10
0
 def __init__(self,port_type,master_num,slave_num):
     Component.__init__(self)
     for i in range(master_num):
         eval("self.new(m%d=port_type())" %i)
         eval("self.VImpPort(self.m%d)"   %i)
     for i in range(master_num):
         eval("self.new(s%d=port_type())" %i)
         eval("self.VImpPort(self.s%d)"   %i)
コード例 #11
0
ファイル: Dialog.py プロジェクト: buzztiaan/mediabox
    def __init__(self):

        self.__title = ""
        self.__info = ""

        Component.__init__(self)
        Window.__init__(self, Window.TYPE_SUBWINDOW)
        self.connect_closed(self.__on_close_window)
コード例 #12
0
ファイル: KCons.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr):
   Component.__init__(self,sschema,xrpr)
   if xrpr is not None:
     self.fields=map(lambda x:XPath(x.xpath,x.elt.namespaceDict),
                     xrpr.fields)
     self.selector=XPath(xrpr.selector.xpath,
                               xrpr.selector.elt.namespaceDict)
     self.register('identity constraint', self.schema.keyUniqueTable)
コード例 #13
0
ファイル: Group.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr=None,surrogate=None):
   Component.__init__(self,sschema,xrpr)
   if xrpr is not None and self.compositor:
     self.particles=map(lambda p:p.component,
                        filter(lambda p:p.component is not None,xrpr.model))
   elif surrogate is not None:
     # really for errors only
     self.xrpr=surrogate
コード例 #14
0
ファイル: AttributeUse.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr,attributeDeclaration=None,use=None,vct=None,
              value=None):
   Component.__init__(self,sschema,xrpr,None)
   if use is not None:
     (self.minOccurs,self.maxOccurs)=_attrOccurs[use]
   if vct is not None:
     self.valueConstraint=(vct,value)
   if attributeDeclaration is not None:
     self.attributeDeclaration=attributeDeclaration
コード例 #15
0
ファイル: Particle.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr=None,term=None,surrogate=None):
   Component.__init__(self,sschema,xrpr,None)
   if xrpr is not None:
     self.occurs=_computeMinMax(xrpr.minOccurs or "1",xrpr.maxOccurs,self)
   elif surrogate is not None:
     # for errors only
     self.xrpr=surrogate
   if term is not None:
     self.term=term
コード例 #16
0
 def __init__(self):
     Component.__init__(self)
     #Users can use any dynamic feature here
     self.new(fab1=AXI_FAB(PortAXI4,1,2))
     self.new(x2x1=X2X(PortAXI4))
     self.new(x2x2=X2X(PortAXI4))
     self.link(....)
     ...
     ..
コード例 #17
0
ファイル: Tank.py プロジェクト: TRCSpace/Demo7
 def __init__(self):
   Component.__init__(self)
   
   # Placeholder parameters for testing.
   # All diameters in mm.
   self.parameters['diameter'] = 77
   # diameter = combustor diameter
   self.parameters['length'] = 77
   # length defined by volume of propellant required
   self.parameters['wall_thickness'] = 77
コード例 #18
0
    def __init__(self):
        Component.__init__(self)

        # Placeholder parameters for testing.
        # All diameters in mm.
        self.parameters['diameter'] = 77
        # diameter = combustor diameter
        self.parameters['length'] = 77
        # length defined by volume of propellant required
        self.parameters['wall_thickness'] = 77
コード例 #19
0
    def __init__(self):

        Component.__init__(self)

        # create directory for thumbnails if it doesn't exist yet
        try:
            if (not os.path.exists(self.__THUMB_FOLDER)):
                os.makedirs(self.__THUMB_FOLDER)
        except:
            pass
コード例 #20
0
    def __init__(self, master, **kargs):
        Component.__init__(self, master, 'Battery Bank', **kargs)

        self.chg_cycle_count = [0, 0]
        self.tot_cycles = 0
        self.bnk_vo = 0
        self.soc = 1.0
        self.cur_cap = None
        self.max_dischg_cycles = None
        self.max_dischg_dod = None
コード例 #21
0
 def __init__(self, master, **kargs):
     self.curloc = None
     self.air_temp = None
     self.wind_spd = None
     self.atmospherics = None
     self.suntimes = None
     Component.__init__(self, master, 'Site Definition', **kargs)
     self.print_order = ['proj', 'client', 'p_desc', 'city', 
                         'cntry', 'lat', 'lon', 'elev', 'tz',
                         'gv', 'gf']               
コード例 #22
0
    def __init__(self):
        Component.__init__(self)
        self.new(m1=PortAXI4())
        self.new(m2=PortAXI4())
        self.new(s1=PortAXI4())
        self.new(s2=PortAXI4())

        self.VImpPort(self.m1)
        self.VImpPort(self.m2)
        self.VImpPort(self.s1)
        self.VImpPort(self.s2)
コード例 #23
0
ファイル: Union.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr):
   Component.__init__(self,sschema,xrpr)
   if xrpr.memberTypes:
     self.membertypeNames=map(lambda n,e=xrpr.elt,f=sschema:QName(n,e,f),
                              xrpr.memberTypes.split())
   if xrpr.subTypes:
     self.someMembers=map(lambda sub:sub.component,
                          xrpr.subTypes)
   elif not xrpr.memberTypes:
     # no elt means builtin
     if xrpr.elt is not None:
       self.error("union must have 'memberTypes' attribute or some SimpleType children")
コード例 #24
0
ファイル: Element.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr=None,scope=None):
   if (type(scope) is types.StringType or (xrpr and xrpr.form=='qualified')):
     ns='ns'
   else:
     ns=None
   Component.__init__(self,sschema,xrpr,ns)
   if xrpr is not None:
     if type(scope) is types.StringType:
       self.scope=scope
     else:
       self.scopeRepr=scope              # an xrpr, component not available yet
     self.abstract=xrpr.abstract or 'false'
     self.nullable=xrpr.nullable or 'false'
     if xrpr.substitutionGroup is not None:
       self.equivClassName = QName(xrpr.substitutionGroup,xrpr.elt,
                                   sschema)
     if xrpr.final=='':
       self.final=()
     else:
       self.final=xrpr.final.split()
     if '#all' in self.final:
       self.final=('restriction','extension')
     if xrpr.block=='':
       self.prohibitedSubstitutions=()
     else:
       self.prohibitedSubstitutions=xrpr.block.split()
     if '#all' in self.prohibitedSubstitutions:
       self.prohibitedSubstitutions=('restriction','extension','substitution')
     if xrpr.type is not None:
       self.typeDefinitionName=QName(xrpr.type,xrpr.elt,
                                     sschema)
       if xrpr.simpleType or xrpr.complexType:
         self.error("declaration with 'type' attribute must not have nested type declaration")
     elif xrpr.simpleType is not None:
       self.typeDefinition=xrpr.simpleType.component
     elif xrpr.complexType is not None:
       self.typeDefinition=xrpr.complexType.component
     elif not self.equivClassName:
       self.typeDefinition=Type.urType
     if xrpr.fixed is not None:
       # todo: check vc against type
       self.valueConstraint=('fixed',xrpr.fixed)
     elif xrpr.default is not None:
       self.valueConstraint=('default',xrpr.default)
     self.keys=map(lambda e:e.component,xrpr.keys)
     self.keyrefs=map(lambda e:e.component,xrpr.keyrefs)
     self.uniques=map(lambda e:e.component,xrpr.uniques)
   else:
     self.keys=[]
     self.uniques=[]
     self.keyrefs=[]
コード例 #25
0
 def __init__(self):
     Component.__init__(self)
     self.new(m1 = PortAXI4())
     self.new(m2 = PortAXI4())
     self.new(s1 = PortAXI4())
     self.new(s2 = PortAXI4())
     self.new(fab1 = AXI_FAB_2x2())
     self.new(fab2 = AXI_FAB_2x2())
     self.fab1.bi_direction = True
     self.fab2.bi_direction = True
     self.link(self.m1,fab2.s1)
     self.link(self.m2,fab2.s2)
     self.link(self.s1,fab1.m1)
     self.link(self.s2,fab1.m2)
     self.link(fab1.s1,fab2.m1)
     self.link(fab2.s2,fab2.m2)
コード例 #26
0
ファイル: ComponentCavity.py プロジェクト: FRidh/Sea
 def __init__(self, obj, system, material, position):
     Component.__init__(self, obj, system, material)
     
     obj.addProperty("App::PropertyVector", "Position", "Cavity", "Position within the cavity.")
     obj.setEditorMode("Position", 1)
     obj.addProperty("App::PropertyLink", "Structure", "Structure", "Fused structure.")
     obj.setEditorMode("Structure", 2)
     
     obj.addProperty("App::PropertyFloatList", "Pressure", "Subsystem", "Mean pressure.")
     obj.setEditorMode('Pressure', 1)
     obj.addProperty("App::PropertyFloatList", "PressureLevel", "Subsystem", "Pressure level.")
     obj.setEditorMode('PressureLevel', 1)
     
     
     obj.Structure = system.Structure
     obj.Position = position
     self.execute(obj)
コード例 #27
0
ファイル: Cube.py プロジェクト: Pallavistar/pyTANG
 def __init__(self, scale=cube_scale, actor=None):
   Component.__init__(self, actor)
   Trackable.__init__(self)
   self.scale = scale
   
   # Scale vertices of base cube, specify edges, and initialize list of markers
   self.vertices = cube_vertices * self.scale
   self.vertex_colors = cube_vertex_colors
   self.vertex_scale = 0.3 * self.scale  # NOTE for rendering only, depends on 3D model
   
   self.edges = cube_edges
   self.edge_scale = 0.1 * self.scale  # NOTE for rendering only, depends on 3D model
   self.edge_color = np.float32([0.8, 0.7, 0.5])  # NOTE for rendering only
   # TODO make some of these parameters come from XML
   
   # NOTE Mark generated child actors (corners and edges) as transient, to prevent them from being exported in XML
   
   # Add spheres at cube corners (vertices) with appropriate color; also add color markers
   for vertex, colorName in zip(self.vertices, self.vertex_colors):
     vertexActor = Actor(self.actor.renderer, isTransient=True)
     vertexActor.components['Transform'] = Transform(translation=vertex, scale=self.vertex_scale, actor=vertexActor)
     vertexActor.components['Material'] = Material(color=colors_by_name[colorName], actor=vertexActor)
     vertexActor.components['Mesh'] = Mesh.getMesh(src="SmallSphere.obj", actor=vertexActor)
     self.actor.children.append(vertexActor)
     marker = ColorMarker(self, colorName)
     marker.worldPos = vertex
     self.markers.append(marker)
   
   # Add edges
   for u, v in self.edges:
     if u < len(self.vertices) and v < len(self.vertices) and self.vertices[u] is not None and self.vertices[v] is not None:  # sanity check
       midPoint = (self.vertices[u] + self.vertices[v]) / 2.0
       diff = self.vertices[v] - self.vertices[u]
       mag = np.linalg.norm(diff, ord=2)
       xy_mag = hypot(diff[0], diff[1])
       #zx_mag = hypot(diff[2], diff[0])
       rotation = np.degrees(np.float32([atan2(diff[1], diff[0]), acos(diff[1] / mag), 0])) if (mag != 0 and xy_mag != 0) else np.float32([0.0, 0.0, 0.0])
       #print "u: ", self.vertices[u], ", v: ", self.vertices[v], ", v-u: ", diff, ", mag: ", mag, ", rot:", rotation
       edgeActor = Actor(self.actor.renderer, isTransient=True)
       edgeActor.components['Transform'] = Transform(translation=midPoint, rotation=rotation, scale=self.edge_scale, actor=edgeActor)
       edgeActor.components['Material'] = Material(color=self.edge_color, actor=edgeActor)
       edgeActor.components['Mesh'] = Mesh.getMesh(src="CubeEdge.obj", actor=edgeActor)  # TODO fix Z-fighting issue and use CubeEdge_cylinder.obj
       self.actor.children.append(edgeActor)
コード例 #28
0
ファイル: RadialTree.py プロジェクト: Pallavistar/pyTANG
 def __init__(self, fanout, depth, spread=default_spread, rootColor=default_rootColor, edgeColor=default_edgeColor, scale=default_scale, actor=None):
   Component.__init__(self, actor)
   self.fanout = fanout
   self.depth = depth
   self.spread = spread
   self.rootColor = rootColor
   self.edgeColor = edgeColor
   self.scale = scale
   self.rootScale = self.scale  # NOTE this will also apply to children
   #self.childScale = np.float32([1.0, 1.0, 1.0])  # NOTE this will get compounded if the radial tree is a true hierarchy, better to use scale = 1 (default)
   
   # Recursively generate radial tree
   treeRoot = self.createRadialTree(self.fanout, self.depth, self.spread, isRoot=True)  # creates full hierarchy and returns root actor
   treeRoot.components['Transform'] = Transform(rotation=np.random.uniform(-pi/2, pi/2, size=3), scale=self.rootScale, actor=treeRoot)  # NOTE random rotation ensures child vectors are not always generated close to the same canonical vectors 
   treeRoot.components['Material'] = Material(color=self.rootColor, actor=treeRoot)
   treeRoot.components['Mesh'] = Mesh.getMesh(src=self.treeRootModelFile, actor=treeRoot)
   
   # Attach this hierarchy to current actor
   self.actor.children.append(treeRoot)
コード例 #29
0
ファイル: ComponentCavity.py プロジェクト: kaktusth/Sea
    def __init__(self, obj, system, material, position):
        Component.__init__(self, obj, system, material)

        obj.addProperty("App::PropertyVector", "Position", "Cavity",
                        "Position within the cavity.")
        obj.setEditorMode("Position", 1)
        obj.addProperty("App::PropertyLink", "Structure", "Structure",
                        "Fused structure.")
        obj.setEditorMode("Structure", 2)

        obj.addProperty("App::PropertyFloatList", "Pressure", "Subsystem",
                        "Mean pressure.")
        obj.setEditorMode('Pressure', 1)
        obj.addProperty("App::PropertyFloatList", "PressureLevel", "Subsystem",
                        "Pressure level.")
        obj.setEditorMode('PressureLevel', 1)

        obj.Structure = system.Structure
        obj.Position = position
        self.execute(obj)
コード例 #30
0
ファイル: ComponentStructural.py プロジェクト: FRidh/Sea
 def __init__(self, obj, system, material, part):
     Component.__init__(self, obj, system, material)
     #obj.addProperty("App::PropertyFloat", "BendingStiffness", "Component", "Bending stiffness of the Component")
     
     obj.addProperty("App::PropertyFloat", "AreaMomentOfInertia", "Structural", "Area moment of intertia.")
     obj.setEditorMode("AreaMomentOfInertia", 1)
     obj.addProperty("App::PropertyFloat", "RadiusOfGyration", "Structural", "Radius of gyration.")
     obj.setEditorMode("RadiusOfGyration", 1)
     obj.addProperty("App::PropertyLink","Part","Structural", "Reference to Part")
     obj.setEditorMode("Part", 1)
     obj.addProperty("App::PropertyLinkSub", "ShapeLink", "Structural", "Reference to Shape of Part")
     
     obj.addProperty("App::PropertyFloatList", "Velocity", "Subsystem", "Mean velocity.")
     obj.setEditorMode('Velocity', 1)
     obj.addProperty("App::PropertyFloatList", "VelocityLevel", "Subsystem", "Velocity level.")
     obj.setEditorMode('VelocityLevel', 1)
     
     
     obj.Part = part
     obj.ShapeLink = (obj.Part, ['Shape'])
     
     obj.Label = part.Label + '_' + obj.ClassName
コード例 #31
0
ファイル: PPM.py プロジェクト: Neurosion/RCInputMapper
    def __init__(self, channelCount, muteAudio = False):
        Component.__init__(self, "PPM Audio Signal Generator")
        self.SamplesPerMillisecond = 100 # min channel duration is .5ms, max is 1.5ms, usable duration is 1ms, 100% in 1ms = 100 samples
        self.BitRate = self.SamplesPerMillisecond * 1000
        self.LowValue = chr(0)
        self.HighValue = chr(127)
        self.FrameLength = 22.5 # ms
        self.FrameSamples = self.SamplesPerMillisecond * self.FrameLength
        self.MaximumChannelLength = self.SamplesPerMillisecond * 1.7
        self.MinimumChannelLength = self.SamplesPerMillisecond * .53 # slightly more than min, input seems to swap empty channels if I don't do this
        self.ChannelValueMilliseconds = self.MaximumChannelLength - self.MinimumChannelLength
        self.ChannelSeparatorLength = self.SamplesPerMillisecond * .4
        self.ChannelSeparatorBlock = self.LowValue * int(self.ChannelSeparatorLength)
        self.__channelCount = channelCount
        self.__audio = None

        if not muteAudio:
            self.__audio = pyaudio.PyAudio()

        self.__stream = None
        self.__isStarted = False
        self.__buffer = self.LowValue * int(self.FrameSamples) # prime buffer with nothing, prevent stream starvation
コード例 #32
0
ファイル: Attribute.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr,scope=None):
   if (type(scope) is types.StringType or (xrpr and xrpr.form)=='qualified'):
     ns='ns'
   else:
     ns=None
   Component.__init__(self,sschema,xrpr,ns)
   if xrpr is not None:
     if type(scope) is types.StringType:
       self.scope=scope
       if xrpr.default!=None:
         self.valueConstraint=('default',xrpr.default)
       elif xrpr.fixed!=None:
         self.valueConstraint=('fixed',xrpr.fixed)
     else:
       self.scopeRepr=scope
     if xrpr.type is not None:
       self.typeDefinitionName=QName(xrpr.type,xrpr.elt,
                                     sschema)
       if xrpr.simpleType is not None:
         self.error("declaration with 'type' attribute must not have nested type declaration")
     elif xrpr.simpleType is not None:
       self.typeDefinition=xrpr.simpleType.component
     else:
       self.typeDefinition=Type.urSimpleType
コード例 #33
0
 def __init__(self, emf, name, inpt_wire=None, outpt_wire=None):
     self.emf = emf
     Component.__init__(self,
                        name,
                        inpt_wire=inpt_wire,
                        outpt_wire=outpt_wire)
コード例 #34
0
 def __init__(self, **kwargs):
     Component.__init__(self, **kwargs)
     self._children = []
コード例 #35
0
 def __init__(self, color=np.float32([0.0, 0.0, 0.0]), actor=None):
   Component.__init__(self, actor)
   self.color = color
コード例 #36
0
 def __init__(self, master, **kargs):
     Component.__init__(self, master, 'Battery', **kargs)
コード例 #37
0
 def __init__(self, master, **kargs):
     self.pnlparms = None
     Component.__init__(self, master, 'PV Panel', **kargs)
コード例 #38
0
ファイル: Activity.py プロジェクト: AppSecAI-TEST/HunterLab
 def __init__(self, name, children):
     Component.__init__(self, name, children)
     self.component_type = 'Activity'
コード例 #39
0
 def __init__(self, master, **kargs):
     Component.__init__(self, master, 'Charge Control', **kargs)
     self._chg_break = 0.85
コード例 #40
0
 def __init__(self, children):
     Component.__init__(self, 'Black Box', children)
     self.component_type = 'Black Box'
コード例 #41
0
 def __init__(self, master, **kargs):
     Component.__init__(self, master, 'PV Array', **kargs)
コード例 #42
0
ファイル: Type.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr):
   Component.__init__(self,sschema,xrpr,'ns')
   # todo: assemble annotation from ([sc]Content),restriction/(extension|list/union)
   if self.annotation is not None:
     self.annotations=[self.annotation]
コード例 #43
0
    def __init__(self):

        Component.__init__(self)
        _Widget.__init__(self)
        self.set_visible(False)
コード例 #44
0
ファイル: AnyAttribute.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr,wildcard):
   Component.__init__(self,sschema,xrpr,None)
   self.wildcard=wildcard
コード例 #45
0
ファイル: Transform.py プロジェクト: rbgross/pyTANG
 def __init__(self, translation=np.float32([0.0, 0.0, 0.0]), rotation=np.float32([0.0, 0.0, 0.0]), scale=np.float32([1.0, 1.0, 1.0]), actor=None):
   Component.__init__(self, actor)
   
   self.translation = translation
   self.rotation = rotation
   self.scale = scale
コード例 #46
0
ファイル: Ur.py プロジェクト: vimov/Deployer
 def __init__(self,sschema):
   Component.__init__(self,sschema,None)
コード例 #47
0
ファイル: Wildcard.py プロジェクト: vimov/Deployer
 def __init__(self,sschema,xrpr=None,extra=0):
   Component.__init__(self,sschema,xrpr)
   if xrpr is not None:
     self.processContents=xrpr.processContents
コード例 #48
0
    def __init__(self):

        self.__is_active = False

        Component.__init__(self)
        Widget.__init__(self)
コード例 #49
0
    def __init__(self, scale=cube_scale, actor=None):
        Component.__init__(self, actor)
        Trackable.__init__(self)
        self.scale = scale

        # Scale vertices of base cube, specify edges, and initialize list of markers
        self.vertices = cube_vertices * self.scale
        self.vertex_colors = cube_vertex_colors
        self.vertex_scale = 0.3 * self.scale  # NOTE for rendering only, depends on 3D model

        self.edges = cube_edges
        self.edge_scale = 0.1 * self.scale  # NOTE for rendering only, depends on 3D model
        self.edge_color = np.float32([0.8, 0.7,
                                      0.5])  # NOTE for rendering only
        # TODO make some of these parameters come from XML

        # NOTE Mark generated child actors (corners and edges) as transient, to prevent them from being exported in XML

        # Add spheres at cube corners (vertices) with appropriate color; also add color markers
        for vertex, colorName in zip(self.vertices, self.vertex_colors):
            vertexActor = Actor(self.actor.renderer, isTransient=True)
            vertexActor.components['Transform'] = Transform(
                translation=vertex, scale=self.vertex_scale, actor=vertexActor)
            vertexActor.components['Material'] = Material(
                color=colors_by_name[colorName], actor=vertexActor)
            vertexActor.components['Mesh'] = Mesh.getMesh(
                src="SmallSphere.obj", actor=vertexActor)
            self.actor.children.append(vertexActor)
            marker = ColorMarker(self, colorName)
            marker.worldPos = vertex
            self.markers.append(marker)

        # Add edges
        for u, v in self.edges:
            if u < len(self.vertices) and v < len(
                    self.vertices
            ) and self.vertices[u] is not None and self.vertices[
                    v] is not None:  # sanity check
                midPoint = (self.vertices[u] + self.vertices[v]) / 2.0
                diff = self.vertices[v] - self.vertices[u]
                mag = np.linalg.norm(diff, ord=2)
                xy_mag = hypot(diff[0], diff[1])
                #zx_mag = hypot(diff[2], diff[0])
                rotation = np.degrees(
                    np.float32([
                        atan2(diff[1], diff[0]),
                        acos(diff[1] / mag), 0
                    ])) if (mag != 0 and xy_mag != 0) else np.float32(
                        [0.0, 0.0, 0.0])
                #print "u: ", self.vertices[u], ", v: ", self.vertices[v], ", v-u: ", diff, ", mag: ", mag, ", rot:", rotation
                edgeActor = Actor(self.actor.renderer, isTransient=True)
                edgeActor.components['Transform'] = Transform(
                    translation=midPoint,
                    rotation=rotation,
                    scale=self.edge_scale,
                    actor=edgeActor)
                edgeActor.components['Material'] = Material(
                    color=self.edge_color, actor=edgeActor)
                edgeActor.components['Mesh'] = Mesh.getMesh(
                    src="CubeEdge.obj", actor=edgeActor
                )  # TODO fix Z-fighting issue and use CubeEdge_cylinder.obj
                self.actor.children.append(edgeActor)
コード例 #50
0
 def __init__(self):
     Component.__init__(self)
     self.port.new(s0=Port())
     self.port.new(s1=Port())
     self.port.new(m0=Port())
     self.port.new(m1=Port())