[Bio] / ModelEditor / ModelEditor Repository:
ViewVC logotype

Diff of /ModelEditor/ModelEditor

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6, Fri Nov 19 23:22:49 2004 UTC revision 1.7, Fri Jan 7 14:40:33 2005 UTC
# Line 3  Line 3 
3  #import signal  #import signal
4  from wxPython.wx import *  from wxPython.wx import *
5    
6    from KahApp.KahConfigMgr import KahConfigMgr
7  from ModelEditor.MainLayout        import MainLayout  from ModelEditor.MainLayout        import MainLayout
8  from ModelEditor.RXpanel           import RXPanel  from ModelEditor.RXpanel           import RXPanel
9  from ModelEditor.RecoElempanel     import RecoElempanel  from ModelEditor.RecoElempanel     import RecoElempanel
# Line 12  Line 13 
13  from ModelEditor.HelpPanel         import HelpPanel  from ModelEditor.HelpPanel         import HelpPanel
14  from ModelEditor.FontManager       import FontManager  from ModelEditor.FontManager       import FontManager
15  from ModelEditor.MainMenuBar       import MainMenuBar  from ModelEditor.MainMenuBar       import MainMenuBar
16  from FaST.BssFactory         import BssFactory  from KahChemDb.KahChemDbDataFactory import KahChemDbDataFactory
17    from KahDataServices.KahDbDataFactory  import KahDbDataFactory
18  from CatalogServices.Catalog import Catalog  from CatalogServices.Catalog import Catalog
19    
20  #need to change panel to Panel. lower case panel is already in cvs.  #need to change panel to Panel. lower case panel is already in cvs.
# Line 34  Line 36 
36          #self.factoryMgr = None          #self.factoryMgr = None
37          MainLayout.__init__(self, *args, **kwds)          MainLayout.__init__(self, *args, **kwds)
38    
39            self.configMgr = KahConfigMgr()
40            self.setupConfig()
41    
42          self.rootId        = None        # root ID for recoelem tree.  why here??          self.rootId        = None        # root ID for recoelem tree.  why here??
43          self.catalogRootId = None        # root ID for catalog tree.          self.catalogRootId = None        # root ID for catalog tree.
44          self.fontManager    = FontManager(self)          self.fontManager    = FontManager(self)
# Line 52  Line 57 
57          #signal.signal(signal.SIGTERM, self.signalHandler)          #signal.signal(signal.SIGTERM, self.signalHandler)
58          #signal.signal(signal.SIGHUP, self.signalHandler)          #signal.signal(signal.SIGHUP, self.signalHandler)
59    
60            self.doDefaultDataFactories()
61            self.doInitialPlugins()
62    
63            return
64    
65        #------------------------------------------------------------------------
66        def getConfigMgr( self ):
67        #------------------------------------------------------------------------
68            return self.configMgr
69    
70        #------------------------------------------------------------------------
71        def setupConfig( self ):
72        #------------------------------------------------------------------------
73    
74            # Config ourselves.  Unusual usage of configMgr.
75    
76            self.configMgr.newSection( "ModelEditor" )
77            cfg = self.configMgr.getSection( "ModelEditor" )
78    
79            cfg.regString( "DefaultDataFactory", "kahchoo/bss@db02" )
80            cfg.regString( "DefaultDataFactoryDbType", "oracle" )
81            cfg.regString( "DefaultChemDb", "pgsql:5432:kahdb:trust:inme" )
82            cfg.regString( "DefaultChemDbType", "postgres" )
83            cfg.regStringList( "PluginList", [] )
84    
85            # now load the config
86    
87            self.configMgr.loadConfigFile( "ModelEditor.cfg" )
88            self.configMgr.dump()
89            return
90    
91    
92        #------------------------------------------------------------------------
93        def doDefaultDataFactories(self):
94        #------------------------------------------------------------------------
95    
96            cfg    = self.configMgr.getSection( "ModelEditor" )
97            ddf    =  cfg.getString("DefaultDataFactory")
98            ddft   = cfg.getString( "DefaultDataFactoryDbType")
99            dchem  = cfg.getString( "DefaultChemDb")
100            dchemt = cfg.getString( "DefaultChemDbType")
101    
102          try:          try:
103              b = BssFactory('biosimscratch/bss@db02', 'oracle' )              #nb: making them auto registeres them in catalog
104              #b = BssFactory('pgsql.mcs.anl.gov:5432:kahdb:trust:inme', "postgres")  
105              #b = BssFactory('porta-video:5432:KahSCDb:trust:inme', "postgres")              df   = KahDbDataFactory( ddf, ddft )
106              #b = BssFactory('fl-gentoo-test:5432:KahSCDb:trust:inme', "postgres")              chem = KahChemDbDataFactory( dchem, dchemt )
107              #b = BssFactory('140.221.204.254:5432:KahSCDb:trust:inme', "postgres")  
             Catalog.instance().addDataFactory( b)  
108          except NotImplementedError:          except NotImplementedError:
109              pass              pass
110    
111          return          return
112    
113        #------------------------------------------------------------------------
114        def doInitialPlugins(self):
115        #------------------------------------------------------------------------
116    
117            cfg    = self.configMgr.getSection( "ModelEditor" )
118    
119            pluginList = cfg.getStringList("PluginList")
120            for p in pluginList:
121                print "trying to get plugin named: ", p
122    
123                try:
124                    self.mainMenuBar.doAddPlugIn( p )
125                except ImportError, e:
126                    print "Could not import %s: %s" % (p, e)
127                except LookupError:
128                    print "No register hook called 'register' found in plugin"
129    
130            return
131    
132        #------------------------------------------------------------------------
133      def error( self, message):      def error( self, message):
134        #------------------------------------------------------------------------
135          dlg = wxMessageDialog(self, message, style=wxOK)          dlg = wxMessageDialog(self, message, style=wxOK)
136          dlg.ShowModal()          dlg.ShowModal()
137          dlg.Destroy()          dlg.Destroy()

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3