コード例 #1
0
ファイル: TipOfTheDay.py プロジェクト: tvi/Harpy
		def GenerateBlankConf(self):
			newConf = bt.create_document()
			tipsList = []
			
			for tipInstance in range(len(TIPS)):
				tipsList.append(newConf.xml_element(u"tip",attributes={u"enabled":u"True", u"id":unicode(tipInstance)}))
			tipsEl = newConf.xml_element(u"tipsOfTheDay",content=tipsList,attributes={u"show":u"True", u"version":unicode(TIPS_VER)})
			newConf.xml_append(tipsEl)
			self.confFile = file(os.path.expanduser(self.confFilePath),'w')
			self.confFile.write(newConf.xml(indent=u'yes'))
			#print newConf.xml(indent=u'yes')
			self.confFile.close()
コード例 #2
0
ファイル: TipOfTheDay.py プロジェクト: tvi/Harpy
		def __saveConfFile(self):
			newConf = bt.create_document()
			tipsList = []
			
			for tipInstance in self.avTips.keys():
				tipsList.append(newConf.xml_element(u"tip",attributes={u"enabled":unicode(self.avTips[tipInstance]), u"id":unicode(tipInstance)}))

			tipsEl = newConf.xml_element(u"tipsOfTheDay",content=tipsList,attributes={u"show":unicode(self.showTips), u"version":unicode(TIPS_VER)})
			newConf.xml_append(tipsEl)
			
			self.confFile = file(os.path.expanduser(self.confFilePath),'w')
			self.confFile.write(newConf.xml(indent=u'yes'))
			self.confFile.close()