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


Python Device.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, device, format=None, parents=None,
                 exists=True, size=None, major=None, minor=None,
                 sysfsPath='', serial=None, model="", vendor="", bus=""):
        """ Create a Disk instance.

            Arguments:

                device -- the device name (generally a device node's basename)

            Keyword Arguments:

                size -- the device's size (units/format TBD)
                major -- the device major
                minor -- the device minor
                sysfsPath -- sysfs device path
                format -- a DeviceFormat instance
                parents -- a list of required Device instances
                removable -- whether or not this is a removable device

            Disk always exist.
        """
        Device.__init__(self, device, format=format, size=size,
                        major=major, minor=minor, exists=exists,
                        model=model, serial=serial, vendor=vendor,bus=bus,
                        sysfsPath=sysfsPath, parents=parents)
开发者ID:MusaSakizci,项目名称:yali-family,代码行数:27,代码来源:disk.py

示例2: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, name, pattern=0):
        Device.__init__(self, name)
        self.ControlPanelClass = VideoTestGenControlPanel

        self.pattern = ObservableVariable(pattern)
        self.pattern.changed.connect(self.change_pattern)

        self.src = Gst.ElementFactory.make('videotestsrc', None)
        self.bin.add(self.src)
        self.src.set_property('pattern', self.pattern.get_value())

        self.convert = Gst.ElementFactory.make('videoconvert', None)
        self.bin.add(self.convert)

        self.text_overlay = Gst.ElementFactory.make('textoverlay', None)
        self.bin.add(self.text_overlay)
        self.text_overlay.set_property("text", self.name)
        self.text_overlay.set_property("shaded-background", True)

        self.caps_filter = Gst.ElementFactory.make('capsfilter', None)
        self.bin.add(self.caps_filter)

        caps = Gst.caps_from_string(Device.DEFAULT_VIDEO_CAPS)
        self.caps_filter.set_property('caps', caps)

        self.src.link(self.text_overlay)
        self.text_overlay.link(self.convert)
        self.convert.link(self.caps_filter)

        self.add_output_video_port_on(self.caps_filter, "src")
开发者ID:efirmaster,项目名称:open-playout,代码行数:32,代码来源:video_test_gen.py

示例3: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, id_):
        Device.__init__(self, id_)
        self.endpoint_for_router = None

        self.bits_sent_graph_tag = globals_.stats_manager.new_graph(
                title='Total Bits Sent by %s' % self.id_,
                ylabel='Total Bits'
        )
        self.bit_rate_sent_graph_tag = globals_.stats_manager.new_graph(
                title='Rate of Data Sent by %s' % self.id_,
                ylabel='Rate (bits/sec)',
                is_rate=True
        )
        self.bits_received_graph_tag = globals_.stats_manager.new_graph(
                title='Total Bits Received by %s' % self.id_,
                ylabel='Total Bits'
        )
        self.bit_rate_received_graph_tag = globals_.stats_manager.new_graph(
                title='Rate of Data Received by %s' % self.id_,
                ylabel='Rate (bits/sec)',
                is_rate=True
        )

        self.bits_sent = 0
        self.bits_received = 0
开发者ID:AGFeldman,项目名称:jaka,代码行数:27,代码来源:host.py

示例4: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
 def __init__(self, port, dimension=10, emulator=False):
     Device.__init__(self, "Cube", port)
     self.array = numpy.array([[\
             [0]*dimension]*dimension]*dimension, dtype='bool')
     self.dimension = dimension
     self.emulator = emulator
     self.name = "Cube"
开发者ID:MathewSam,项目名称:phosphene,代码行数:9,代码来源:cube.py

示例5: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, name):
        Device.__init__(self, name)
        self.ControlPanelClass = AudioTestGenControlPanel

        self.freqs = ObservableVariable([1000, 1000])
        self.freqs.changed.connect(self.change_freqs)

        caps = Gst.caps_from_string(self.SINGLE_CHANNEL_AUDIO_CAPS)

        self.src0 = Gst.ElementFactory.make('audiotestsrc', None)
        self.bin.add(self.src0)
        self.src0.set_property('is-live', True)

        self.src1 = Gst.ElementFactory.make('audiotestsrc', None)
        self.bin.add(self.src1)
        self.src1.set_property('is-live', True)

        self.interleave = Gst.ElementFactory.make('interleave', None)
        self.bin.add(self.interleave)

        self.src0.link_filtered(self.interleave, caps)
        self.src1.link_filtered(self.interleave, caps)

        self.add_output_audio_port_on(self.interleave, "src")

        self.change_freqs(self.freqs.get_value())
开发者ID:efirmaster,项目名称:open-playout,代码行数:28,代码来源:audio_test_gen.py

示例6: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
 def __init__(self, name, major=None, minor=None, exists=None,
              format=None, parents=None, sysfsPath='', vendor="",
              model=""):
     Device.__init__(self, name, format=format,
                     major=major, minor=minor, exists=True,
                     parents=parents, sysfsPath=sysfsPath,
                     vendor=vendor, model=model)
开发者ID:MusaSakizci,项目名称:yali-family,代码行数:9,代码来源:opticaldevice.py

示例7: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, width, height, fullscreen, mode=P2D):
        Device.__init__(self)

        self.mode = mode
        self.size = (width, height)

        pygame.init()
        pygame.key.set_mods(KMOD_NONE)
        pygame.mouse.set_visible(0)

        if mode == PygameDevice.P2D:
            flags = 0
            if fullscreen:
                flags = flags | pygame.locals.FULLSCREEN | pygame.locals.SWSURFACE

            self.graphicsDevice = PygameGraphics(self.size, flags)

        elif mode == PygameDevice.OGL:
            from openglgraphics import OpenGLGraphics
            
            flags = pygame.locals.OPENGL | pygame.locals.DOUBLEBUF
            if fullscreen:
                flags = flags | pygame.locals.FULLSCREEN

            self.graphicsDevice = OpenGLGraphics(self.size, flags, pygame.display.set_mode(self.size, flags))

        else:
            raise device.DeviceException("Invalid Graphics Mode Specified")
开发者ID:Ripsnorta,项目名称:pyui2,代码行数:30,代码来源:pygamedevice.py

示例8: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, width, height, fullscreen):
        print "glut::__init__()"
        Device.__init__(self)

        self.size = (width, height)
        self.fullscreen = fullscreen

        glutInit(sys.argv)
        glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)

        if self.fullscreen:
            glutGameModeString("%dx%d:[email protected]" % self.size )
            self.windowID = glutEnterGameMode()
        else:
            glutInitWindowSize(self.size[0], self.size[1])
            glutInitWindowPosition(0,0)
            self.windowID = glutCreateWindow("")

        glutSetWindow(self.windowID)

        glutReshapeFunc(self.reSizeGLScene)
        glutMouseFunc(self.onMouse)
        glutMotionFunc(self.onMotion)
        glutPassiveMotionFunc(self.onMotion)
        glutKeyboardFunc(self.onKeyDown)
        glutKeyboardUpFunc(self.onKeyUp)
        glutSpecialFunc(self.onSpecialDown)
        glutSpecialUpFunc(self.onSpecialUp)

        self.graphicsDevice = OpenGLGraphics(self.size)
开发者ID:Ripsnorta,项目名称:pyui2,代码行数:32,代码来源:glutdevice.py

示例9: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, name):
        Device.__init__(self, name)
        self.ControlPanelClass = DskControlPanel

        self.file = ObservableVariable()
        self.file.changed.connect(self.file_changed)

        self.alpha = ObservableVariable(0)
        self.alpha.changed.connect(self.alpha_changed)

        # While input convert doesn't seem explicitly necessary, it seems to
        # give better performance.  Not sure why.
        self.inputconvert = self.add_element('videoconvert')
        self.mixer = self.add_element('videomixer')
        self.outputconvert = self.add_element('videoconvert')

        self.add_input_video_port_on(self.inputconvert)
        self.inputconvert.link(self.mixer)

        self.mixer.link(self.outputconvert)
        self.add_output_video_port_on(self.outputconvert)

        self.mixer.get_static_pad('sink_0').set_property('zorder', 0)

        self.alpha.set_value(1.0)
开发者ID:efirmaster,项目名称:open-playout,代码行数:27,代码来源:dsk.py

示例10: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
 def __init__(self, identifier):
     Device.__init__(self, identifier)
     self.link = None
     self.flows = {}
     self.clock = None
     self.event_scheduler = None
     self.logger = None
     self.payload_packet_trackers = {}
开发者ID:ialexryan,项目名称:CS143-Project,代码行数:10,代码来源:host.py

示例11: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
 def __init__(self, house, xml):
     Device.__init__(self, house, xml)
     self.last_motion_time = None
     
     try:
         self.off_time = float(xml.find("timeout").text)
     except AttributeError:
         timeout = ET.SubElement(self.xml, "timeout")
         timeout.text = "60"
         self.off_time = 60.
开发者ID:tgvoskuilen,项目名称:pyHome,代码行数:12,代码来源:motionSensor.py

示例12: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
 def __init__(self, outlet, port):
     # Lighting class inherits from Device class
     # Device class methods are accessed using self.
     Device.__init__(self, outlet)
     self.DATABASE = DATABASE
     # where does cotwo max value come from?
     self.cotwo_max = 4.6
     # setup sensor server zmq context
     self.port = port
     self.context = zmq.Context()
     self.socket = self.context.socket(zmq.REQ)
开发者ID:bradburydoom,项目名称:smushBox,代码行数:13,代码来源:fae.py

示例13: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, house, xml):
        Device.__init__(self, house, xml)
        self.last_open_time = None
        self.state = ("Closed", 0.0)

        try:
            self.off_time = float(xml.find("timeout").text)
        except AttributeError:
            timeout = ET.SubElement(self.xml, "timeout")
            timeout.text = "60"
            self.off_time = 60.0
开发者ID:tgvoskuilen,项目名称:pyHome,代码行数:13,代码来源:opensensor.py

示例14: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, name):
        Device.__init__(self, name)

        self.queue = Gst.ElementFactory.make("queue", None)
        self.queue.set_property("max-size-time", 1000000)
        self.bin.add(self.queue)

        self.sink = Gst.ElementFactory.make("alsasink", None)
        self.bin.add(self.sink)

        self.add_input_audio_port_on(self.queue)
        self.queue.link(self.sink)
开发者ID:emergent-interfaces,项目名称:open-playout,代码行数:14,代码来源:audio_out.py

示例15: __init__

# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import __init__ [as 别名]
    def __init__(self, id_):
        Device.__init__(self, id_)
        # Map: host_id -> (LinkEndpoint,
        #                  estimated_cost_to_get_to_host_id_by_going_through_this_link_endpoint)
        self.routing_table = dict()
        self.provisional_routing_table = dict()

        # List of link endpoints whose links connect directly to hosts
        self.endpoints_to_hosts = []

        # Map: router_id -> endpoint of a link that connects to that router
        self.endpoints_to_routers = dict()
开发者ID:AGFeldman,项目名称:jaka,代码行数:14,代码来源:router.py


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