[Bio] / ModelEditor / ModelEditor Repository:
ViewVC logotype

Diff of /ModelEditor/ModelEditor

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

revision 1.5, Mon Nov 8 00:34:17 2004 UTC revision 1.8, Mon Jan 31 16:52:09 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            # nb: making these datafactories auto registeres them in catalog
103          try:          try:
104              #b = BssFactory('biosimscratch/bss@db02', 'oracle' )              df   = KahDbDataFactory( ddf, ddft )
             #b = BssFactory('pgsql.mcs.anl.gov:5432:kahdb:trust:inme', "postgres")  
             #b = BssFactory('porta-video:5432:KahSCDb:trust:inme', "postgres")  
             #b = BssFactory('fl-gentoo-test:5432:KahSCDb:trust:inme', "postgres")  
             b = BssFactory('140.221.204.254:5432:KahSCDb:trust:inme', "postgres")  
             Catalog.instance().addDataFactory( b)  
105          except NotImplementedError:          except NotImplementedError:
106              pass              pass
107    
108            try:
109                chem = KahChemDbDataFactory( dchem, dchemt )
110            except NotImplementedError:
111                pass
112    
113            return
114    
115        #------------------------------------------------------------------------
116        def doInitialPlugins(self):
117        #------------------------------------------------------------------------
118    
119            cfg    = self.configMgr.getSection( "ModelEditor" )
120    
121            pluginList = cfg.getStringList("PluginList")
122            for p in pluginList:
123                print "trying to get plugin named: ", p
124    
125                try:
126                    self.mainMenuBar.doAddPlugIn( p )
127                except ImportError, e:
128                    print "Could not import %s: %s" % (p, e)
129                except LookupError:
130                    print "No register hook called 'register' found in plugin"
131    
132          return          return
133    
134        #------------------------------------------------------------------------
135      def error( self, message):      def error( self, message):
136        #------------------------------------------------------------------------
137          dlg = wxMessageDialog(self, message, style=wxOK)          dlg = wxMessageDialog(self, message, style=wxOK)
138          dlg.ShowModal()          dlg.ShowModal()
139          dlg.Destroy()          dlg.Destroy()

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.8

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3