16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2001-2002 Free Software Foundation |
# Copyright 2001-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# schema/TreeView.py |
# schema/TreeView.py |
30 |
import sys, os |
import sys, os |
31 |
from wxPython.wx import * |
from wxPython.wx import * |
32 |
from gnue.common import GDebug |
from gnue.common import GDebug |
33 |
from gnue.designer.Icons import treeIconMap, treeIconList |
from gnue.designer.base.Icons import treeIconMap, treeIconList |
34 |
from gnue.designer.TreeView import TreeView as BaseTreeView |
from gnue.designer.base.tools.TreeView import TreeView as BaseTreeView |
35 |
|
|
36 |
class TreeView (BaseTreeView): |
class TreeView (BaseTreeView): |
37 |
def __init__(self, instance, root, parent): |
def __init__(self, instance, root, parent): |
38 |
|
|
39 |
self.rootDescr = 'Schema' |
self.rootDescr = 'Schema' |
40 |
BaseTreeView.__init__(self, instance, root, parent) |
BaseTreeView.__init__(self, instance, root, parent) |
41 |
self.SetPyData(self.rootObject._treeItem, self.rootObject) |
self.tree.SetPyData(self.rootObject._treeItem, self.rootObject) |
42 |
self.rootObject.walk(self.inventoryObject) |
self.rootObject.walk(self.inventoryObject) |
43 |
|
|
44 |
|
|
47 |
icon = 'properties' |
icon = 'properties' |
48 |
try: |
try: |
49 |
parentTreeItem = object._parent._treeItem |
parentTreeItem = object._parent._treeItem |
50 |
except AttributeError: |
except AttributeError: |
51 |
parentTreeItem = None |
parentTreeItem = None |
52 |
# TODO: |
# TODO: |
53 |
print "The parent object of this object has not been registered to "+\ |
print "The parent object of this object has not been registered to "+\ |
54 |
"the TreeView inventory. It is not possible to add this "+\ |
"the TreeView inventory. It is not possible to add this "+\ |
55 |
"object to the inventory at the moment. This needs to be "+\ |
"object to the inventory at the moment. This needs to be "+\ |
56 |
"fixed. (Obj: ",object,")." |
"fixed. (Obj: ",object,")." |
57 |
|
|
58 |
return |
return |
59 |
if object._type == 'GSTables': |
if object._type == 'GSTables': |
60 |
icon = 'datasource' |
icon = 'datasource' |
61 |
elif object._type == 'GSTable': |
elif object._type == 'GSTable': |
65 |
|
|
66 |
object._treeItem = self.AppendItem(parentTreeItem, |
object._treeItem = self.AppendItem(parentTreeItem, |
67 |
"%s" % object.getDescription()) |
"%s" % object.getDescription()) |
68 |
self.SetPyData(object._treeItem, object) |
self.tree.SetPyData(object._treeItem, object) |
69 |
#self.SetItemImage(object._treeItem, treeIconMap[icon]) |
#self.tree.SetItemImage(object._treeItem, treeIconMap[icon]) |
70 |
|
|
71 |
|
|