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

View of /PyGUI/Catalogpanel.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (download) (as text) (annotate)
Fri Aug 1 20:53:06 2003 UTC (16 years, 4 months ago) by efrank
Branch: MAIN
Changes since 1.4: +14 -7 lines
catalogPanel:
	change so that EVT_TREE_SEL_CHANGED rather than EVT_LEFT_DCLICK so that
	we work through tree as single click.

mainLayout:
	had to latch the Id fro the catalog_tree control
	changed text in some buttons and tabs

from wxPython.wx import *
from FaST.BssFactory import BssFactory
from FaST.WitFactory import WitFactory
from FaST.RecoElem import RecoElem
from RecoElempanel import RecoElemWindow

class CatalogWindow:
    #------------------------------------------------------------------------
    def __init__(self, parent):
    #------------------------------------------------------------------------
        self.parent = parent
        self.to_re = parent.re 
        self.selected = None       #remember last selected catalog entry
                                   #..is used when LOAD button is hit.

        self.initCatEvents()
        self.initCatData()
        return

    
    #------------------------------------------------------------------------
    def initCatEvents(self ):
    #------------------------------------------------------------------------
        button1= self.parent.OK_button
        EVT_BUTTON(self.parent, self.parent.loadbtn.GetId(),
                   self.onLoadBtnPress)
        return
        
    #------------------------------------------------------------------------
    def initCatData( self ):
    #------------------------------------------------------------------------
        self.parent.catalogRootId = self.parent.catalog_tree.AddRoot("Data Sources")

        bssItemId=self.parent.catalog_tree.AppendItem(self.parent.catalogRootId,
                                                   "BioSimScratch" )
        witItemId=self.parent.catalog_tree.AppendItem(self.parent.catalogRootId,
                                                   "WIT3" )

        self.loadBssCatalog( bssItemId )
#        self.loadWitCatalog( witItemId )
        return

    #------------------------------------------------------------------------
    def loadBssCatalog(self, bssItemId):
    #------------------------------------------------------------------------
        b=BssFactory()
        for catEntryTuple in b.getLsCat():
            id=self.parent.catalog_tree.AppendItem(bssItemId, catEntryTuple[0])
            self.parent.catalog_tree.SetPyData(id, catEntryTuple)
            EVT_TREE_SEL_CHANGED(self.parent.catalog_tree,
                                 self.parent.catalog_treeId,
                                 self.onLeftClickBss)

        return
        
    #------------------------------------------------------------------------
    def loadWitCatalog(self, witItemId):
    #------------------------------------------------------------------------
        w=WitFactory()
        pwyList = w.listPathways( )
        for pwy in pwyList: 
            id=self.parent.catalog_tree.AppendItem(witItemId, pwy)
            self.parent.catalog_tree.SetPyData(id, pwy)
            EVT_LEFT_DOWN(self.parent.catalog_tree, self.onLeftClickWitPwy)

        return
        
    #------------------------------------------------------------------------
    def InitLsCat(self):
    #------------------------------------------------------------------------
        return

    #------------------------------------------------------------------------
    def onLeftClickBss(self,treeEvent):
    #------------------------------------------------------------------------
#        pt=event.GetPosition()
#        item, flags= self.parent.catalog_tree.HitTest(pt)
        item = treeEvent.GetItem()
        catEntryTuple = self.parent.tree_ctr.GetPyData(item)
        if (catEntryTuple == None ):
            print "No catEntry"
            return
        else:
            print catEntryTuple
        self.selected = catEntryTuple[1]

        return

    #------------------------------------------------------------------------
    def onLeftClickWitPwy(self,event):
    #------------------------------------------------------------------------
        pt=event.GetPosition()
        item, flags = self.parent.catalog_tree.HitTest(pt)
        pwy = self.parent.tree_ctr.GetPyData(item)
        print "request to fetch pathway from wit: ", pwy

        return

        
    #------------------------------------------------------------------------
    def onLoadBtnPress(self, event):
    #------------------------------------------------------------------------
        if ( self.selected == None ): return 

        wxBeginBusyCursor()
        b=BssFactory()
        top= b.getRecoElemById( self.selected )
        self.to_re.AddRecoElemTree(self.parent.rootId, top)
        wxEndBusyCursor()
        return
    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3