/[papo]/gnue/designer/src/SchemaViewer.py
ViewVC logotype

Diff of /gnue/designer/src/SchemaViewer.py

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

revision 1.3 by charlie, Tue Aug 27 18:15:52 2002 UTC revision 1.4 by styxman, Fri Nov 8 16:46:03 2002 UTC
# Line 1  Line 1 
1  #  #
 # Copyright 2001 Free Software Foundation  
 #  
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
# Line 18  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
20    #
21  # FILE:  # FILE:
22  # SchemaViewer.py  # SchemaViewer.py
23  #  #
# Line 31  import sys, os, cPickle, traceback, Stri Line 31  import sys, os, cPickle, traceback, Stri
31  from wxPython.wx import *  from wxPython.wx import *
32  from gnue.common import GDebug, GDataSource  from gnue.common import GDebug, GDataSource
33  from gnue.common import RuntimeSettings  from gnue.common import RuntimeSettings
 import Incubator  
34    
35  class SchemaViewer(wxPanel):  class SchemaViewer(wxPanel):
36    def __init__(self, instance, rootObject, parentWindow):    def __init__(self, instance, rootObject, parentWindow):
# Line 54  class SchemaViewer(wxPanel): Line 53  class SchemaViewer(wxPanel):
53               style=wxLC_REPORT|               style=wxLC_REPORT|
54                     wxLC_HRULES|wxLC_VRULES|wxLC_SINGLE_SEL)                     wxLC_HRULES|wxLC_VRULES|wxLC_SINGLE_SEL)
55    
56      self.list.InsertColumn(0,'Name')      self.list.InsertColumn(0,_('Name'))
57      self.list.InsertColumn(1,'Type')      self.list.InsertColumn(1,_('Type'))
58    
59      self.schemaPanel = ChildSchemaViewer(self, self.splitter)      self.schemaPanel = ChildSchemaViewer(self, self.splitter)
60    
# Line 73  class SchemaViewer(wxPanel): Line 72  class SchemaViewer(wxPanel):
72           style=wxRAISED_BORDER|wxCLIP_CHILDREN)           style=wxRAISED_BORDER|wxCLIP_CHILDREN)
73    
74    
75      self.connLabel = wxStaticText(self.combopanel, -1, "Connection: ",      self.connLabel = wxStaticText(self.combopanel, -1, _("Connection: "),
76           pos=wxPoint(4,6))           pos=wxPoint(4,6))
77      self.connCombo = wxComboBox(self.combopanel, -1,      self.connCombo = wxComboBox(self.combopanel, -1,
78           pos=wxPoint(self.connLabel.GetSize().width + 10,4),           pos=wxPoint(self.connLabel.GetSize().width + 10,4),
79  #         size=self.connLabel.GetSize(),  #         size=self.connLabel.GetSize(),
80           style=wxCB_READONLY)           style=wxCB_READONLY)
81      self.typeLabel = wxStaticText(self.combopanel, -1, "Show: ",      self.typeLabel = wxStaticText(self.combopanel, -1, _("Show: "),
82           pos=wxPoint(self.connCombo.GetPosition().x + \           pos=wxPoint(self.connCombo.GetPosition().x + \
83                       self.connCombo.GetSize().width + 20,6))                       self.connCombo.GetSize().width + 20,6))
84      self.typeCombo = wxComboBox(self.combopanel, -1,      self.typeCombo = wxComboBox(self.combopanel, -1,
# Line 312  class ChildSchemaViewer(wxPanel): Line 311  class ChildSchemaViewer(wxPanel):
311      self.list = wxListCtrl(self, -1, pos=wxPoint(0,0),      self.list = wxListCtrl(self, -1, pos=wxPoint(0,0),
312               style=wxLC_REPORT|wxLC_HRULES|wxLC_VRULES)               style=wxLC_REPORT|wxLC_HRULES|wxLC_VRULES)
313    
314      self.list.InsertColumn(SCH_FIELD, 'Field')      self.list.InsertColumn(SCH_FIELD, _('Field'))
315      self.list.InsertColumn(SCH_TYPE,  'Base Type')      self.list.InsertColumn(SCH_TYPE,  _('Base Type'))
316      self.list.InsertColumn(SCH_SIZE,  'Size', wxLIST_FORMAT_RIGHT)      self.list.InsertColumn(SCH_SIZE,  _('Size'), wxLIST_FORMAT_RIGHT)
317      self.list.InsertColumn(SCH_NATIVE,'Native Type')      self.list.InsertColumn(SCH_NATIVE,_('Native Type'))
318      self.list.InsertColumn(SCH_REQ,   'Required')      self.list.InsertColumn(SCH_REQ,   _('Required'))
319    
320      EVT_SIZE(self, self.OnSize)      EVT_SIZE(self, self.OnSize)
321      EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnFieldSelected)      EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnFieldSelected)
# Line 420  class ChildSchemaViewer(wxPanel): Line 419  class ChildSchemaViewer(wxPanel):
419          attributes['max_length'] = object.length          attributes['max_length'] = object.length
420          attributes['width'] = object.length < 30 and object.length or 30          attributes['width'] = object.length < 30 and object.length or 30
421    
422          try:
423            defaulttype = object.defaulttype
424            defaultval = object.defaultval
425          except AttributeError:
426            defaulttype = None
427            defaultval = None
428    
429          if defaulttype == 'constant':
430            if defaultval[:1] in "\"'":
431              defaultval = defaultval[1:-2]
432            attributes['default'] = defaultval
433            defaulttype = None
434            defaultval = None
435    
436    
437        if hasattr(object, 'label') and len(object.label):        if hasattr(object, 'label') and len(object.label):
438          label = object.label          label = object.label
# Line 431  class ChildSchemaViewer(wxPanel): Line 444  class ChildSchemaViewer(wxPanel):
444    
445        data.append( { "Type" : "entry",        data.append( { "Type" : "entry",
446                       "Attributes": attributes,                       "Attributes": attributes,
447                       "Label": label                       "Label": label,
448                         "DefaultTrigger": defaulttype,
449                         "DefaultInfo": defaultval
450                     } )                     } )
451    
452      do = wxCustomDataObject(wxCustomDataFormat("GNUeDesVisualElement"))      do = wxCustomDataObject(wxCustomDataFormat("GNUeDesVisualElement"))

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

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