[Bio] / PyGUI / Catalogpanel.py Repository:
ViewVC logotype

Diff of /PyGUI/Catalogpanel.py

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

revision 1.26, Wed Jun 9 22:36:10 2004 UTC revision 1.27, Wed Jun 23 19:02:51 2004 UTC
# Line 9  Line 9 
9    
10    
11  class Catalogpanel:  class Catalogpanel:
 #    def __init__(self, parent):  
 #    def initCatEvents(self ):  
 #    def initCatData( self ):  
 #    def loadBssCatalog(self, bssItemId):  
 #    def loadWitCatalog(self, witItemId):  
 #    def loadSeedCatalog(self, witItemId):  
 #    def onLeftClick(self,treeEvent):  
 #    def onLoadBtnPress(self, event):  
 #    def bssLoader( self, bssCatEntry ):  
 #    def witOrgLoader(self,  orgName ):  
 #    def witPwyLoader(self,  pwyName ):  
   
12      #------------------------------------------------------------------------      #------------------------------------------------------------------------
13      def __init__(self, parent):      def __init__(self, parent):
14      #------------------------------------------------------------------------      #------------------------------------------------------------------------
# Line 97  Line 85 
85          return          return
86    
87      #------------------------------------------------------------------------      #------------------------------------------------------------------------
     def loadBssCatalog(self, bssItemId):  
     #------------------------------------------------------------------------  
         b=BssFactory()  
         Catalog.instance().addDataFactory( b )  
         for catEntryTuple in b.getLsCat():  
             id=self.parent.catalog_tree.AppendItem(bssItemId, catEntryTuple[0])  
             self.parent.catalog_tree.SetPyData(id, (self.bssLoader, catEntryTuple, id) )  
   
         return  
   
     #------------------------------------------------------------------------  
     def loadWitCatalog(self, witItemId):  
     #------------------------------------------------------------------------  
         w=WitFactory()  
         Catalog.instance().addDataFactory( w )  
         pwyItemId=self.parent.catalog_tree.AppendItem(witItemId, "Pathways" )  
   
         pwyList = w.listPathways( )  
         for pwy in pwyList:  
             id=self.parent.catalog_tree.AppendItem(pwyItemId, pwy)  
             self.parent.catalog_tree.SetPyData(id, (self.witPwyLoader,pwy, id) )  
   
         orgItemId=self.parent.catalog_tree.AppendItem(witItemId, "Organisms" )  
   
         orgList = w.listOrganisms( )  
         for org in orgList:  
             id=self.parent.catalog_tree.AppendItem(orgItemId, org)  
             self.parent.catalog_tree.SetPyData(id, (self.witOrgLoader, org, id ))  
   
         return  
   
     #------------------------------------------------------------------------  
88      def loadCatalog(self):      def loadCatalog(self):
89      #------------------------------------------------------------------------      #------------------------------------------------------------------------
90          wxBeginBusyCursor()          wxBeginBusyCursor()
# Line 195  Line 151 
151      #------------------------------------------------------------------------      #------------------------------------------------------------------------
152      def loadSeedCatalog(self, seedServer ):      def loadSeedCatalog(self, seedServer ):
153      #------------------------------------------------------------------------      #------------------------------------------------------------------------
154          wxBeginBusyCursor()          """
155            This adds a Seed instance to the catalog.  It is called from the
156          seedFactory   = SeedDataFactory( seedServer )          MainMenuBar when Data->Add Seed Instance is called, for example.
157            """
         # add it to the list in the catalog  
         try:  
             Catalog.instance().addDataFactory( seedFactory )  
         except:  
             self.parent.error("loadSeedCatalog: %s already in foundry list." % seedServer)  
             wxEndBusyCursor()  
             return  
   
         top = seedFactory.getCatalogTop()  
         self.recurseCatalog( top, self.parent.catalog_tree, self.parent.catalogRootId)  
   
         wxEndBusyCursor()  
   
         return  
158    
     #------------------------------------------------------------------------  
     def OLDloadSeedCatalog(self, seedServer ):  
     #------------------------------------------------------------------------  
159          wxBeginBusyCursor()          wxBeginBusyCursor()
160    
161          # The SeedDataFactory ctor is slow and actually reads a bunch of          # The SeedDataFactory ctor is slow and actually reads a bunch of
# Line 232  Line 171 
171              wxEndBusyCursor()              wxEndBusyCursor()
172              return              return
173    
174          # make an entry in the tree for it          top = seedFactory.getCatalogTop()
175          #          self.recurseCatalog( top, self.parent.catalog_tree, self.parent.catalogRootId)
         newSeedItemId=self.parent.catalog_tree.AppendItem(self.seedItemId, seedServer )  
176    
         # jam in the data  
         #  
         orgList = seedFactory.listOrganisms( )  
         if ( orgList== None ):  
             orgItemId=self.parent.catalog_tree.AppendItem(newSeedItemId,  
                          "Could not get Org list from "+ seedServer )  
177              wxEndBusyCursor()              wxEndBusyCursor()
             return  
   
         itemName="Spontaneous Reactions"  
         spontaneousRxItemId=self.parent.catalog_tree.AppendItem(newSeedItemId, itemName)  
         self.parent.catalog_tree.SetPyData(spontaneousRxItemId,  
                                            (self.seedRecoElemLoader,  
                                            (seedFactory.getRecoElemSpontaneousRx, None),  
                                             spontaneousRxItemId ))  
   
   
         orgItemId=self.parent.catalog_tree.AppendItem(newSeedItemId, "Organisms" )  
         for org in orgList:  
             id=self.parent.catalog_tree.AppendItem(orgItemId, org.figOrgName )  
             self.parent.catalog_tree.SetPyData(id, (self.seedRecoElemLoader,  
                                                    (seedFactory.getRecoElemByOrg, org), id) )  
   
178    
         wxEndBusyCursor()  
179          return          return
180    
181      #------------------------------------------------------------------------      #------------------------------------------------------------------------
# Line 270  Line 185 
185    
186          catEntryTuple = self.parent.tree_ctr.GetPyData(item)          catEntryTuple = self.parent.tree_ctr.GetPyData(item)
187          if (catEntryTuple == None ):          if (catEntryTuple == None ):
             print "None value for catEntryTuple"  
188              return              return
189          self.selected = catEntryTuple          self.selected = catEntryTuple
190          catEntry   = catEntryTuple[1]          catEntry   = catEntryTuple[1]
# Line 295  Line 209 
209                  self.parent.catPathValue.SetLabel( catEntry.path()+";[None]" )                  self.parent.catPathValue.SetLabel( catEntry.path()+";[None]" )
210                  theBox.SetValue( "None" )                  theBox.SetValue( "None" )
211              else:              else:
                 print "versions are ", versions  
212                  maxVersion = max( versions )                  maxVersion = max( versions )
213                  for v in versions:                  for v in versions:
214                      theBox.Append( "%s" % (v ) )                      theBox.Append( "%s" % (v ) )
# Line 335  Line 248 
248      #------------------------------------------------------------------------      #------------------------------------------------------------------------
249      def onRightClickCatalogTree(self, event):      def onRightClickCatalogTree(self, event):
250      #------------------------------------------------------------------------      #------------------------------------------------------------------------
251            """ Fires off the pop-up menu to handle right click events. """
252    
253          goober = event.GetEventObject()          event.GetEventObject().PopupMenu(self.catEditMenu, event.GetPosition())
         goober.PopupMenu(self.catEditMenu, event.GetPosition())  
   
254          return          return
255    
256      #------------------------------------------------------------------------      #------------------------------------------------------------------------
# Line 427  Line 339 
339      #------------------------------------------------------------------------      #------------------------------------------------------------------------
340      def onLeftDClick(self, event):      def onLeftDClick(self, event):
341      #------------------------------------------------------------------------      #------------------------------------------------------------------------
342            """ Double left-click means, "Load the currently selected item." """
343    
344          if ( self.selected == None ):          if ( self.selected == None ):
345              print "No selection in onLoadBtnPress"              self.parent.error( "You must select a catalog entry before requesting load.")
346              return              return
347    
348            # We store a loader to actually load the selected item.  This dates
349            # back to a time before a single loader could handle all the various
350            # data factory kinds.
351    
352          catEntryTuple = self.selected          catEntryTuple = self.selected
353          apply( catEntryTuple[0], [catEntryTuple[1]] )          apply( catEntryTuple[0], [catEntryTuple[1]] )
354    
# Line 446  Line 364 
364          if (catalogEntry.isTerminal() ):          if (catalogEntry.isTerminal() ):
365              ver = self.parent.catVersionValueComboBox.GetValue()              ver = self.parent.catVersionValueComboBox.GetValue()
366              if ( ver == "None" ):              if ( ver == "None" ):
367                  top = RecoElem( catalogEntry.name(), 1 )                  top = RecoElem( catalogEntry.name() )
368              else:              else:
369                  top = catalogEntry.read( int( ver ) )                  top = catalogEntry.read( int( ver ) )
370    
371              self.to_re.AddRecoElemTree(self.parent.rootId, top, catalogEntry)              self.to_re.addRecoElemTree(self.parent.rootId, top, catalogEntry)
372          else:          else:
373              # current selection is directory. can't load that!              # current selection is directory. can't load that!
374              wxEndBusyCursor()              wxEndBusyCursor()
# Line 461  Line 379 
379          return          return
380    
381      #------------------------------------------------------------------------      #------------------------------------------------------------------------
382      def bssLoader( self, bssCatEntry ):      def DOOMwitPwyLoader(self,  pwyName ):
     #------------------------------------------------------------------------  
         wxBeginBusyCursor()  
         b=BssFactory()  
         top= b.getRecoElemById( bssCatEntry[1] )  
         self.to_re.AddRecoElemTree(self.parent.rootId, top)  
         wxEndBusyCursor()  
   
         return  
   
     #------------------------------------------------------------------------  
     def witOrgLoader(self,  orgName ):  
     #------------------------------------------------------------------------  
         wxBeginBusyCursor()  
         w=WitFactory()  
         top= w.getRxnByOrg( orgName )  
         self.to_re.AddRecoElemTree(self.parent.rootId, top)  
         wxEndBusyCursor()  
         return  
   
     #------------------------------------------------------------------------  
     def seedRecoElemLoader(self,  argList ):  
     #------------------------------------------------------------------------  
         wxBeginBusyCursor()  
   
         (theSeedFactoryMethod, org) = argList  
         top = apply( theSeedFactoryMethod, [org] )  
         # top=self.__seedDataFactory.getRecoElemByOrg( org )  
         self.to_re.AddRecoElemTree(self.parent.rootId, top)  
   
         wxEndBusyCursor()  
         return  
   
     #------------------------------------------------------------------------  
     def witPwyLoader(self,  pwyName ):  
383      #------------------------------------------------------------------------      #------------------------------------------------------------------------
384          wxBeginBusyCursor()          wxBeginBusyCursor()
385          w=WitFactory()          w=WitFactory()
386          top= w.getRxnByPwy( pwyName )          top= w.getRxnByPwy( pwyName )
387          self.to_re.AddRecoElemTree(self.parent.rootId, top)          self.to_re.addRecoElemTree(self.parent.rootId, top)
388          wxEndBusyCursor()          wxEndBusyCursor()
389          return          return

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3