• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python metrixTools.log函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中metrixTools.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: syncNow

def syncNow(sync_data):
	try:
		url = metrixDefaults.URL_STORE_API + 'set.info'
		params = {'data':sync_data}
		metrixCore.getWeb(url,True,params)
	except:
		metrixTools.log("Error on sync")
开发者ID:iMaxxx,项目名称:OpenStore,代码行数:7,代码来源:metrixCloudSync.py


示例2: installMetrixColors

def installMetrixColors(item_name):
	try:
		data = metrixCore.getWeb(metrixDefaults.URL_GET_METRIXCOLORS,True,{'name':item_name})
		dom = parseString(data)
		for design in dom.getElementsByTagName('design'):
			name = str(design.getAttributeNode('name').nodeValue)
			if name == item_name:
				try:
					config.plugins.MyMetrix.Color.BackgroundTransparency.value = str(design.getAttributeNode('backgroundtrans').nodeValue)
					config.plugins.MyMetrix.Color.SelectionTransparency.value = str(design.getAttributeNode('selectiontrans').nodeValue)
					config.plugins.MyMetrix.Color.BackgroundTextTransparency.value = str(design.getAttributeNode('backgroundtexttrans').nodeValue)
					config.plugins.MyMetrix.Color.Selection.value = str(design.getAttributeNode('selection').nodeValue)
					config.plugins.MyMetrix.Color.ProgressBar.value = str(design.getAttributeNode('progressbars').nodeValue)
					config.plugins.MyMetrix.Color.Background.value = str(design.getAttributeNode('background').nodeValue)
					config.plugins.MyMetrix.Color.Background2.value = str(design.getAttributeNode('background2').nodeValue)
					config.plugins.MyMetrix.Color.Foreground.value = str(design.getAttributeNode('foreground').nodeValue)
					config.plugins.MyMetrix.Color.BackgroundText.value = str(design.getAttributeNode('backgroundtext').nodeValue)
					config.plugins.MyMetrix.Color.Accent1.value = str(design.getAttributeNode('accent1').nodeValue)
					config.plugins.MyMetrix.Color.Accent2.value = str(design.getAttributeNode('accent2').nodeValue)
					
					config.plugins.MyMetrix.Color.Selection_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('selection_custom').nodeValue))
					config.plugins.MyMetrix.Color.Background_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('background_custom').nodeValue))
					config.plugins.MyMetrix.Color.Background2_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('background2_custom').nodeValue))
					config.plugins.MyMetrix.Color.Foreground_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('foreground_custom').nodeValue))
					config.plugins.MyMetrix.Color.BackgroundText_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('backgroundtext_custom').nodeValue))
					config.plugins.MyMetrix.Color.Accent1_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('accent1_custom').nodeValue))
					config.plugins.MyMetrix.Color.Accent2_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('accent2_custom').nodeValue))
					return True
				except Exception, e:
					metrixTools.log("Error setting MetrixColor!",e)
	except Exception, e:
		metrixTools.log("Error downloading MetrixColor!",e)
开发者ID:LoSoS85,项目名称:OpenStore,代码行数:32,代码来源:metrix_MetrixColorsTools.py


示例3: getCategories

	def getCategories(self):
		menu = []
		menu.append(self.CategoryListEntry(_("Loading...")))
		metrixTools.callOnMainThread(self.setList,menu)
		try:
			data = metrixCore.getWeb(self.url,True)
			dom = parseString(data)
			menu = []
			## ADD STATIC PSEUDO CATEGORIES
			menu.append(self.CategoryListEntry(_("Skins"), "Skins","skins"))
			menu.append(self.CategoryListEntry(_("MetrixColors"), "MetrixColors","brush"))
			menu.append(self.CategoryListEntry(_("Newest SkinParts"), "newest","new"))
			menu.append(self.CategoryListEntry(_("Last Modified"), "modified","recent"))
			menu.append(self.CategoryListEntry(_("Top 50 Downloads"), "mostdownloaded","download"))
			menu.append(self.CategoryListEntry(_("Skin Extensions"), "Extensions","extensions"))
			menu.append(self.CategoryListEntry(_("Bundles"), "bundle","bundle"))
			metrixTools.callOnMainThread(self.setList,menu)
			for entry in dom.getElementsByTagName('entry'):
				item_id = str(entry.getAttributeNode('id').nodeValue)
				name = str(entry.getAttributeNode('name').nodeValue)
				menu.append(self.CategoryListEntry(name, item_id))
				metrixTools.callOnMainThread(self.setList,menu)
		except Exception, e:
			metrixTools.log("Error getting items via web",e)
			menu.append(self.CategoryListEntry(_("Error loading data!"), "-","-"))
			metrixTools.callOnMainThread(self.setList,menu)
开发者ID:LoSoS85,项目名称:OpenStore,代码行数:26,代码来源:store_SkinParts_Categories.py


示例4: generateSkin

	def generateSkin(self):
		screennames = [] 
		screennames = self.getSkinPartsScreennames(config.plugins.MyMetrix.SkinPartPath.value + "screens/active/")
		metrixTools.callOnMainThread(self["output"].setText,_("Reading template file"))
		skindom = parse(config.plugins.MyMetrix.Templates.value)
		skinNode = skindom.getElementsByTagName('skin')[0]
		
		metrixTools.callOnMainThread(self["output"].setText,_("Setting colors"))
		self.setColor(skinNode)
		for screen in skindom.getElementsByTagName('screen'):
			screenname = str(screen.getAttributeNode('name').nodeValue)
			
			metrixTools.callOnMainThread(self["output"].setText,(str(_("Checking screen ")+screenname)))
			if screenname in screennames:
				metrixTools.callOnMainThread(self["output"].setText,_(str("Removing default screen "+screenname)))
				parentNode = screen.parentNode
				parentNode.removeChild(screen)
			if config.plugins.MyMetrix.CleanInfoBar.value:
				if screenname == "InfoBar" or screenname == "SecondInfoBar":
					for child in screen.childNodes:
						screen.removeChild(child)
				
		# APPEND STORE SCREENS
		path = config.plugins.MyMetrix.SkinPartPath.value + "screens/active/"
		dirs = listdir(path)
		for dir in dirs:
			metrixTools.callOnMainThread(self["output"].setText,_("Parsing SkinPart Screens"))
			try:	
				screen = metrix_SkinPartTools.parseSkinPart(path+dir,"data.xml","config.cfg",screenname)
				customscreen = skindom.importNode(screen, True)
				skinNode.appendChild(customscreen)
			except Exception, e:
				metrixTools.log("Error appending screen",e)
开发者ID:capa77,项目名称:MyMetrix-BH,代码行数:33,代码来源:metrix_GenerateSkin.py


示例5: getUpdatedPackages

def getUpdatedPackages():
    menu = []
    try:
        params = {
            "restriction-oe": metrixTools.getOERestriction(),
            "restriction-image": metrixTools.getImageRestriction(),
            "category_id": "%",
        }
        data = metrixCore.getWeb(metrixDefaults.URL_GET_PACKAGES, True, params)
        if "<exception status=" "error" "" in data:
            raise Exception("Error loading data")
        dom = parseString(data)
        for package in dom.getElementsByTagName("entry"):
            isinstalled = False
            updateavailable = False
            item_id = str(package.getAttributeNode("id").nodeValue)
            file_link = str(package.getAttributeNode("file_link").nodeValue)
            build = int(package.getAttributeNode("build").nodeValue)
            localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES, item_id, "build", "int"))
            # add when not only updates or (only updates and online build is higher)
            if not localbuild == metrixDefaults.NONEINT:
                isinstalled = True
            if build > localbuild:
                updateavailable = True
                metrix_PackageTools.installPackage(file_link, True, True, item_id, build)
                config.plugins.MetrixUpdater.RebootRequired.value = True
    except Exception, e:
        metrixTools.log("Error getting packages via web", e)
开发者ID:Temporalis,项目名称:OpenStore,代码行数:28,代码来源:store_Updater.py


示例6: installSkinPart

def installSkinPart(param,actionId):
	metrixTools.log("Installing skinpart: "+param)
	item_id = ""
	item_name = ""
	item_type = ""
	author = ""
	date_modified = ""
	try:
		data = metrixCore.getWeb(metrixDefaults.URL_GET_SKINPART_META_UPDATE + "&id=" + str(param),False)
		dom = parseString(data)
		for entry in dom.getElementsByTagName('entry'):
			item_id = str(entry.getAttributeNode('id').nodeValue)
			item_name = str(entry.getAttributeNode('name').nodeValue)
			item_type = str(entry.getAttributeNode('type').nodeValue)
			author = str(entry.getAttributeNode('author').nodeValue)
			image_link = str(entry.getAttributeNode('image_link').nodeValue)
			date = str(entry.getAttributeNode('date').nodeValue)
			date_modified = str(entry.getAttributeNode('date_modified').nodeValue)
			if item_type == "bundle":
				metrix_SkinPartTools.installBundle(item_id,type,author)
			else:
				metrix_SkinPartTools.installSkinPart(item_id,item_type,author,image_link)
				showInfo(item_name+" "+_("successfully installed!"))
			
	except Exception, e:
		metrixTools.log("Error installing SkinPart",e)
		traceback.print_exc()
开发者ID:andgoldi,项目名称:OpenStore,代码行数:27,代码来源:metrixConnector.py


示例7: getUpdatedPackages

def getUpdatedPackages():
		menu = []
		try:
			params = {'restrictions':metrixTools.getRestrictions(),
					  'category_id':"%"}
			data = metrixCore.getWeb(metrixDefaults.URL_GET_PACKAGES,True,params)
			if "<exception status=""error""" in data:
				raise Exception("Error loading data")
			dom = parseString(data)
			for design in dom.getElementsByTagName('entry'):
				isinstalled = False
				updateavailable = False
				item_id = str(design.getAttributeNode('id').nodeValue)
				file_link = str(design.getAttributeNode('file_link').nodeValue)
				build = int(design.getAttributeNode('build').nodeValue)
				localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,item_id,"build","int"))
				# add when not only updates or (only updates and online build is higher)
				if (not localbuild == metrixDefaults.NONEINT):
					isinstalled = True
				if build > localbuild:
					updateavailable = True
				if build > localbuild:
					metrix_PackageTools.installPackage(file_link,True,True,item_id,build)
					config.plugins.MetrixUpdater.RebootRequired.value = True
					config.plugins.MetrixUpdater.UpdatePopup_Packages.value = True
		except Exception, e:
			metrixTools.log('Error getting packages via web',e)
开发者ID:andgoldi,项目名称:OpenStore,代码行数:27,代码来源:store_Updater.py


示例8: installPackage

def installPackage(url,force=False,silent=False,id=0,build=0):
	downloadDir = '/tmp/openstore/'
	if not os.path.exists(downloadDir):
		os.makedirs(downloadDir)
	metrixTools.log("Installing package "+url,None,"OpenStore")
	packagefile = metrixTools.downloadFile(url,downloadDir + 'package.ipk',forceOverwrite=True)
	packagename = getPackageName(downloadDir,"package.ipk")
	if force:
		cmdStatus = runCommand("opkg install --force-overwrite '"+packagefile+"'")
	else:
		cmdStatus = runCommand("opkg install '"+packagefile+"'")
	if cmdStatus[0] == True:
		if not id == 0:
			metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"id",id)
			try:
				metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"name",packagename)
			except:
				pass
			metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"build",build)
			metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"url",url)
		config.plugins.MetrixUpdater.Reboot.value = 1
		config.plugins.MetrixUpdater.save()    
		configfile.save()
		if not silent:
			metrixConnector.showInfo(_("Package successfully installed!"))
		return True
	else:
		if not silent:
			metrixConnector.showInfo(_("Error installing Package!"),MessageBox.TYPE_ERROR)
		return False
	if os.path.exists(downloadDir):
		os.removedirs(downloadDir)
	syncPackages()
开发者ID:LoSoS85,项目名称:OpenStore,代码行数:33,代码来源:metrix_PackageTools.py


示例9: syncActions

def syncActions():
	syncinterval =1200
	while(1):
		if metrixCore.isLoggedIn():
			try:
				getActions()
				syncinterval = getInterval()
			except:
				metrixTools.log("Error getting interval")
		time.sleep(syncinterval)
开发者ID:andgoldi,项目名称:OpenStore,代码行数:10,代码来源:metrixConnector.py


示例10: runCommand

def runCommand(cmd_type,param,actionId):
	metrixTools.log("Starting action via web")
	try:
		cmdStatus = metrix_PackageTools.runCommand(str(base64.b64decode(cmd_type)+" "+base64.b64decode(param)))
		if cmdStatus[0] == True:
			showInfo(_("Action successfully executed!"))
		else:
			showInfo(_("Error executing action!"),MessageBox.TYPE_ERROR)
			
	except Exception, e:
		metrixTools.log("Error on action via web",e)
开发者ID:andgoldi,项目名称:OpenStore,代码行数:11,代码来源:metrixConnector.py


示例11: updateMeta

	def updateMeta(self):
		try:
			self["itemname"].setText(str(self["menu"].l.getCurrentSelection()[0][1]))
			self.setTitle(_("OpenStore // "+self["menu"].l.getCurrentSelection()[0][1]))
			self["author"].setText(_("loading..."))
			self["votes"].setText(str(self["menu"].l.getCurrentSelection()[0][6]))
			self["date"].setText(str(self["menu"].l.getCurrentSelection()[0][5]))
			self["description"].setText(str(self["menu"].l.getCurrentSelection()[0][10]))
			self.currentid = int(self["menu"].l.getCurrentSelection()[0][0])
			self.currenttype = str(self["menu"].l.getCurrentSelection()[0][7])
			isinstalled = self["menu"].l.getCurrentSelection()[0][15]
			updateavailable = self["menu"].l.getCurrentSelection()[0][16]
			if isinstalled:
				self["yellowbutton"].setText(_("Vote"))
				packageName = metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,self.currentid,"name")
				if not packageName == "":
					self["redbutton"].setText(_("Remove"))
				else:
					self["redbutton"].setText("")
				if updateavailable:
					self["isInstalled"].setText(_("Update available!"))
					self["greenbutton"].setText(_("Update"))
				else:
					self["isInstalled"].setText(_("This app is installed!"))
					self["greenbutton"].setText(_("Reinstall"))
					
			else:
				type = self["menu"].l.getCurrentSelection()[0][7]
				if type == "piconrepo" and config.plugins.MyMetrix.XPiconsRepository.value == self.currentid:
					self["yellowbutton"].setText("Vote")
				else:
					self["yellowbutton"].setText("")
				self["redbutton"].setText("")
				if self.currenttype == "piconrepo":
					self["greenbutton"].setText(_("Apply"))
					if config.plugins.MyMetrix.XPiconsRepository.value == self.currentid:
						self["greenbutton"].setText("")
						
				else:
					self["greenbutton"].setText(_("Install"))
				self["isInstalled"].setText("")
			path = metrixDefaults.pathRoot()+"packages/"+str(self.currentid)+"/"
			
				
		except Exception, e:
			self["itemname"].setText(_("No packages available!"))
			self["author"].setText("")
			self["votes"].setText("")
			self["redbutton"].setText("")
			self["greenbutton"].setText("")
			self["yellowbutton"].setText("")
			self["description"].setText("")
			self["date"].setText("")
			metrixTools.log("No packages available in this view!",e)
开发者ID:LoSoS85,项目名称:OpenStore,代码行数:54,代码来源:store_Packages_Browse.py


示例12: runCommand

def runCommand(command):
	try:
		process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
		process.wait()
		stdout, stderr = process.communicate(str.encode('utf-8'))
		if(stderr!=""):
			return [False,stderr]
		else:
			return [True,stdout]
	except Exception, e:
		metrixTools.log("Error running command",e,"OpenStore")
		return 0
开发者ID:LoSoS85,项目名称:OpenStore,代码行数:12,代码来源:metrix_PackageTools.py


示例13: __init__

	def __init__(self, session):
		self["title"] = Label(_("Welcome to MyMetrix!"))
		self["description"] = Label(_("MyMetrix brings your set-top box experience onto a whole new level!\nPress left button to start the easy setup which generates the default MetrixHD feeling. Alternatively press right button to explore great SkinParts in OpenStore and customize your user interface how ever you want!"))
		Screen.__init__(self, session)
		self.session = session
		self["right"] = Label(_("Customize"))
		self["left"] = Label(_("Easy setup"))
		#self["helperimage"].instance.setPixmapFromFile("/usr/lib/enigma2/python/Plugins/Extensions/MyMetrix/images/nopreview.png")
		
		config.plugins.MyMetrix.showFirstRun.value = False
		config.plugins.MyMetrix.showFirstRun.save()
		try:
			configfile.save()
		except Exception, e:
			metrixTools.log("Error writing config file",e,"MetrixInto")
开发者ID:Temporalis,项目名称:OpenStore,代码行数:15,代码来源:metrix_Intro.py


示例14: getSkinParts

	def getSkinParts(self,isactive=""):
		menu = []
		
		try:
			if self.pagelength == 0:
				params = {'screenname':self.screenname,
						'suite_id':self.suite_id,
						'developer':str(config.plugins.MyMetrix.Store.SkinPart_Developer.value),
						'restrictions':metrixTools.getRestrictions(),
						'orderby':self.orderby,
						'type':str(self.type)}
			else:
				params = {'screenname':self.screenname,
						'suite_id':self.suite_id,
						'orderby':self.orderby,
						'restrictions':metrixTools.getRestrictions(),
						'developer':str(config.plugins.MyMetrix.Store.SkinPart_Developer.value),
						'pagelength':str(self.pagelength),
						'type':str(self.type),
						'pagenum':'1'}
			data = metrixCore.getWeb(metrixDefaults.URL_GET_SKINPARTS,True,params)
			dom = parseString(data)
			for entry in dom.getElementsByTagName('entry'):
				item_id = str(entry.getAttributeNode('id').nodeValue)
				name = str(entry.getAttributeNode('name').nodeValue)
				author = str(entry.getAttributeNode('author').nodeValue)
				version = str(entry.getAttributeNode('version').nodeValue)
				rating = str(entry.getAttributeNode('rating').nodeValue)
				date = str(entry.getAttributeNode('date').nodeValue)
				item_type = str(entry.getAttributeNode('type').nodeValue)
				screenname = str(entry.getAttributeNode('screenname').nodeValue)
				image_id = str(entry.getAttributeNode('image_id').nodeValue)
				image_token = str(entry.getAttributeNode('image_token').nodeValue)
				total_votes = str(entry.getAttributeNode('total_votes').nodeValue)
				description = str(entry.getAttributeNode('description').nodeValue)
				build = str(entry.getAttributeNode('build').nodeValue)
				image_link = str(entry.getAttributeNode('image_link').nodeValue)
				downloads = str(entry.getAttributeNode('downloads').nodeValue)
				menu.append(self.SkinPartsListEntry(item_id,name,author,rating,date,version,total_votes,item_type,image_id,image_token,description,screenname,image_link,isactive,build))
				metrixTools.callOnMainThread(self.setList,menu)
			if len(menu) < 1:
				self.picPath = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
				metrixTools.callOnMainThread(self.setList,menu)
		except Exception, e:
			metrixTools.log("Error getting SkinParts", e)
			self.picPath = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
			metrixTools.callOnMainThread (self.setList,menu)
开发者ID:Temporalis,项目名称:OpenStore,代码行数:47,代码来源:store_SkinParts_Browse.py


示例15: getPackageName

def getPackageName(packagePath,packageFile):
	try:
		if os.path.isfile('/tmp/control.tar.gz'):
			os.remove('/tmp/control.tar.gz')
		if os.path.isfile('/tmp/control'):
			os.remove('/tmp/control')
		packageInfo = runCommand('cd '+packagePath+ ' && ar x ./'+packageFile+' control.tar.gz && tar xf ./control.tar.gz ./control && cat control | grep Package')
		os.remove('/tmp/openstore/control.tar.gz')
		os.remove('/tmp/openstore/control')
		if packageInfo[0]:
			packageName = packageInfo[1].split(": ")
			return packageName[1]
		else:
			return ""
	except Exception, e:
		metrixTools.log("Error reading pacakge name",e)
		return ""
开发者ID:LoSoS85,项目名称:OpenStore,代码行数:17,代码来源:metrix_PackageTools.py


示例16: widgetActive

def widgetActive(path,xmlfile="data.xml",configfile="config.cfg",screenname="InfoBar"):
	xml = ""
	try:
		raw_xml = metrixTools.getFile(path+"/"+xmlfile)
		#Read config file
		skinpartconfig = ConfigParser.RawConfigParser()
		skinpartconfig.read(path+"/"+configfile)
		
		try:
			target = skinpartconfig.get("screen",screenname.lower())
			if target == "" or target == None:
				skinPartNode = False
		except Exception, e:
			metrixTools.log("No config.cfg found in "+path)	
	except Exception, e:
		metrixTools.log("Error parsing SkinPart!",e)
		skinPartNode = None
开发者ID:Temporalis,项目名称:OpenStore,代码行数:17,代码来源:metrix_SkinPartTools.py


示例17: getPackages

	def getPackages(self,isactive=""):
		menu = []
		try:
			params = {'restrictions':metrixTools.getRestrictions(),
					  'orderby':self.orderby+" "+self.limit,
					  'category_id':str(self.category_id)}
			data = metrixCore.getWeb(self.url,True,params)
			if "<exception status=""error""" in data:
				raise Exception("Error loading data")
			dom = parseString(data)
			for design in dom.getElementsByTagName('entry'):
				isinstalled = False
				updateavailable = False
				item_id = str(design.getAttributeNode('id').nodeValue)
				name = str(design.getAttributeNode('name').nodeValue)
				author = str(design.getAttributeNode('author').nodeValue)
				version = str(design.getAttributeNode('version').nodeValue)
				rating = str(design.getAttributeNode('rating').nodeValue)
				date = str(design.getAttributeNode('date_created').nodeValue)
				date_modified = str(design.getAttributeNode('date_modified').nodeValue)
				item_type = str(design.getAttributeNode('type').nodeValue)
				file_link = str(design.getAttributeNode('file_link').nodeValue)
				image_link = str(design.getAttributeNode('image_link').nodeValue)
				icon_link = str(design.getAttributeNode('icon_link').nodeValue)
				downloads = str(design.getAttributeNode('downloads').nodeValue)
				total_votes = str(design.getAttributeNode('total_votes').nodeValue)
				build = int(design.getAttributeNode('build').nodeValue)
				description = str(design.getAttributeNode('description').nodeValue)
				previouspackage = str(design.getAttributeNode('previouspackage').nodeValue)
				path = metrixDefaults.pathRoot()+"packages/"+item_id
				localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,item_id,"build","int"))
				# add when not only updates or (only updates and online build is higher)
				if not localbuild == metrixDefaults.NONEINT:
					isinstalled = True
				if build > localbuild:
					updateavailable = True
				if (not self.onlyupdates and not self.onlyinstalled == True) or (build > localbuild and self.onlyupdates == True) or (self.onlyinstalled and isinstalled == True):
					menu.append(self.PackagesListEntry(item_id,name,author,rating,date,version,total_votes,item_type,image_link,icon_link,description,file_link,downloads,previouspackage,date_modified,build,isinstalled,updateavailable))
				metrixTools.callOnMainThread(self.setList,menu)
			if len(menu) < 1:
				self.image = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
				metrixTools.callOnMainThread(self.setList,menu)
		except Exception, e:
			metrixTools.log('Error getting packages via web',e)
			self.image = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
			metrixTools.callOnMainThread(self.setList,menu)
开发者ID:LoSoS85,项目名称:OpenStore,代码行数:46,代码来源:store_Packages_Browse.py


示例18: writeFile

	def writeFile(self,skindom):
		try:
			self["output"].setText(_("Writing skin file, please wait..."))
			oldfilename = config.plugins.MyMetrix.Templates.value.split("/")[-1]
			file =  config.plugins.MyMetrix.Templates.value.replace(oldfilename,"skin."+config.plugins.MyMetrix.SkinName.value + ".xml")
			path = os.path.dirname(file)	
			if not os.path.exists(path):
				os.makedirs(path)	
			metrix_SkinPartTools.writeSkinFile(skindom,file)
		
			self["output"].setText(_("Activating Skin"))
			config.skin.primary_skin.value = file.replace(metrixDefaults.SKINS_ROOT,"")
			config.skin.primary_skin.save()
			configfile.save()
		except Exception, e:
			
			metrixTools.log("Error activating skin",e)
开发者ID:Temporalis,项目名称:OpenStore,代码行数:17,代码来源:metrix_GenerateSkin.py


示例19: GetWeather

def GetWeather():
	woeid = config.plugins.MetrixWeather.woeid.value
	metrixTools.log("Lookup for ID " + str(woeid),None,"MetrixWeather")
	url = "http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20woeid%3D%22"+str(woeid)+"%22&format=xml"
	#url = "http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20woeid%3D%22"+str(woeid)+"%22%20u%3Dc&format=xml"
	
	
	# where location in (select id from weather.search where query="oslo, norway")
	file = urllib.urlopen(url)
	data = file.read()
	file.close()
	
	dom = parseString(data)
	title = getTextNode(dom.getElementsByTagName('title')[0].childNodes)
	config.plugins.MetrixWeather.currentLocation.value = str(title).split(',')[0].replace("Conditions for ","")
	
	currentWeather = dom.getElementsByTagName('yweather:condition')[0]
	currentWeatherCode = currentWeather.getAttributeNode('code')
	config.plugins.MetrixWeather.currentWeatherCode.value = ConvertCondition(currentWeatherCode.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('temp')
	config.plugins.MetrixWeather.currentWeatherTemp.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherText = currentWeather.getAttributeNode('text')
	config.plugins.MetrixWeather.currentWeatherText.value = currentWeatherText.nodeValue
	
	currentWeather = dom.getElementsByTagName('yweather:forecast')[0]
	currentWeatherCode = currentWeather.getAttributeNode('code')
	config.plugins.MetrixWeather.forecastTodayCode.value = ConvertCondition(currentWeatherCode.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('high')
	config.plugins.MetrixWeather.forecastTodayTempMax.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('low')
	config.plugins.MetrixWeather.forecastTodayTempMin.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherText = currentWeather.getAttributeNode('text')
	config.plugins.MetrixWeather.forecastTodayText.value = currentWeatherText.nodeValue

	currentWeather = dom.getElementsByTagName('yweather:forecast')[1]
	currentWeatherCode = currentWeather.getAttributeNode('code')
	config.plugins.MetrixWeather.forecastTomorrowCode.value = ConvertCondition(currentWeatherCode.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('high')
	config.plugins.MetrixWeather.forecastTomorrowTempMax.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('low')
	config.plugins.MetrixWeather.forecastTomorrowTempMin.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherText = currentWeather.getAttributeNode('text')
	config.plugins.MetrixWeather.forecastTomorrowText.value = currentWeatherText.nodeValue
	config.plugins.MetrixWeather.save()
	configfile.save()
开发者ID:LoSoS85,项目名称:OpenStore,代码行数:45,代码来源:metrixWeatherUpdater.py


示例20: installBundle

def installBundle(id,type="",author=""):
	downloadurl = metrixDefaults.URL_GET_SKINPART_BUNDLE + "&id="+id
	skinparts = str(metrixCore.getWeb(downloadurl,True,{"author":author})).split(";")
	for skinpart in skinparts:
		
		try:
			downloadmetaurl = metrixDefaults.URL_GET_SKINPART_META_UPDATE + "&id="+skinpart
			metafile = metrixCore.getWeb(downloadmetaurl,True)
			dom = parseString(metafile)
			for design in dom.getElementsByTagName('entry'):
				id = str(design.getAttributeNode('id').nodeValue)
				name = str(design.getAttributeNode('name').nodeValue)
				type = str(design.getAttributeNode('type').nodeValue)
				author = str(design.getAttributeNode('author').nodeValue)
				image_link = str(design.getAttributeNode('image_link').nodeValue)
				installSkinPart(skinpart,type,author,image_link)
		except Exception, e:
			metrixTools.log("Error getting SkinParts",e)
开发者ID:Temporalis,项目名称:OpenStore,代码行数:18,代码来源:metrix_SkinPartTools.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python metrology.Metrology类代码示例发布时间:2022-05-27
下一篇:
Python metrics.size函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap