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


Python Task.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
    def __init__(self):
        Task.__init__(self)
        self.mouse                = pygame.mouse
        self.mouseListeners       = []
        self.keyListeners         = []
        self.systemListeners      = []
        self.priorityKeyListeners = []
        self.controls             = Controls()
        self.disableKeyRepeat()

        # Initialize joysticks
        pygame.joystick.init()
        self.joystickAxes = {}
        self.joystickHats = {}

        self.joysticks = [pygame.joystick.Joystick(id) for id in range(pygame.joystick.get_count())]
        for j in self.joysticks:
            j.init()
            self.joystickAxes[j.get_id()] = [0] * j.get_numaxes() 
            self.joystickHats[j.get_id()] = [(0, 0)] * j.get_numhats() 
        Log.debug("%d joysticks found." % (len(self.joysticks)))

        # Enable music events
        Audio.Music.setEndEvent(MusicFinished)

        # Custom key names
        self.getSystemKeyName = pygame.key.name
        pygame.key.name       = self.getKeyName
开发者ID:Hawkheart,项目名称:fof-reborn,代码行数:30,代码来源:Input.py

示例2: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self, engine, controlnum, samprate=44100):
   Task.__init__(self)
   self.engine = engine
   self.controlnum = controlnum
   devnum = self.engine.input.controls.micDevice[controlnum]
   if devnum == -1:
     devnum = None
     self.devname = pa.get_default_input_device_info()['name']
   else:
     self.devname = pa.get_device_info_by_index(devnum)['name']
   self.mic = pa.open(samprate, 1, pyaudio.paFloat32, input=True, input_device_index=devnum, start=False)
   if Config.get('game', 'use_new_pitch_analyzer') or not have_pypitch:
     self.analyzer = Analyzer(samprate)
   else:
     self.analyzer = pypitch.Analyzer(samprate)
   self.mic_started = False
   self.lastPeak    = 0
   self.detectTaps  = True
   self.tapStatus   = False
   self.tapThreshold = -self.engine.input.controls.micTapSensitivity[controlnum]
   self.passthroughQueue = []
   passthroughVolume = self.engine.input.controls.micPassthroughVolume[controlnum]
   if passthroughVolume > 0.0:
     Log.debug('Microphone: creating passthrough stream at %d%% volume' % round(passthroughVolume * 100))
     self.passthroughStream = Audio.MicrophonePassthroughStream(engine, self)
     self.passthroughStream.setVolume(passthroughVolume)
   else:
     Log.debug('Microphone: not creating passthrough stream')
     self.passthroughStream = None
开发者ID:Gamer125,项目名称:fofix,代码行数:31,代码来源:Microphone.py

示例3: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self, goal):
     Task.__init__(self)
     self.goal = goal
     self.path_request = None
     self.path = deque()
     self.stuck = False
     self.update = self.__request_path
开发者ID:elemel,项目名称:siblings-in-arms,代码行数:9,代码来源:tasks.py

示例4: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self, engine, mic):
   Task.__init__(self)
   self.engine = engine
   self.channel = None
   self.mic = mic
   self.playing = False
   self.volume = 1.0
开发者ID:HugoLnx,项目名称:fofix,代码行数:9,代码来源:Audio.py

示例5: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
    def __init__(self, name, **kwds):
        Task.__init__(self)
        self._name = name
        self._input_list = []
        self._output_list = []
        self._message_list = []

        # Optional arguments.
        if 'version' in kwds:
            self.version = kwds['version']

        # Update default user number.
        if self.userno == -1:
            self.userno = AIPS.userno

        # See if there is a proxy that can hand us the details for
        # this task.
        params = None
        for proxy in AIPS.proxies:
            try:
                inst = getattr(proxy, self.__class__.__name__)
                params = inst.params(name, self.version)
            except Exception, exception:
                if AIPS.debuglog:
                    print >>AIPS.debuglog, exception
                continue
            break
开发者ID:kernsuite-debian,项目名称:parseltongue,代码行数:29,代码来源:AIPSTask.py

示例6: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self, server, command):
     Task.__init__(self)
     self.server= server
     self.command=command
     
     self.name="ExecuteRemoteWinCommandTask"
     self.description= "this task is used to execute command on remote machine through rpyc"
     self.stat=TaskStatus.RUNNING
开发者ID:zhangjianleaves,项目名称:Dahe,代码行数:10,代码来源:ExecuteRemoteCommandTask.py

示例7: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self, machinename, localfile, remotefile):
     Task.__init__(self)
     
     self.name="DownloadFileTask"
     self.description="This task is used to download file from rpyc server"
     self.stat=TaskStatus.RUNNING
     
     self.machinename=machinename
     self.localfile=localfile
     self.remotefile=remotefile
开发者ID:zhangjianleaves,项目名称:Dahe,代码行数:12,代码来源:DownloadFileTask.py

示例8: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self, tasks):
     Task.__init__(self, 0, "Bundle-", 0, 0, 0, [])
     self.tasks     = tasks  # The Tasks in the bundle.
     self.TasksMap  = {}     # Mappings of tasks to days.
     self.SkillsMap = {}     # Mappings of skill hours to days.
     self.contents  = []     # IDs of the tasks in the bundle.
     
     self.initialize(tasks)
     self.calculateDays(tasks)
     self.allocate()
     self.distribute(tasks)        
开发者ID:oafbot,项目名称:ebmschedule,代码行数:13,代码来源:Bundle.py

示例9: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self, engine, channel, fileName):
   Task.__init__(self)
   self.engine       = engine
   self.fileName     = fileName
   self.channel      = channel.channel
   self.playing      = False
   self.bufferSize   = 1024 * 64
   self.bufferCount  = 8
   self.volume       = 1.0
   self.buffer       = numpy.zeros((2 * self.bufferSize, 2), dtype = numpy.int16)
   self.decodingRate = 4
   self._reset()
开发者ID:fretsonfire,项目名称:fof-python,代码行数:14,代码来源:Audio.py

示例10: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self, engine, geometry = None):
     Task.__init__(self)
     self.layers = []
     self.incoming = []
     self.outgoing = []
     self.visibility = {}
     self.transitionTime = 512.0
     self.geometry = geometry or glGetIntegerv(GL_VIEWPORT)
     self.savedGeometry = None
     self.engine = engine
     w = self.geometry[2] - self.geometry[0]
     h = self.geometry[3] - self.geometry[1]
     self.aspectRatio = float(w) / float(h)
开发者ID:Hawkheart,项目名称:fof-reborn,代码行数:15,代码来源:View.py

示例11: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
    def __init__(self, fileName,engine,speed = 1):
      Task.__init__(self)
      if not engine:
        engine = GameEngine.getEngine()
      self.engine       = engine
      self.fileName     = fileName
      self.channel      = None
      self.playing      = False
      self.bufferSize   = 1024 * 64
      self.bufferCount  = 8
      self.volume       = 1.0
      self.event = None
      self.speed = speed

        #myfingershurt: buffer is 2D array (one D for each channel) of 16-bit UNSIGNED integers / samples
        #  2*1024*64 = 131072 samples per channel
      self.buffer       = np.zeros((2 * self.bufferSize, 2),dtype=np.int16)

      self.decodingRate = 4
      self._reset()
开发者ID:zelurker,项目名称:fofix,代码行数:22,代码来源:Audio.py

示例12: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self, engine, geometry = None, screens = 1):
   Task.__init__(self)
   self.layers = []
   self.incoming = []
   self.outgoing = []
   self.visibility = {}
   self.transitionTime = 512.0
   self.engine = engine
   if geometry:
     self.geometry = list(geometry)
   else:
     self.geometry = list(glGetIntegerv(GL_VIEWPORT))
   w = self.geometry[2] - self.geometry[0]
   h = self.geometry[3] - self.geometry[1]
   self.aspectRatio = float(w) / float(h)
   self.geometryNormalized = [0,0,0,0]
   self.setNormalizedGeometry()
   self.geometryAll = None
   self.initGeometryAll()
   self.geometryAllHalf = None
   self.initGeometryAllHalf()
开发者ID:upgradeadvice,项目名称:fofix-grisly-virtualenv,代码行数:23,代码来源:View.py

示例13: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self):
     Task.__init__(self)
     self.name="ClearSystemCacheTask"
     self.description="this task is used to clear system caches"
     self.stat = self.RUNNING
     self.info = "clear system cache task is running"
开发者ID:zhangjianleaves,项目名称:Dahe,代码行数:8,代码来源:ClearSysCacheTask.py

示例14: __init__

# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import __init__ [as 别名]
 def __init__(self):
     Task.__init__(self)
     self.name="ConfigUnixIServerTask"
     self.description="this task is used to configure iServer on Unix machine"
     self.info="configure Linux iserver is started"
开发者ID:zhangjianleaves,项目名称:Dahe,代码行数:7,代码来源:ConfigUnixIServerTask.py

示例15: __init__

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

    self.logClassInits = Config.get("game", "log_class_inits")
    if self.logClassInits == 1:
      Log.debug("Input class init (Input.py)...")
  
    Task.__init__(self)
    self.mouse                = pygame.mouse
    self.mouseListeners       = []
    self.keyListeners         = []
    self.systemListeners      = []
    self.priorityKeyListeners = []
    self.controls             = Player.Controls()
    self.activeGameControls   = []
    self.p2Nav                = self.controls.p2Nav
    self.type1                = self.controls.type[0]
    self.keyCheckerMode       = Config.get("game","key_checker_mode")
    self.disableKeyRepeat()
    
    self.gameGuitars = 0
    self.gameDrums   = 0
    self.gameMics    = 0
    self.gameBots    = 0

    # Initialize joysticks
    pygame.joystick.init()
    self.joystickNames = {}
    self.joystickAxes  = {}
    self.joystickHats  = {}
    self.joyOff = False

    self.joysticks = [pygame.joystick.Joystick(id) for id in range(pygame.joystick.get_count())]
    for j in self.joysticks:
      j.init()
      self.joystickNames[j.get_id()] = j.get_name()
      self.joystickAxes[j.get_id()]  = [0] * j.get_numaxes() 
      self.joystickHats[j.get_id()]  = [(0, 0)] * j.get_numhats() 
    joyNum = len(self.joysticks)
    Log.debug("%d joysticks found." % (joyNum))
    oldJoyNum = Config.get("game", "joysticks")
    if joyNum != oldJoyNum:
      self.joyOff = True
    Config.set("game", "joysticks", joyNum)

    # Enable music events
    Audio.Music.setEndEvent(MusicFinished)
    #Audio.Music.setEndEvent()   #MFH - no event required?

    # Custom key names
    self.getSystemKeyName = pygame.key.name
    pygame.key.name       = self.getKeyName

    if haveMidi:
      if ports:
        Log.debug("%d MIDI inputs found." % (len(ports)))
        try:
          for i in ports:
            midi[i].openPort(i, False)
        except Exception, e:
          Log.error("Error opening MIDI port %d: %s" % (i,str(e)) )
      else:
        Log.warn("No MIDI input ports found.")
开发者ID:upgradeadvice,项目名称:fofix-grisly-virtualenv,代码行数:64,代码来源:Input.py


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