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


Python Engine.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self, autoConnect = False):
        Application.__init__(self)
        Engine.__init__(self)
        #ip, port = "cradle.dyndns.org", "10001"
        ip, port = "127.0.0.1", "10001"

        if not autoConnect:
            address = raw_input("server ('%s:%s') :> " % (ip, port))
            
            if address != "":
                split = address.split(":")
                ip = split[0]
                if len(split) == 2:
                    port = split[1]

        self.chat = gamenet.NetCode("cradle", "cradle.dyndns.org", "AV", "enter", "-".join([ip, port]))
        self.chat.registerMessageListener(self.messageListener)
        self.timeBetweenChatUpdates = 0.5
        self.timeUntilNextChatUpdate = 0.0            
            
        self.network = networkclient.NetworkClient(ip, int(port))
        self.timeBetweenNetworkUpdates = 0.02
        self.timeUntilNextNetworkUpdate = 0.0
        self.serverRoundTripTime = 0.0
        self.lastServerUpdate = time.time()
        self.player = None
开发者ID:cradle,项目名称:manic,代码行数:28,代码来源:client.py

示例2: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self, parent, englabel=None, userdict={}, 
                    timeout=10):
        """
        The PTK engine class for embedding in gtk applications. 
        To use create an instance of this or a subclass. 
        It uses the parent object for signals. 
        engine.disconnect() should also be called before the application exits.
        
        Important. 
        It uses the a the gtk mainloop to post/bind events and starts a 
        communications thread, therefore gtk.gdk.threads_init() must be called 
        before the main loop is started!

            gtk.gdk.threads_init()  
            gtk.main()

        Signals to use:
        'engine_disconnect' -  sent went the engine disconnects.

        Methods/attributes you might want to overload:
        _get_welcome()  - Returns a string welcome message.
        self.eng_prompts - these are the prompts used by the controlling console.
        """
        self.parent = parent
        
        #add the engine disconnect signal
        if gobject.signal_lookup("engine_disconnect", self.parent) == 0:
            gobject.signal_new("engine_disconnect", self.parent, 
                               gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,())
        Engine.__init__(self, englabel, userdict, timeout)
开发者ID:tito2016,项目名称:Python-Project,代码行数:32,代码来源:gtk_engine.py

示例3: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self, host_device, engine_id, config_source):
        """
        """
        Engine.__init__(self, host_device, engine_id, config_source)

        # check that we have all the required attributes for an f-engine
        assert hasattr(self, 'vacc_len'), 'x-engine must have a vector accumulator length'
开发者ID:sma-wideband,项目名称:corr2,代码行数:9,代码来源:xengine.py

示例4: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self, englabel=None, userdict={}, 
                    timeout=10):

        Engine.__init__(self, englabel, userdict, timeout)

        #---setup an event to indicate code to run------------------------------
        self._codeevent = threading.Event() #event to indicate code to run
        self._code = None  #code object to run in mainloop as the user
        self._exit = False #exit flag
开发者ID:tito2016,项目名称:Python-Project,代码行数:11,代码来源:py_engine.py

示例5: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self):
        Engine.__init__(self)
        port = 10001
        self.network = networkserver.NetworkServer(self.clientConnected, port)
        self.timeBetweenNetworkUpdates = 1.0/15.0
        self.timeUntilNextNetworkUpdate = 0.0
        self.clientNumber = 0
	self.debugNetworkTime = 0.0
	ip = "cradle.dyndns.org"
	self.serverChat = gamenet.NetCode("cradle", "cradle.dyndns.org", "AV-admin", "enter", "-".join([ip, str(port)]))
	self.serverChat.registerMessageListener(self.messageListenerConsole)
	self.serverChat.setNickName("server")
	self.timeBetweenChatUpdates = 0.5
	self.timeUntilNextChatUpdate = 0.0
        print "Server started"
开发者ID:cradle,项目名称:manic,代码行数:17,代码来源:server.py

示例6: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self, host_device, engine_id, ant_id, config_source):
        """
        :param ant_id: antenna input identity of data being processed
        :return: <nothing>
        """
        Engine.__init__(self, host_device, engine_id, config_source)
        self.ant_id = ant_id

        # check that we have all the required attributes for an f-engine
        assert hasattr(self, 'sample_bits'), 'f-engine must have the number of bits the ADC data uses'
        assert hasattr(self, 'adc_demux_factor'), 'f-engine must have the ADC demux factor (how many ADC samples' \
                                                  'we receive in parallel)'
        assert hasattr(self, 'bandwidth'), 'f-engine must have a specified bandwidth that is processed (from baseband)'
        assert hasattr(self, 'true_cf'), 'f-engine must have a specified center frequency'
        assert hasattr(self, 'n_chans'), 'f-engine must have a specified number of output channels'
        assert hasattr(self, 'min_load_time'), 'f-engine must have a minimum load time for delay tracking'
        assert hasattr(self, 'network_latency_adjust'), 'f-engine, network_latency_adjust config item missing'
        assert hasattr(self, 'inputs_per_fengine'), 'f-engine, inputs_per_fengine config item missing'
开发者ID:sma-wideband,项目名称:corr2,代码行数:20,代码来源:fengine.py

示例7: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self, userdict={}, doyield=None, timeout=10):
        """
        Create an internal engine object.

        userdict    -   Dictionary to execute user commands in.
        doyield     -   A callable to yield to a running mainloop (i.e. wx.Yield)
                        Used to allow the GUI to update and return stdinput and
                        ensure message are sent in the correct order.
        """        
        #call base class init
        Engine.__init__(self, englabel='Internal', userdict=userdict)

        #store reference to the user supplied callables
        self._doyield = doyield

        #for internal engines we need to replace the readevent and debugger
        #resume events and the send_msg/publish_msg methods to allow the GUI 
        #interface a chance to run
        self._readevent = PseudoEvent(self)
开发者ID:tito2016,项目名称:Python-Project,代码行数:21,代码来源:internal_engine.py

示例8: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self, fpga_host, engine_id, config_source):
        """
        :param fpga_host: the Casperfpga object that hosts this engine
        :param engine_id: engine number on this fpga
        :return:
        """
        """Constructor
        @param fpga_host: the link to the fpga that hosts this engine
        @param engine_id:
        @param host_instrument: the Instrument it is part of
        @param config_file: configuration if engine is to be used not as part of Instrument
        @param descriptor: section in config to locate engine specific info at
        """
        Engine.__init__(self, fpga_host, engine_id, config_source)

        assert hasattr(self, 'control_reg'), 'Engine on an fpga must have a control register.'
        assert hasattr(self, 'status_reg'), 'Engine on an fpga must have a status register'

        LOGGER.info('Casper FPGA engine created: host %s, engine_id %s', self.host, str(self.engine_id))
开发者ID:amitbansod,项目名称:corr2,代码行数:21,代码来源:engine_fpga.py

示例9: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self, parent, englabel=None, userdict={}, 
                    timeout=10):
        """
        The PTK engine class for embedding in pyside applications. 
        To use create an instance of this or a subclass. 
        It uses the parent object to for signals. 
        engine.disconnect() should also be called before the application exits.

        Signals to use:
        SigDisconnect -  sent went the engine disconnects.

        Methods/attributes you might want to overload:
        get_welcome()  - Returns a string welcome message.
        self.eng_prompts - these are the prompts used by the controlling console.
        """
        Engine.__init__(self, englabel, userdict, timeout)

        self._code = None
        self.parent = parent
        self.parent.connect(self.parent, QtCore.SIGNAL(SigCode), self.on_code)
开发者ID:tito2016,项目名称:Python-Project,代码行数:22,代码来源:pyside_engine.py

示例10: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self, parent, englabel=None, userdict={}, 
                    timeout=10):
        """
        The PTK engine class for embedding in TkInter applications. 
        To use create an instance of this or a subclass. 
        It uses the parent object to post.bind events.
        engine.disconnect() should also be called before the application exits.

        Evts to use:
        EvtDisconnect = "<<ENGINE_DISCONNECT>>" sent went the engine disconnects

        Methods/attributes you might want to overload:
        _get_welcome()  - Returns a string welcome message.
        self.eng_prompts - these are the prompts used by the controlling console.
        """
        Engine.__init__(self, englabel, userdict, timeout)
        self.parent = parent
        self._code = None

        #bind events
        self.parent.bind(EvtCode, self.on_engine_code)
开发者ID:tito2016,项目名称:Python-Project,代码行数:23,代码来源:tk_engine.py

示例11: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
    def __init__(self):
        Engine.__init__(self, 320, 240, (00, 150, 150))
        self.fps_text = None
        self.scoreP1_text = None
        self.scoreP1 = 0
        self.scoreP2_text = None
        self.scoreP2 = 0
        self.ball = None
        self.playerOne = None
        self.playerTwo = None
        self.fps_update = 0
        self.fps_count = 0

        self.sfx_beep = None
        self.sfx_padOne = None
        self.sfx_padTwo = None
        self.music_bg = None

        self.winner_text = None
        self.start_game_text = None
        self.max_score = 7
开发者ID:JackOfDawn,项目名称:GCW-Python,代码行数:23,代码来源:main.py

示例12: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import __init__ [as 别名]
 def __init__(self, _node, params):
     """ Constructor.
     node: the node associated with this engine"""
     logger = params[0]
     Engine.__init__(self, _node, logger)
     self._version = "0.3"
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:8,代码来源:control.py


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