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


Python Tracker.stop方法代码示例

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


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

示例1: __init__

# 需要导入模块: from tracker import Tracker [as 别名]
# 或者: from tracker.Tracker import stop [as 别名]
class Client:

    def __init__(self, config: ConfigurationFile):
        self.config = config
        self.database = Database(self.config.db_file)
        self.organizer = Organizer(self.config, self.config.db_file)
        self.downloader = Downloader(self.config.db_file, self.organizer,
                                     self.config)
        self.tracker = Tracker(self.config.db_file, self.downloader,
                               self.config.update_period)

        self.tracker.start()
        self.downloader.start()
        self.organizer.start()

    def add_tvshow(self, tvshow_id: int):
        tvshow_name = showrss.get_name(tvshow_id)
        self.database.put_tvshow(TVShow(tvshow_id, tvshow_name))

    def remove_tvshow(self, tvshow_id: int):
        self.database.remove_tvshow(tvshow_id)

    def list_tvshows(self):
        return self.database.tvshows()

    def list_episodes(self, state: EpisodeState = None):
        return self.database.episodes(state)

    def download_progress(self):
        return self.downloader.downloads()

    def exit(self):
        self.tracker.stop()
        self.downloader.stop()
开发者ID:davidfialho14,项目名称:showtracker,代码行数:36,代码来源:client.py

示例2: App

# 需要导入模块: from tracker import Tracker [as 别名]
# 或者: from tracker.Tracker import stop [as 别名]

#.........这里部分代码省略.........
		settings.update(kwargs)
		trialDir = "{0}_{1}_{2}".format(time.strftime("%y%m%d%H%M%S"),
				settings['experimentName'], settings['stimulator']['activeProtocolName'])
		settings['outputDataDir'] = os.path.join(settings['outputRootDir'], trialDir)
		self.keyBindings = settings['keyBindings']
		self.keycodeBindings = {k: getattr(opencvgui.keycodes, v)
				for k,v in self.keyBindings.items() }
		os.makedirs(os.path.join(settings['outputDataDir'], 'audio'))
		self.writeExperimentData(settings)
		for x in ['audio', 'videoOut', 'writer']:
			kwargs[x] = {} if not kwargs.has_key(x) else kwargs[x]
			kwargs[x]['outputDataDir'] = settings['outputDataDir']

		# gui and writer both need a reference to the app instance because they
		# draw on the state of so many other controllers
		self.audio = Audio(**settings['audio'])
		self.gui = Gui(self, **settings['gui'])
		self.stimulator = Stimulator(**settings['stimulator'])
		self.tracker = Tracker(**settings['tracker'])
		self.videoIn = VideoIn(**settings['videoIn'])
		self.videoOut = VideoOut(**settings['videoOut'])
		self.writer = Writer(self, **settings['writer'])

	def run(self):
		"""Respond to user input and run the master application loop.

		This method has three basic sections. Before the loop starts, the start()
		method is called on all controllers. The central loop calls update() on
		each controller until it is terminated by a user-issued quit keystroke.
		Keystrokes are listened for at the start of each loop iteration.
		"""
		self.printKeybindings()
		self.startTime = self.lastTime = time.clock()
		self.audio.start()
		self.gui.start()
		self.stimulator.start()
		self.tracker.start()
		self.videoIn.start()
		self.videoOut.start()
		self.writer.start()

		while True:

			# respond to user input
			lastKeyStroke = cv2.waitKey(20)  # 20 is the number of ms to wait for key
			if lastKeyStroke != -1: # -1 means there was no keystroke
				if lastKeyStroke == self.keycodeBindings['quit']:
					break
				if lastKeyStroke == self.keycodeBindings['triggerStimulator']:
					self.stimulator.trigger()
				if lastKeyStroke == self.keycodeBindings['toggleStimulator']:
					self.stimulator.toggle()

			# update state
			self.currTime = time.clock()
			self.totalTimeElapsed = self.currTime - self.startTime
			self.audio.update()
			self.videoIn.update()
			self.tracker.update(self.videoIn, self.currTime)
			self.stimulator.update(self.currTime, self.tracker)
			self.videoOut.update(self.videoIn, self.tracker, self.stimulator)
			self.gui.update()
			self.lastTime = self.currTime
			self.writer.update()

		# closing
		self.audio.stop()
		self.videoIn.stop()
		self.videoOut.stop()
		self.gui.stop()
		self.stimulator.stop()
		self.tracker.stop()
		self.writer.stop()

	def writeExperimentData(self, settings, console=True):
		"""Write experiment metadata to a file in the output directory.
		
		Args:
			settings: The full settings dictionary passed to the App's __init__
			console: Optional. Boolean. Also print experiment data to console.
		"""
		with open(os.path.join(settings['outputDataDir'], 'experiment.txt'), 'w') as f:
			lines = [
					"name: " + settings['experimentName'],
					"date: " + time.strftime("%m/%y/%d"),
					"time: " + time.strftime("%H:%M"),
					"protocol: "  + settings['stimulator']['activeProtocolName'],
					str(settings['stimulator']['protocols'][settings['stimulator']['activeProtocolName']])
					]
			f.write("\n".join(lines))
			f.close()
		if console:
			print "\n".join(lines)
	
	def printKeybindings(self):
		"""Print the available keyboard commands to the terminal."""
		print "Key Bindings:"
		for k,v in self.keyBindings.items():
			print "{0}: {1}".format(k,v)
		print ""
开发者ID:smackesey,项目名称:kaufer_prosocial,代码行数:104,代码来源:app.py

示例3: raw_input

# 需要导入模块: from tracker import Tracker [as 别名]
# 或者: from tracker.Tracker import stop [as 别名]
        if ( len(sys.argv) > 1 and sys.argv[1] == "input"):
            data = raw_input('>> ')
            if not data :
                #  UDPSock.sendto("q",addr)
                continue
            else :
                #  if(UDPSock.sendto(data,addr)):
                if (data == "h"):
                    print "h Help"
                    print "r Re-read config file"
                    print "q Quit to exit"
                    continue
                
                elif ( data == "q"):
                    print "quit..."
                    t.stop()
                    break

                elif ( data == "r" ):
                    print ("reread config")
                    if (t.ping_p != None):
                        t.ping_p.kill()
                    t.stop()
                    
                    t = None
                    t = Tracker()
                    t.start()
                    continue
                    
                print "Message = '",str(data),"'....."
        else:
开发者ID:wwright2,项目名称:codeview,代码行数:33,代码来源:busapi.py


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