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'
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
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
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"
def __init__(self, height, width, **kwargs): self.height = height self.width = width Engine.__init__(self, height, width, **kwargs) self.cell_size = kwargs.get('cell_size', 10) self.rows = int(width / self.cell_size) self.columns = int((height / self.cell_size) + self.cell_size * 2) self.grid = np.zeros((self.columns, self.rows)) for x in range(len(self.grid)): for y in range(len(self.grid[x])): self.grid[x][y] = np.random.choice((True, False), 1, p=(0.1, 0.9))[0] self.colors = kwargs.get('colors', False)
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'
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)
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))
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)
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)
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
def __init__(self): # game state flag self.flag = 'alive' # importing configuration self.loadConf('game_config.conf') self.loadConf('settings.conf') #initializing engine Engine.__init__(self) self.level_creator() self.populator() # initializing screen initScreen.__init__(self) self.loadImages() # initializing sound initSound.__init__(self) self.sight = [] # tiles, seen to player; list of lists; changeable self.messages = []
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"
def __init__(self, uid): Engine.__init__(self) self.id = uid # model.pk self.data = {} # 数据
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)