[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.3, Fri Aug 1 15:33:39 2003 UTC revision 1.4, Fri Aug 1 18:54:31 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("Available 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_LEFT_DCLICK(self.parent.catalog_tree, self.onLeftClickBss)
51    
52            return
53    
54        #------------------------------------------------------------------------
55        def loadWitCatalog(self, witItemId):
56        #------------------------------------------------------------------------
57            w=WitFactory()
58            pwyList = w.listPathways( )
59            for pwy in pwyList:
60                id=self.parent.catalog_tree.AppendItem(witItemId, pwy)
61                self.parent.catalog_tree.SetPyData(id, pwy)
62                EVT_LEFT_DCLICK(self.parent.catalog_tree, self.onLeftClickWitPwy)
63    
64            return
65    
66         ##  for x in cpanel_list:      #------------------------------------------------------------------------
67  ##             self.parent.catalog_listbox.Append(x[0], x[1])      def InitLsCat(self):
68        #------------------------------------------------------------------------
69            return
70    
71  ##         EVT_LISTBOX(self.parent, self.parent.catalog_listbox.GetId(), self.onLeftClick)      #------------------------------------------------------------------------
72          #return      def onLeftClickBss(self,event):
73        #------------------------------------------------------------------------
74            pt=event.GetPosition()
75            item, flags = self.parent.catalog_tree.HitTest(pt)
76            catEntryTuple = self.parent.tree_ctr.GetPyData(item)
77            print catEntryTuple
78            self.selected = catEntryTuple[1]
79    
80          self.parent.rootId = self.parent.catalog_tree.AddRoot("catalog item")          return
81    
82        #------------------------------------------------------------------------
83        def onLeftClickWitPwy(self,event):
84        #------------------------------------------------------------------------
85            pt=event.GetPosition()
86            item, flags = self.parent.catalog_tree.HitTest(pt)
87            pwy = self.parent.tree_ctr.GetPyData(item)
88            print "request to fetch pathway from wit: ", pwy
89    
     def onLeftClick(self,event):  
         pt=self.parent.catalog_listbox.GetSelection()  
         self.selected =int (self.parent.catalog_listbox.GetClientData(pt))  
90          return          return
91    
92    
93        #------------------------------------------------------------------------
94      def onLoadBtnPress(self, event):      def onLoadBtnPress(self, event):
95        #------------------------------------------------------------------------
96            if ( self.selected == None ): return
97    
98          wxBeginBusyCursor()          wxBeginBusyCursor()
99          b=BssFactory()          b=BssFactory()
100          top= b.getRecoElemById( self.selected )          top= b.getRecoElemById( self.selected )

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3