Changeset 465 for trunk/pyragua/shared/yapsy/PluginManager.py – Pyragua

Changeset 465 for trunk/pyragua/shared/yapsy/PluginManager.py

Show
Ignore:
Timestamp:
08/09/10 02:15:01 (22 months ago)
Author:
ogranada
Message:

2010-08-09 Oscar Andres Granada <ogranada@…>

  • The Plugin architecture are implemented in pyragua.py file
  • Many methods were added to make more orderly implementation
  • The option parser are added and add the options "-s" (not Splash) and "-d" (debug)
  • yapsy library were modified in the file PluginManager?.py that without this amendment would be

required to install the library on the system.

  • They have positioned sample plugins in the plugins folder, it is necessary to improve the

documentation about this.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pyragua/shared/yapsy/PluginManager.py

    r461 r465  
    305305                return len(self._candidates) 
    306306 
    307         def loadPlugins(self, callback=None): 
     307        def loadPlugins(self, callback=None, candidate_globals=None): 
    308308                """ 
    309309                Load the candidate plugins that have been identified through a 
     
    316316                the callback. 
    317317                """ 
     318                 
     319                if type(candidate_globals) != type({}): 
     320                        candidate_globals = {} 
     321                 
    318322#               print "%s.loadPlugins" % self.__class__          
    319323                if not hasattr(self, '_candidates'): 
     
    328332                        # now execute the file and get its content into a 
    329333                        # specific dictionnary 
    330                         candidate_globals = {"__file__":candidate_filepath+".py"} 
     334                        candidate_globals["__file__"]= candidate_filepath+".py" 
    331335                        if "__init__" in  os.path.basename(candidate_filepath): 
    332336                                sys.path.append(plugin_info.path)                                
    333337                        try: 
    334338                                execfile(candidate_filepath+".py",candidate_globals) 
    335                         except Exception,e: 
     339                        except Exception,e:                              
    336340                                logging.debug("Unable to execute the code in plugin: %s" % candidate_filepath) 
    337341                                logging.debug("\t The following problem occured: %s %s " % (os.linesep, e))