/[papo]/gnue/designer/src/reports/TreeView.py
ViewVC logotype

Diff of /gnue/designer/src/reports/TreeView.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by styxman, Fri Nov 8 16:46:03 2002 UTC revision 1.3.4.1 by anthonyl, Tue Mar 4 22:11:40 2003 UTC
# Line 1  Line 1 
1  #  #
2  # This file is part of GNU Enterprise.  # This file is part of GNU Enterprise.
3  #  #
4  # GNU Enterprise is free software; you can redistribute it  # GNU Enterprise is free software; you can redistribute it
5  # and/or modify it under the terms of the GNU General Public  # and/or modify it under the terms of the GNU General Public
6  # License as published by the Free Software Foundation; either  # License as published by the Free Software Foundation; either
7  # version 2, or (at your option) any later version.  # version 2, or (at your option) any later version.
8  #  #
9  # GNU Enterprise is distributed in the hope that it will be  # GNU Enterprise is distributed in the hope that it will be
10  # useful, but WITHOUT ANY WARRANTY; without even the implied  # useful, but WITHOUT ANY WARRANTY; without even the implied
11  # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR  # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  # PURPOSE. See the GNU General Public License for more details.  # PURPOSE. See the GNU General Public License for more details.
13  #  #
14  # You should have received a copy of the GNU General Public  # You should have received a copy of the GNU General Public
15  # License along with program; see the file COPYING. If not,  # License along with program; see the file COPYING. If not,
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  # reports/TreeView.py  # reports/TreeView.py
23  #  #
24  # DESCRIPTION:  # DESCRIPTION:
25  #  #
26  # NOTES:  # NOTES:
27  #  #
28  # TODO: all the SetItemImage lines in this file have been commented out as on win32 it was segfaulting  # TODO: all the SetItemImage lines in this file have been commented out as on win32 it was segfaulting
29    
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.reports import GRReport, GRLayout, GRSources, GRParameters, GRSortOptions  from gnue.reports.base import GRReport, GRSources, GRParameters, GRSortOptions
34  from gnue.designer.PopupMenu import ObjectMenu  from gnue.reports.base import layout as GRLayout
35  from gnue.designer.Icons import treeIconMap, treeIconList  from gnue.designer.base.PopupMenu import ObjectMenu
36  from gnue.designer.TreeView import TreeView as BaseTreeView  from gnue.designer.base.Icons import treeIconMap, treeIconList
37    from gnue.designer.base.tools.TreeView import TreeView as BaseTreeView
38  class TreeView (BaseTreeView):  
39    def __init__(self, instance, root, parent):  class TreeView (BaseTreeView):
40      def __init__(self, instance, root, parent):
41      self.rootDescr = 'Report'  
42      BaseTreeView.__init__(self, instance, root, parent)      self.rootDescr = 'Report'
43        BaseTreeView.__init__(self, instance, root, parent)
44      self.SetPyData(self.rootObject._treeItem, self.rootObject)  
45        self.tree.SetPyData(self.rootObject._treeItem, self.rootObject)
46      self.rootObject.walk(self.inventoryObject)  
47        self.rootObject.walk(self.inventoryObject)
48    def inventoryObject (self, object):  
49      if object != self.rootObject:    def inventoryObject (self, object):
50        # TODO: icons for reports wanted (btami)      if object != self.rootObject:
51        icon = 'properties'        # TODO: icons for reports wanted (btami)
52        parentTreeItem = object._parent._treeItem        icon = 'properties'
53        if isinstance(object, GRParameters.GRParameters):        parentTreeItem = object._parent._treeItem
54          icon = 'properties'        if isinstance(object, GRParameters.GRParameters):
55        elif isinstance(object, GRSortOptions.GRSortOptions):          icon = 'properties'
56          icon = 'properties'        elif isinstance(object, GRSortOptions.GRSortOptions):
57        elif isinstance(object, GRSources.GRSources):          icon = 'properties'
58          icon = 'datasource'        elif isinstance(object, GRSources.GRSources):
59        elif isinstance(object, GRLayout.GRLayout):          icon = 'datasource'
60          icon = 'page'        elif isinstance(object, GRLayout.GRLayout):
61        elif object._type == 'GRSsection':          icon = 'page'
62          icon = 'block'        elif object._type == 'GRSsection':
63        elif object._type == 'GRSumm':          icon = 'block'
64          icon = 'entry'        elif object._type == 'GRSumm':
65        elif object._type == 'GRFiled':          icon = 'entry'
66          icon = 'entry'        elif object._type == 'GRFiled':
67            icon = 'entry'
68        object._treeItem = self.AppendItem(parentTreeItem,  
69            "%s" % object.getDescription())        object._treeItem = self.AppendItem(parentTreeItem,
70        self.SetPyData(object._treeItem, object)            "%s" % object.getDescription())
71        self.SetItemImage(object._treeItem, treeIconMap[icon])        self.tree.SetPyData(object._treeItem, object)
72                self.tree.SetItemImage(object._treeItem, treeIconMap[icon])
73          
74    

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

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26