Changeset 3078 for lliurex-store/trunk/fuentes/lliurex-appstore.install/usr
- Timestamp:
- Dec 15, 2016, 10:55:10 AM (4 years ago)
- Location:
- lliurex-store/trunk/fuentes/lliurex-appstore.install/usr/bin
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-store/trunk/fuentes/lliurex-appstore.install/usr/bin/plugins/infoManager.py
r3060 r3078 3 3 class infomanager: 4 4 def __init__(self): 5 self.dbg= 05 self.dbg=1 6 6 self.pluginInfo=['info','*'] 7 7 self.applistInfo=[] … … 64 64 appInfo['description']=app.get_description(localeItem) 65 65 break 66 if app.get_release_default(): 67 appInfo['version']=app.get_release_default().get_version() 68 if app.get_pkgname_default(): 69 appInfo['package']=app.get_pkgname_default() 70 if app.get_metadata_license(): 71 appInfo['license']=app.get_metadata_license() 72 else: 73 orig=app.get_origin() 74 print (orig) 75 if orig: 76 if '-main' in orig or '-universe' in orig: 77 appInfo['license']='open source' 78 else: 79 appInfo['license']='propietary/restricted' 66 80 if app.get_categories(): 67 81 appInfo['categories']=str(app.get_categories()) … … 86 100 appInfo['thumbnails']=thumbnails_list 87 101 appInfo['screenshot']=default_screenshot 88 if app.get_release_default():89 appInfo['version']=app.get_release_default().get_version()90 if app.get_pkgname_default():91 appInfo['package']=app.get_pkgname_default()92 if app.get_metadata_license():93 appInfo['license']=app.get_metadata_license()94 102 #The values are the values of appstream.UrlKind. 1=HOMEPAGE, 0=UNKNOWN 95 103 if app.get_url_item(1): -
lliurex-store/trunk/fuentes/lliurex-appstore.install/usr/bin/plugins/loadStore.py
r3060 r3078 40 40 store.load(appstream.StoreLoadFlags.APP_INFO_USER) 41 41 store.load(appstream.StoreLoadFlags.DESKTOP) 42 lliurex_dir="/ home/lliurex/badulaque/fuentes/lliurex-appstore.install/usr/share/app-info/xmls"42 lliurex_dir="/usr/share/app-info/xmls" 43 43 if os.path.exists(lliurex_dir): 44 44 for lliurex in os.listdir(lliurex_dir): 45 storePath=Gio.File.new_for_path(lliurex_dir+'/'+lliurex) 46 self._debug("Adding file "+lliurex_dir+'/'+lliurex) 47 try: 48 store.from_file(storePath,iconPath,None) 49 except Exception as e: 50 self._debug("Couldn't add file "+lliurex+" to store") 51 self._debug("Reason: "+str(e)) 52 pass 45 if lliurex.endswith('.xml'): 46 storePath=Gio.File.new_for_path(lliurex_dir+'/'+lliurex) 47 self._debug("Adding file "+lliurex_dir+'/'+lliurex) 48 try: 49 store.from_file(storePath,iconPath,None) 50 except Exception as e: 51 self._debug("Couldn't add file "+lliurex+" to store") 52 self._debug("Reason: "+str(e)) 53 pass 53 54 store=self._sanitize_store(store) 54 55 self.store=store … … 58 59 def _parse_desktop(self,store): 59 60 desktopDir='/usr/share/applications' 61 return(store) 60 62 applist=[] 61 63 for app in store.get_apps(): -
lliurex-store/trunk/fuentes/lliurex-appstore.install/usr/bin/plugins/searchManager.py
r3060 r3078 4 4 def __init__(self): 5 5 self.locale=locale.getlocale()[0] 6 self.dbg= 06 self.dbg=1 7 7 self.store='' 8 8 self.pluginInfo=['search','*','list','*','list_sections','*'] … … 44 44 def _search_app(self,tokens): 45 45 self._debug("Searching app "+str(tokens)) 46 self.applist=[]46 applist=[] 47 47 app=None 48 48 if len(tokens)==1: … … 50 50 51 51 if app: 52 self.applist.append(app)52 applist.append(app) 53 53 self._debug("App direct match found: "+app.get_id()) 54 54 else: 55 applist=self._get_apps_by_match(tokens)56 for app in applist:57 self.applist.append(app)58 return( self.applist)55 for app in self._get_apps_by_match(tokens): 56 applist.append(app) 57 self.applist=applist 58 return(applist) 59 59 60 60 def _list_sections(self): … … 113 113 def _get_apps_by_match(self,tokens): 114 114 #Add items witch match >= self.precision 115 applist=[] 115 116 apps_in_store=self.store.get_apps() 116 auxDict={}117 count_apps=len(apps_in_store)118 self.progress=0119 inc=100.0/count_apps120 applist=[]121 for app in apps_in_store:122 self.progress=self.progress+inc123 if app not in self.applist:124 for token in tokens:125 score=app.search_matches(token)126 if score>=self.precision:127 if score in auxDict:128 auxDict[score].append(app)129 else:130 auxDict[score]=[app]131 for match in sorted(auxDict):132 for app in auxDict[match]:133 self._debug("Adding app "+app.get_id() + " with score: "+str(match))134 self.applist.insert(0,app)117 if apps_in_store: 118 auxDict={} 119 count_apps=len(apps_in_store) 120 self.progress=0 121 inc=100.0/count_apps 122 for app in apps_in_store: 123 self.progress=self.progress+inc 124 if app not in self.applist: 125 for token in tokens: 126 score=app.search_matches(token) 127 if score>=self.precision: 128 if score in auxDict: 129 auxDict[score].append(app) 130 else: 131 auxDict[score]=[app] 132 for match in sorted(auxDict): 133 for app in auxDict[match]: 134 self._debug("Adding app "+app.get_id() + " with score: "+str(match)) 135 applist.insert(0,app) 135 136 return(applist) -
lliurex-store/trunk/fuentes/lliurex-appstore.install/usr/bin/storeManager.py
r3060 r3078 400 400 return_msg=True 401 401 else: 402 notfound='' 402 403 for item in searchItem: 403 404 notfound=' '.join(searchItem)
Note: See TracChangeset
for help on using the changeset viewer.