Changeset 465
- Timestamp:
- 08/09/10 02:15:01 (22 months ago)
- Location:
- trunk/pyragua
- Files:
-
- 5 modified
-
configmanager/config.py (modified) (1 diff)
-
pyragua.py (modified) (2 diffs)
-
shared/gaugesplash.py (modified) (1 diff)
-
shared/yapsy/PluginManager.py (modified) (3 diffs)
-
ui/mainwindow.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pyragua/configmanager/config.py
r461 r465 34 34 except: 35 35 f = open(user_root+sep+'.pyragua/pyragua.conf','w') 36 from sk_files import pyragua_conf as pyragua_conf_data 37 f.write(pyragua_conf_data) 36 f.write('[plugins]\nlocation=.pyragua/plugins') 38 37 f.close() 39 38 self.files['pyragua_conf'].readfp(open(user_root+sep+'.pyragua/pyragua.conf')) 40 39 41 print self.files['pyragua_conf'].sections()40 42 41 43 42 -
trunk/pyragua/pyragua.py
r458 r465 16 16 17 17 from ui import mainwindow 18 import wx 19 # imports required by the splash and plugins. 20 from shared import gaugesplash 21 from os import getcwd, path, system 22 from user import home as userhome 23 18 24 19 25 class Pyragua(object): … … 21 27 """ 22 28 def __init__(self): 23 self.main_window = mainwindow.MainWindow() 29 self.__opt_manage() 30 self.main_window = mainwindow.MainWindow() 24 31 self.main_window.pyragua = self 25 32 26 33 def start(self): 34 self.__start() 27 35 self.main_window.show() 28 36 self.main_window.start() # The wx main loop gets started 37 38 def __opt_manage(self): 39 ''' 40 Destined for add the command line options 41 ''' 42 from modparser import ModParser 43 self.__modparser = ModParser({'opt':'-s','large_opt':'--has-splash','default':True,'action':"store_false"}, 44 {'opt':'-d','large_opt':'--debug','default':False,'action':"store_true"}) 45 46 def __start(self): 47 ''' 48 Run the IDE with the data of the options. 49 ''' 50 if self.__modparser.get('has_splash') not in ['no', 'No', None, 'false', 'FALSE', 'False',False]: 51 splash = gaugesplash.GaugeSplash(getcwd()+'/img/pyragua_splash.png') 52 splash.Show() 53 splash.Update() 54 wx.Yield() 55 else: 56 splash = None 57 if self.__modparser.get('debug'): 58 globals()['debug']=True 59 else: 60 globals()['debug']=False 61 # loads 62 self.__load(splash) 63 #end loads 64 if splash != None: 65 splash.Destroy() 66 wx.GetApp().Yield() 67 68 def __load(self, splash=None): 69 import shared 70 from shared.yapsy.PluginManager import PluginManager 71 from shared.yapsy.IPlugin import IPlugin 72 pm = PluginManager() 73 if not path.exists(getcwd()+'/pyragua'): 74 system('mkdir %s'%(getcwd()+'/pyragua')) 75 if not path.exists(getcwd()+'/pyragua/plugins'): 76 system('mkdir %s'%(getcwd()+'/pyragua/plugins')) 77 if not path.exists(userhome+'/.pyragua'): 78 system('mkdir %s'%(userhome+'/.pyragua')) 79 if not path.exists(userhome+'/.pyragua/plugins'): 80 system('mkdir %s'%(userhome+'/.pyragua/plugins')) 81 pm.setPluginPlaces([getcwd()+'/pyragua/plugins',userhome+'/.pyragua/plugins']) 82 pm.locatePlugins() 83 pm.loadPlugins(candidate_globals={'IPlugin':IPlugin}) 84 pluginList = pm.getPluginsOfCategory("Default") 85 86 #============================ 87 if splash != None: 88 from time import sleep 89 count = len(pluginList) 90 splash.setTicks(count) 91 for i in range(count): 92 item=pluginList[i] 93 if globals()['debug']: 94 print "Load: ", 95 print item.name 96 pluginobject = item.plugin_object 97 try: 98 pluginobject.run(self.main_window) 99 except: 100 pass 101 splash.tick("Loading %s" % item.name) 102 sleep(.1) 103 #============================ 29 104 30 105 def stop(self): -
trunk/pyragua/shared/gaugesplash.py
r464 r465 38 38 wx.Frame.__init__(self, None, style=wx.FRAME_NO_TASKBAR) 39 39 self.border = 2 40 40 if type(bmp) == type(''): 41 bmp = wx.Bitmap(bmp) 41 42 self.SetBackgroundColour(wx.WHITE) 42 43 -
trunk/pyragua/shared/yapsy/PluginManager.py
r461 r465 305 305 return len(self._candidates) 306 306 307 def loadPlugins(self, callback=None ):307 def loadPlugins(self, callback=None, candidate_globals=None): 308 308 """ 309 309 Load the candidate plugins that have been identified through a … … 316 316 the callback. 317 317 """ 318 319 if type(candidate_globals) != type({}): 320 candidate_globals = {} 321 318 322 # print "%s.loadPlugins" % self.__class__ 319 323 if not hasattr(self, '_candidates'): … … 328 332 # now execute the file and get its content into a 329 333 # specific dictionnary 330 candidate_globals = {"__file__":candidate_filepath+".py"}334 candidate_globals["__file__"]= candidate_filepath+".py" 331 335 if "__init__" in os.path.basename(candidate_filepath): 332 336 sys.path.append(plugin_info.path) 333 337 try: 334 338 execfile(candidate_filepath+".py",candidate_globals) 335 except Exception,e: 339 except Exception,e: 336 340 logging.debug("Unable to execute the code in plugin: %s" % candidate_filepath) 337 341 logging.debug("\t The following problem occured: %s %s " % (os.linesep, e)) -
trunk/pyragua/ui/mainwindow.py
r464 r465 29 29 class MainWindow(object): 30 30 def __init__(self): 31 self.app = PyraguaApp(0) 31 self.app = PyraguaApp(0) 32 32 self.window = PyraguaMainFrame(None) 33 33
