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


Python Configuration.save方法代码示例

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


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

示例1: config

# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import save [as 别名]
def config() :
    configuration = Configuration()
    for key in configuration :
        if configuration.need_configure(key) :
            doc = configuration.get_doc(key)
            strvalue = configuration.get_strvalue(key)
            print "%s ?[%s]" % (doc,strvalue)
            line = sys.stdin.readline().replace('\r','').replace('\n','')
            if line != '' :
                configuration.set_strvalue(key,line)
    configuration.save()
    print "The file %s has been updated. Press RETURN to continue." % (configuration.get_filename(),)
    sys.stdin.readline()
开发者ID:BackupTheBerlios,项目名称:pydirstat-svn,代码行数:15,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import save [as 别名]

#.........这里部分代码省略.........
		self.waiting_requests+=1
		if self.waiting_requests==1:
			try:
				self.mainwindow.set_icon_from_file(self.networking_icon_path)
			except:
				pass
			try:
				self.mainwindow.set_throbber(self.throbber_icon_path)
			except:
				pass
			if self.has_status_icon:
				self.statusicon.set_icon( self.networking_icon_path)
				
	def decrement_requests(self):
		self.waiting_requests-=1
		if self.waiting_requests==0:
			try:
				self.mainwindow.set_icon_from_file(self.default_icon_path)
			except:
				pass
			try:
				self.mainwindow.set_throbber(self.default_icon_path)
			except:
				pass
			if self.has_status_icon:
				self.statusicon.set_icon( self.default_icon_path )
		if self.waiting_requests<0:
			self.waiting_requests=0
	
	def valid_account_info(self, n, p, s):
		self.conf.name( n )
		self.conf.password( p )
		self.conf.service( s )
		self.conf.save()
		#update the comm
		self.comm.set_name_and_password( n,p )
		self.comm.set_service( s )
		
	def get_statuses(self,count="20"):
		if self.credentials_verified:
			#do some time handling for the good doctor
			now = time.time()
			if now - self.last_get_statuses > 2*self.pull_time:
				count = self.initial_dents
			self.last_get_statuses = now
			self.increment_requests()
			self.comm.get_statuses(count=count, since=highest_id['dent_previous'])
			#clean up the garbage
			gc.collect()
	
	def get_mentions(self,count="20"):
		if self.credentials_verified:
			self.increment_requests()
			self.comm.get_mentions(count=count,since=highest_id['mention_previous'])

	def get_favorites(self):
		if self.credentials_verified:
			self.increment_requests()
			self.comm.get_favorites()
	
	def get_direct_messages(self):
		if self.credentials_verified:
			now = time.time()
			#NOTE this could be changed to 3 minutes just setting it 
			#this way for now
			#has it been 3 times the pull time?
开发者ID:yamatt,项目名称:python-hellobuddy,代码行数:70,代码来源:heybuddy.py


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