Parent Directory
|
Revision Log
Revision 1.10 - (view) (download) (as text)
1 : | hwang | 1.1 | from wxPython.wx import * |
2 : | from FaST.BssFactory import BssFactory | ||
3 : | efrank | 1.4 | from FaST.WitFactory import WitFactory |
4 : | hwang | 1.1 | from FaST.RecoElem import RecoElem |
5 : | from RecoElempanel import RecoElemWindow | ||
6 : | |||
7 : | class CatalogWindow: | ||
8 : | efrank | 1.10 | # def __init__(self, parent): |
9 : | # def initCatEvents(self ): | ||
10 : | # def initCatData( self ): | ||
11 : | # def loadBssCatalog(self, bssItemId): | ||
12 : | # def loadWitCatalog(self, witItemId): | ||
13 : | # def onLeftClick(self,treeEvent): | ||
14 : | # def onLoadBtnPress(self, event): | ||
15 : | # def bssLoader( self, bssCatEntry ): | ||
16 : | # def witOrgLoader(self, orgName ): | ||
17 : | # def witPwyLoader(self, pwyName ): | ||
18 : | |||
19 : | efrank | 1.4 | #------------------------------------------------------------------------ |
20 : | hwang | 1.1 | def __init__(self, parent): |
21 : | efrank | 1.4 | #------------------------------------------------------------------------ |
22 : | hwang | 1.1 | self.parent = parent |
23 : | self.to_re = parent.re | ||
24 : | efrank | 1.2 | self.selected = None #remember last selected catalog entry |
25 : | #..is used when LOAD button is hit. | ||
26 : | efrank | 1.4 | |
27 : | self.initCatEvents() | ||
28 : | self.initCatData() | ||
29 : | return | ||
30 : | |||
31 : | |||
32 : | #------------------------------------------------------------------------ | ||
33 : | def initCatEvents(self ): | ||
34 : | #------------------------------------------------------------------------ | ||
35 : | efrank | 1.2 | button1= self.parent.OK_button |
36 : | EVT_BUTTON(self.parent, self.parent.loadbtn.GetId(), | ||
37 : | self.onLoadBtnPress) | ||
38 : | efrank | 1.6 | EVT_TREE_SEL_CHANGED(self.parent.catalog_tree, |
39 : | self.parent.catalog_treeId, | ||
40 : | self.onLeftClick) | ||
41 : | |||
42 : | efrank | 1.4 | return |
43 : | |||
44 : | #------------------------------------------------------------------------ | ||
45 : | def initCatData( self ): | ||
46 : | #------------------------------------------------------------------------ | ||
47 : | efrank | 1.5 | self.parent.catalogRootId = self.parent.catalog_tree.AddRoot("Data Sources") |
48 : | hwang | 1.1 | |
49 : | efrank | 1.4 | bssItemId=self.parent.catalog_tree.AppendItem(self.parent.catalogRootId, |
50 : | "BioSimScratch" ) | ||
51 : | witItemId=self.parent.catalog_tree.AppendItem(self.parent.catalogRootId, | ||
52 : | "WIT3" ) | ||
53 : | |||
54 : | self.loadBssCatalog( bssItemId ) | ||
55 : | efrank | 1.9 | self.loadWitCatalog( witItemId ) |
56 : | efrank | 1.6 | |
57 : | self.parent.catalog_tree.Expand( self.parent.catalogRootId) | ||
58 : | efrank | 1.2 | return |
59 : | efrank | 1.4 | |
60 : | #------------------------------------------------------------------------ | ||
61 : | def loadBssCatalog(self, bssItemId): | ||
62 : | #------------------------------------------------------------------------ | ||
63 : | hwang | 1.1 | b=BssFactory() |
64 : | efrank | 1.4 | for catEntryTuple in b.getLsCat(): |
65 : | id=self.parent.catalog_tree.AppendItem(bssItemId, catEntryTuple[0]) | ||
66 : | efrank | 1.6 | self.parent.catalog_tree.SetPyData(id, (self.bssLoader, catEntryTuple) ) |
67 : | efrank | 1.4 | |
68 : | return | ||
69 : | hwang | 1.1 | |
70 : | efrank | 1.4 | #------------------------------------------------------------------------ |
71 : | def loadWitCatalog(self, witItemId): | ||
72 : | #------------------------------------------------------------------------ | ||
73 : | w=WitFactory() | ||
74 : | efrank | 1.6 | |
75 : | pwyItemId=self.parent.catalog_tree.AppendItem(witItemId, "Pathways" ) | ||
76 : | |||
77 : | efrank | 1.4 | pwyList = w.listPathways( ) |
78 : | for pwy in pwyList: | ||
79 : | efrank | 1.6 | id=self.parent.catalog_tree.AppendItem(pwyItemId, pwy) |
80 : | self.parent.catalog_tree.SetPyData(id, (self.witPwyLoader,pwy) ) | ||
81 : | |||
82 : | orgItemId=self.parent.catalog_tree.AppendItem(witItemId, "Organisms" ) | ||
83 : | |||
84 : | orgList = w.listOrganisms( ) | ||
85 : | for org in orgList: | ||
86 : | id=self.parent.catalog_tree.AppendItem(orgItemId, org) | ||
87 : | self.parent.catalog_tree.SetPyData(id, (self.witOrgLoader, org )) | ||
88 : | hwang | 1.3 | |
89 : | efrank | 1.4 | return |
90 : | hwang | 1.3 | |
91 : | efrank | 1.4 | #------------------------------------------------------------------------ |
92 : | efrank | 1.6 | def onLeftClick(self,treeEvent): |
93 : | efrank | 1.4 | #------------------------------------------------------------------------ |
94 : | efrank | 1.5 | item = treeEvent.GetItem() |
95 : | efrank | 1.4 | catEntryTuple = self.parent.tree_ctr.GetPyData(item) |
96 : | efrank | 1.5 | if (catEntryTuple == None ): |
97 : | return | ||
98 : | efrank | 1.6 | self.selected = catEntryTuple |
99 : | efrank | 1.4 | |
100 : | return | ||
101 : | |||
102 : | #------------------------------------------------------------------------ | ||
103 : | efrank | 1.6 | def onLoadBtnPress(self, event): |
104 : | efrank | 1.4 | #------------------------------------------------------------------------ |
105 : | efrank | 1.6 | if ( self.selected == None ): |
106 : | print "No selection in onLoadBtnPress" | ||
107 : | return | ||
108 : | |||
109 : | catEntryTuple = self.selected | ||
110 : | apply( catEntryTuple[0], [catEntryTuple[1]] ) | ||
111 : | |||
112 : | return | ||
113 : | |||
114 : | #------------------------------------------------------------------------ | ||
115 : | def bssLoader( self, bssCatEntry ): | ||
116 : | #------------------------------------------------------------------------ | ||
117 : | wxBeginBusyCursor() | ||
118 : | b=BssFactory() | ||
119 : | top= b.getRecoElemById( bssCatEntry[1] ) | ||
120 : | self.to_re.AddRecoElemTree(self.parent.rootId, top) | ||
121 : | wxEndBusyCursor() | ||
122 : | hwang | 1.1 | |
123 : | efrank | 1.2 | return |
124 : | hwang | 1.1 | |
125 : | efrank | 1.4 | #------------------------------------------------------------------------ |
126 : | efrank | 1.6 | def witOrgLoader(self, orgName ): |
127 : | efrank | 1.4 | #------------------------------------------------------------------------ |
128 : | efrank | 1.6 | wxBeginBusyCursor() |
129 : | w=WitFactory() | ||
130 : | top= w.getRxnByOrg( orgName ) | ||
131 : | self.to_re.AddRecoElemTree(self.parent.rootId, top) | ||
132 : | wxEndBusyCursor() | ||
133 : | return | ||
134 : | efrank | 1.4 | |
135 : | efrank | 1.6 | #------------------------------------------------------------------------ |
136 : | def witPwyLoader(self, pwyName ): | ||
137 : | #------------------------------------------------------------------------ | ||
138 : | efrank | 1.2 | wxBeginBusyCursor() |
139 : | efrank | 1.6 | w=WitFactory() |
140 : | top= w.getRxnByPwy( pwyName ) | ||
141 : | hwang | 1.1 | self.to_re.AddRecoElemTree(self.parent.rootId, top) |
142 : | efrank | 1.2 | wxEndBusyCursor() |
143 : | return |
MCS Webmaster | ViewVC Help |
Powered by ViewVC 1.0.3 |