/[papo]/gnue/designer/src/schema/Instance.py
ViewVC logotype

Diff of /gnue/designer/src/schema/Instance.py

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

revision 1.4 by styxman, Fri Nov 8 16:46:03 2002 UTC revision 1.4.4.1 by anthonyl, Tue Mar 4 22:11:41 2003 UTC
# Line 16  Line 16 
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/Instance.py  # schema/Instance.py
# Line 28  Line 28 
28  #  #
29    
30  from gnue.designer.schema import properties as schemaProperties  from gnue.designer.schema import properties as schemaProperties
31  from gnue.designer.Instance import BaseInstance  from gnue.designer.base.Instance import BaseInstance
32  from gnue.common.schema import GSParser, Objects  from gnue.common.schema import GSParser, Objects
33  import Incubator  from Incubator import Incubator
34  import wizards  import wizards
35    
36  # Tool support...  # Tool support...
37  from LayoutEditor import LayoutEditor  from LayoutEditor import LayoutEditor
38  from TreeView import TreeView  from TreeView import TreeView
39  from gnue.designer.PropertyEditor import PropertyEditor  from TableEditor import TableEditor
40  from gnue.designer.DataSourceEditor import DataSourceEditor  from gnue.designer.base.tools.PropertyEditor import PropertyEditor
41  from gnue.designer.SchemaViewer import SchemaViewer  from gnue.designer.base.tools.DataSourceEditor import DataSourceEditor
42  from gnue.designer.schema.VisualEditor import VisualEditor  from gnue.designer.base.tools.SchemaViewer import SchemaViewer
43    from gnue.designer.schema.DiaEditor.VisualEditor import VisualEditor
44    
45    
46    
47  class Instance(BaseInstance):  class Instance(BaseInstance):
48    
49    def __init__(self, app, *args, **params):    def __init__(self, app, *args, **params):
50      self.incubator = Incubator      self.incubator = Incubator(self)
51      self.properties = schemaProperties      self.properties = schemaProperties
52        
53      self._tableMappings = {}      self._tableMappings = {}
54      BaseInstance.__init__(self, app, *args, **params)      BaseInstance.__init__(self, app, *args, **params)
55    
56    
57    def loadBuffer(self, buffer):    def loadBuffer(self, buffer):
58      schema = GSParser.loadSchema (buffer, self, initialize=0)      schema = GSParser.loadFile (buffer, self, initialize=0)
59      schema.name = 'schema'      schema.name = 'schema'
60      return schema      return schema
61    
62    
63    def loadEmpty(self):    def loadEmpty(self, style=None):
64      schema = Objects.GSSchema()      schema = Objects.GSSchema()
65      schema.title = "Untitled schema"      schema.title = "Untitled schema"
66      schema.name = 'schema'      schema.name = 'schema'
# Line 69  class Instance(BaseInstance): Line 70  class Instance(BaseInstance):
70    def inventoryObject(self, object):    def inventoryObject(self, object):
71      if isinstance(object, Objects.GSTables):      if isinstance(object, Objects.GSTables):
72        self.tables = object        self.tables = object
73        elif object._type == 'GSTable':
     if isinstance(object, Objects.GSTable):  
74        self._tableMappings[object.name] = object        self._tableMappings[object.name] = object
75          object._fieldList = []
76          object._fieldMap = {}
77    def createVisualEditor(self):      elif object._type == 'GSField':
78      return LayoutEditor(self, self)        table = object.findParentOfType('GSTable')
79          table._fieldList.append(object)
80          table._fieldMap[object.name.lower()] = object
81    
82    def createTools(self):    def createTools(self):
83      self.addTool(_('treeEditor'), _('Object Navigator'), TreeView)      self.addTool(_('treeEditor'), _('Object Navigator'), TreeView)
84      self.addTool(_('propertyEditor'), _('Property Inspector'), PropertyEditor)      self.addTool(_('propertyEditor'), _('Property Inspector'), PropertyEditor)
85      self.addTool(_('schemaViewer'), _('Schema Navigator'), SchemaViewer)      self.addTool(_('schemaViewer'), _('Schema Navigator'), SchemaViewer)
86        self.addTool(_('tableEditor'), _('Table/Field Editor'), TableEditor)
87      self.addTool(_('visualEditor'), _('Visual Editor'), VisualEditor)      self.addTool(_('visualEditor'), _('Visual Editor'), VisualEditor)
     self.loadWizards(wizards)  
88    
89      def createWizards(self):
90        self.loadWizards(wizards)
91    
92    def preSave(self):    def preSave(self):
93      pass      pass
94    
95    # Hack having to do with UIwxpython import    # Used by TemplateParser to build a wizard.current dict
96    def uiEventTrap(self, event):    def buildWizardCurrentDict(self):
97      pass      return {'schema': self.rootObject,
98    ##            'tables': self.rootObject._tables,
99                'table': self.tableEditor.table,
100    ##            'field': self.visualEditor.page,
101                'object': self._currentObject}
102    
103    
104    ##  # Hack having to do with UIwxpython import
105    ##  def uiEventTrap(self, event):
106    ##    pass
107    
108    
109    

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

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