- Timestamp:
- Feb 15, 2017, 6:27:03 PM (4 years ago)
- Location:
- lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/debManager.py
r3275 r3646 23 23 def _debug(self,msg=''): 24 24 if self.dbg==1: 25 print ('DEBUG Deb: '+ msg)25 print ('DEBUG Deb: '+str(msg)) 26 26 #def debug 27 27 … … 60 60 self.partialProgress=status.get_property('percentage') 61 61 self.progress=self.partialProgress/self.count 62 self._debug("Progress"+str(self.partialProgress))62 # self._debug("Progress"+str(self.partialProgress)) 63 63 #def _callback 64 64 … … 67 67 self._debug("Installing "+app.get_id()) 68 68 try: 69 self.installer.install_packages( False,[app.get_id(),],None,self._callback,None)70 self.result.append({app.get_id(): " installed succesfully"})69 self.installer.install_packages(True,[app.get_id(),],None,self._callback,None) 70 self.result.append({app.get_id():0}) 71 71 except Exception as e: 72 self._debug( e.message)73 self.result.append({app.get_id():e. message})72 self._debug("Install error: "+str(e.code)) 73 self.result.append({app.get_id():e.code}) 74 74 self.partialProgress=100 75 75 #def _install_App_from_Repo … … 77 77 def _remove_App(self,app): 78 78 try: 79 self.installer.remove_packages( False,[app.get_id(),],True,False,None,self._callback,None)80 self.result.append({app.get_id(): " removed succesfully"})79 self.installer.remove_packages(True,[app.get_id(),],True,False,None,self._callback,None) 80 self.result.append({app.get_id():0}) 81 81 except Exception as e: 82 self._debug( e.message)83 self.result.append({app.get_id():e. message})82 self._debug("Remove error: " +str(e.code)) 83 self.result.append({app.get_id():e.code}) 84 84 self.partialProgress=100 85 85 #def _remove_App -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/infoManager.py
r3275 r3646 82 82 break 83 83 if app.get_categories(): 84 appInfo['categories']= str(app.get_categories())84 appInfo['categories']=app.get_categories() 85 85 if app.get_icon_default(): 86 86 appInfo['icon']=app.get_icon_default().get_name() -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/loadStore.py
r3275 r3646 11 11 self.store='' 12 12 self.progress=0 13 self.error=0 13 14 #def __init__ 14 15 … … 34 35 return (self.store) 35 36 #def execute_action 37 38 def get_error(self) 39 return (self.error) 36 40 37 41 def _load_store(self,store): -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/plugins/searchManager.py
r3275 r3646 78 78 catDict[cat]=catDict[cat]+1 79 79 for section in catDict: 80 applist.append({s ection:catDict[section]})80 applist.append({str(section):catDict[section]}) 81 81 self.applist=applist 82 82 return(applist) … … 100 100 pass 101 101 setAppCategories=set(appCategories) 102 if list(setCategories.intersection(setAppCategories)):102 if setCategories.issubset(setAppCategories): 103 103 self._debug("Found "+app.get_id()) 104 104 applist.append(app) -
lliurex-store/trunk/fuentes/python3-lliurex-store.install/usr/share/lliurexstore/storeManager.py
r3615 r3646 27 27 } 28 28 self.dbg=0 29 if args: 30 self.dbg=args 29 31 self.threads={} #Dict that stores the functions that must execute each action 30 32 self.threadsProgress={} #"" "" "" the progress for each launched thread 31 33 self.threadsRunning={} #"" "" "" the running threads 32 self._define_functions_for_threads() #Function that loads the dictionary self.threads33 34 self.registeredPlugins={} #Dict that have the relation between plugins and actions 34 35 self.registerProcessProgress={} #Dict that stores the progress for each function/parentAction pair 35 self.__init_plugins__() #Function that loads the plugins36 36 self.progressActions={} #Progress of global actions based on average progress of individual processes 37 37 self.result={} #Result of the actions 38 self.execute_action('load') #Function that launches the actions39 38 self.lock=threading.Lock() #locker for functions related to threads (get_progress, is_action_running...) 40 # self.log 39 self.main() 41 40 #def __init__ 41 42 def main(self): 43 self._define_functions_for_threads() #Function that loads the dictionary self.threads 44 self.__init_plugins__() #Function that loads the plugins 45 self.execute_action('load') #Initial load of the store 46 #def main 42 47 43 48 #### … … 148 153 if action in self.registeredPlugins: 149 154 self._debug("Plugin for "+action+": "+self.registeredPlugins[action][parms]) 150 # exeFunction=eval(self.pluginMod+'.'+self.registeredPlugins[action][parms]+"()")151 155 exeFunction=eval(self.registeredPlugins[action][parms]+"()") 156 if self.dbg: 157 exeFunction.set_debug(1) 152 158 self._registerProcessProgress(action,exeFunction,launchedby) 153 159 else: … … 211 217 def _registerProcessProgress(self,action,function,parentAction=None): 212 218 if action in self.registerProcessProgress.keys(): 213 self._debug("Appended process for action :"+action +" and function: "+str(function))219 self._debug("Appended process for action: "+action +" and function: "+str(function)) 214 220 self.registerProcessProgress[action].append(function) 215 221 else: 216 self._debug("Registered process for action :"+action+" and function: "+str(function))222 self._debug("Registered process for action: "+action+" and function: "+str(function)) 217 223 self.registerProcessProgress[action]=[function] 218 224 if parentAction: … … 370 376 if action=='list_sections': 371 377 searchItem='' 372 if (searchItem in self.registeredPlugins[action]):373 self._debug("Plugin for search "+ searchItem +": "+self.registeredPlugins[action][searchItem])374 finder=self.registeredPlugins[action][searchItem]375 else:376 self._debug("Plugin for generic search: "+self.registeredPlugins[action]['*'])377 finder=self.registeredPlugins[action][('*')]378 searchFunction=eval(finder+"()")379 378 if not launchedby: 380 379 launchedby=action 381 self._registerProcessProgress(action,searchFunction,launchedby) 380 381 searchFunction=self._execute_class_method(action,'*',launchedby) 382 382 aux_applist=searchFunction.execute_action(self.store,action,searchItem) 383 #1.- Get appstream metadata (faster) 384 partialAction='info' 385 applist=self._get_App_Info(aux_applist,launchedby) 386 self._debug("Add result for "+partialAction) 387 self.result[partialAction]=applist 388 #2.- Get rest of metadata (slower) 389 partialAction='pkginfo' 390 applist=self._get_Extended_App_Info(applist,launchedby,fullsearch) 391 realAction=action 392 if launchedby: 393 realAction=launchedby 394 self._debug("Assigned results of "+action+" to "+realAction) 395 if (len(applist)): 396 self.result[realAction]=applist 397 return_msg=True 398 else: 399 notfound='' 400 for item in searchItem: 401 notfound=' '.join(searchItem) 402 self.result[realAction]=[{notfound:" not found"}] 383 if len(aux_applist): 384 #1.- Get appstream metadata (faster) 385 partialAction='info' 386 applist=self._get_App_Info(aux_applist,launchedby) 387 self._debug("Add result for "+partialAction) 388 self.result[partialAction]=applist 389 #2.- Get rest of metadata (slower) 390 partialAction='pkginfo' 391 applist=self._get_Extended_App_Info(applist,launchedby,fullsearch) 392 realAction=action 393 if launchedby: 394 realAction=launchedby 395 self._debug("Assigned results of "+action+" to "+realAction) 396 if (len(applist)): 397 self.result[realAction]=applist 398 return_msg=True 399 else: 400 notfound='' 401 self.result[realAction]=[{searchItem:2}] 402 return_msg=False 403 else: 404 self.result[launchedby]=[{searchItem:1}] 403 405 return_msg=False 404 406 return(return_msg) … … 424 426 if (action=='install' and appInfo['status']=='installed') or (action=='remove' and appInfo['status']=='available'): 425 427 if action=='remove': 426 self.result[action]=[{appInfo['package']: "Package not installed"}]428 self.result[action]=[{appInfo['package']:3}] 427 429 else: 428 self.result[action]=[{appInfo['package']: "Package already installed"}]430 self.result[action]=[{appInfo['package']:4}] 429 431 return_msg=False 430 432 typeDict={}
Note: See TracChangeset
for help on using the changeset viewer.