| | 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 | #============================ |