[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.2, Thu Jul 31 15:54:29 2003 UTC revision 1.5, Fri Aug 1 20:53:06 2003 UTC
# Line 1  Line 1 
1  from wxPython.wx import *  from wxPython.wx import *
2  from FaST.BssFactory import BssFactory  from FaST.BssFactory import BssFactory
3    from FaST.WitFactory import WitFactory
4  from FaST.RecoElem import RecoElem  from FaST.RecoElem import RecoElem
5  from RecoElempanel import RecoElemWindow  from RecoElempanel import RecoElemWindow
6    
7  class CatalogWindow:  class CatalogWindow:
8        #------------------------------------------------------------------------
9      def __init__(self, parent):      def __init__(self, parent):
10        #------------------------------------------------------------------------
11          self.parent = parent          self.parent = parent
12          self.to_re = parent.re          self.to_re = parent.re
13          self.selected = None       #remember last selected catalog entry          self.selected = None       #remember last selected catalog entry
14                                     #..is used when LOAD button is hit.                                     #..is used when LOAD button is hit.
15    
16            self.initCatEvents()
17            self.initCatData()
18            return
19    
20    
21        #------------------------------------------------------------------------
22        def initCatEvents(self ):
23        #------------------------------------------------------------------------
24          button1= self.parent.OK_button          button1= self.parent.OK_button
25          EVT_BUTTON(self.parent, self.parent.loadbtn.GetId(),          EVT_BUTTON(self.parent, self.parent.loadbtn.GetId(),
26                     self.onLoadBtnPress)                     self.onLoadBtnPress)
27            return
28    
29        #------------------------------------------------------------------------
30        def initCatData( self ):
31        #------------------------------------------------------------------------
32            self.parent.catalogRootId = self.parent.catalog_tree.AddRoot("Data Sources")
33    
34            bssItemId=self.parent.catalog_tree.AppendItem(self.parent.catalogRootId,
35                                                       "BioSimScratch" )
36            witItemId=self.parent.catalog_tree.AppendItem(self.parent.catalogRootId,
37                                                       "WIT3" )
38    
39            self.loadBssCatalog( bssItemId )
40    #        self.loadWitCatalog( witItemId )
41          return          return
42    
43      def InitLsCat(self):      #------------------------------------------------------------------------
44        def loadBssCatalog(self, bssItemId):
45        #------------------------------------------------------------------------
46          b=BssFactory()          b=BssFactory()
47          cpanel_list = b.getLsCat()          for catEntryTuple in b.getLsCat():
48                id=self.parent.catalog_tree.AppendItem(bssItemId, catEntryTuple[0])
49                self.parent.catalog_tree.SetPyData(id, catEntryTuple)
50                EVT_TREE_SEL_CHANGED(self.parent.catalog_tree,
51                                     self.parent.catalog_treeId,
52                                     self.onLeftClickBss)
53    
54            return
55    
56          for x in cpanel_list:      #------------------------------------------------------------------------
57              self.parent.catalog_listbox.Append(x[0], x[1])      def loadWitCatalog(self, witItemId):
58        #------------------------------------------------------------------------
59            w=WitFactory()
60            pwyList = w.listPathways( )
61            for pwy in pwyList:
62                id=self.parent.catalog_tree.AppendItem(witItemId, pwy)
63                self.parent.catalog_tree.SetPyData(id, pwy)
64                EVT_LEFT_DOWN(self.parent.catalog_tree, self.onLeftClickWitPwy)
65    
         EVT_LISTBOX(self.parent, self.parent.catalog_listbox.GetId(), self.onLeftClick)  
66          return          return
67    
68      def onLeftClick(self,event):      #------------------------------------------------------------------------
69          pt=self.parent.catalog_listbox.GetSelection()      def InitLsCat(self):
70          self.selected =int (self.parent.catalog_listbox.GetClientData(pt))      #------------------------------------------------------------------------
71            return
72    
73        #------------------------------------------------------------------------
74        def onLeftClickBss(self,treeEvent):
75        #------------------------------------------------------------------------
76    #        pt=event.GetPosition()
77    #        item, flags= self.parent.catalog_tree.HitTest(pt)
78            item = treeEvent.GetItem()
79            catEntryTuple = self.parent.tree_ctr.GetPyData(item)
80            if (catEntryTuple == None ):
81                print "No catEntry"
82                return
83            else:
84                print catEntryTuple
85            self.selected = catEntryTuple[1]
86    
87          return          return
88    
89        #------------------------------------------------------------------------
90        def onLeftClickWitPwy(self,event):
91        #------------------------------------------------------------------------
92            pt=event.GetPosition()
93            item, flags = self.parent.catalog_tree.HitTest(pt)
94            pwy = self.parent.tree_ctr.GetPyData(item)
95            print "request to fetch pathway from wit: ", pwy
96    
97            return
98    
99    
100        #------------------------------------------------------------------------
101      def onLoadBtnPress(self, event):      def onLoadBtnPress(self, event):
102        #------------------------------------------------------------------------
103            if ( self.selected == None ): return
104    
105          wxBeginBusyCursor()          wxBeginBusyCursor()
106          b=BssFactory()          b=BssFactory()
107          top= b.getRecoElemById( self.selected )          top= b.getRecoElemById( self.selected )

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3