commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue common/etc/sample.gnue.conf designer/src/D...


From: Jason Cater
Subject: gnue common/etc/sample.gnue.conf designer/src/D...
Date: Wed, 16 Jan 2002 19:10:48 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/01/16 19:10:48

Modified files:
        common/etc     : sample.gnue.conf 
        designer/src   : DataSourceEditor.py LayoutEditor.py 

Log message:
        added label-autocreation support to drag and drop entries

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/etc/sample.gnue.conf.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/DataSourceEditor.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/LayoutEditor.py.diff?tr1=1.33&tr2=1.34&r1=text&r2=text

Patches:
Index: gnue/common/etc/sample.gnue.conf
diff -c gnue/common/etc/sample.gnue.conf:1.13 
gnue/common/etc/sample.gnue.conf:1.14
*** gnue/common/etc/sample.gnue.conf:1.13       Tue Jan 15 18:13:05 2002
--- gnue/common/etc/sample.gnue.conf    Wed Jan 16 19:10:48 2002
***************
*** 116,123 ****
  # Automatically log in to needed connections to do schema
  AutoConnect = 0
  
! # Use syntax highlighting
  ColorizeCode = 0
  
  
  [navigator]
--- 116,131 ----
  # Automatically log in to needed connections to do schema
  AutoConnect = 0
  
! # Use syntax highlighting in the trigger editor
  ColorizeCode = 0
+ 
+ # When auto-creating entries using drag-and-drop, 
+ # create labels?  
+ #    no = Do not create labels
+ #    left = Create labels to the left of the widget
+ #    above = Create labels above the widget
+ #
+ CreateLabelsOnDrop = left
  
  
  [navigator]
Index: gnue/designer/src/DataSourceEditor.py
diff -c gnue/designer/src/DataSourceEditor.py:1.9 
gnue/designer/src/DataSourceEditor.py:1.10
*** gnue/designer/src/DataSourceEditor.py:1.9   Wed Jan 16 17:19:46 2002
--- gnue/designer/src/DataSourceEditor.py       Wed Jan 16 19:10:48 2002
***************
*** 74,79 ****
--- 74,80 ----
  
      instance.rootObject.walk (self.initialInventory)
      instance.rootObject.walk (self.inventoryObject)
+     self.fillList()
  
      EVT_LIST_ITEM_SELECTED(self, self.list.GetId(), self.OnDSSelected)
      self.onSetCurrentObject(self.current, "")
***************
*** 83,88 ****
--- 84,119 ----
      RuntimeSettings.registerRuntimeSettingHandler(self.instance, self)
  
  
+ 
+   def fillList(self):
+ 
+     self.list.DeleteAllItems()
+ 
+     for datasource in self.datasources:
+       if not datasource.__master:
+         self._fillList(datasource, 0)
+ 
+ 
+   def _fillList(self, object, indent):
+ 
+     print "Adding %s" % object.name
+ 
+     index = self.list.GetItemCount()
+     self.list.InsertStringItem(index, " * " * indent + object.name)
+     self.list.SetStringItem(index, 1,
+        hasattr(object,'table') and object.table or '')
+     self.list.SetStringItem(index, 2,
+        hasattr(object,'database') and object.database or '')
+     self.list.SetItemData(index, id(object))
+ 
+     object.__listIndex = index
+ 
+     for detail in object._datasourceReferences:
+       self._fillList(detail, indent + 1)
+ 
+ 
+ 
+ 
    def initialInventory(self, object):
      if isinstance(object, GDataSource.GDataSource):
        self.datasourceMap[string.lower(object.name)] = object
***************
*** 107,124 ****
        else:
          object.__master = None
  
-       # TODO: Implement sorting?
-       index = self.list.GetItemCount()
-       self.list.InsertStringItem(index, object.name)
-       self.list.SetStringItem(index, 1,
-              hasattr(object,'table') and object.table or '')
-       self.list.SetStringItem(index, 2,
-              hasattr(object,'database') and object.database or '')
-       self.list.SetItemData(index, id(object))
- 
- 
-       object.__listIndex = index
- 
      #
      # Create a cross-reference list of objects referring to datasources
      # These are used by the ReferencesViewer
--- 138,143 ----
***************
*** 187,192 ****
--- 206,214 ----
        self.initialInventory(object)
        self.inventoryObject(object)
  
+     if isinstance(object, GDatasource.GDatasource):
+       self.fillList()
+ 
  
    def onModifyObject (self, object, handler, modifications):
      if object == None:
***************
*** 196,210 ****
  
        if isinstance(object, GDataSource.GDataSource):
          # TODO: Maintain self.datasourceMap
  
! 
!         index = object.__listIndex
!         self.list.SetStringItem(index, 0, object.name)
!         self.list.SetStringItem(index, 1,
!              hasattr(object,'table') and object.table or '')
!         self.list.SetStringItem(index, 2,
!              hasattr(object,'database') and object.database or '')
!         self.list.SetItemData(index, id(object))
  
  
    def onDeleteObject (self, object, handler):
--- 218,228 ----
  
        if isinstance(object, GDataSource.GDataSource):
          # TODO: Maintain self.datasourceMap
+         self.fillList()
  
!       # Dirty way to rebuild all our lists
!       if object == self.current:
!         self.onSetCurrentObject(object, __name__)
  
  
    def onDeleteObject (self, object, handler):
***************
*** 580,588 ****
      object = self.schemaMap[self.list.HitTest(event.GetPoint())[0]]
      attributes = {
          "datasource": self.current.name,
!         "name": "fld%s%s" % (
!                        string.upper(object.name[0]),
!                        string.lower(object.name[1:])),
          "field": object.name,
          "datatype": object.datatype,
          "required" : object.required,
--- 598,606 ----
      object = self.schemaMap[self.list.HitTest(event.GetPoint())[0]]
      attributes = {
          "datasource": self.current.name,
!         "name": "fld%s" % (
!                    string.join(string.split(string.capwords( \
!                    string.replace(object.name,'_',' '))),'')),
          "field": object.name,
          "datatype": object.datatype,
          "required" : object.required,
***************
*** 592,599 ****
        attributes['max_length'] = object.length
        attributes['width'] = object.length < 30 and object.length or 30
  
      data = { "Type" : "entry",
!              "Attributes": attributes
             }
  
      do = wxCustomDataObject(wxCustomDataFormat("GNUeDesVisualElement"))
--- 610,627 ----
        attributes['max_length'] = object.length
        attributes['width'] = object.length < 30 and object.length or 30
  
+ 
+     if hasattr(object, 'label') and len(object.label):
+       label = object.label
+     elif len(object.name) == 1:
+       label = string.upper(object.name)
+     else:
+       label = string.join(string.split(string.capwords( \
+                    string.replace(object.name,'_',' '))),' ')
+ 
      data = { "Type" : "entry",
!              "Attributes": attributes,
!              "Label": label
             }
  
      do = wxCustomDataObject(wxCustomDataFormat("GNUeDesVisualElement"))
Index: gnue/designer/src/LayoutEditor.py
diff -c gnue/designer/src/LayoutEditor.py:1.33 
gnue/designer/src/LayoutEditor.py:1.34
*** gnue/designer/src/LayoutEditor.py:1.33      Wed Jan 16 14:12:51 2002
--- gnue/designer/src/LayoutEditor.py   Wed Jan 16 19:10:48 2002
***************
*** 740,746 ****
      else: 
        self.wEditor.SetValue(0)
  
!   def OnHeightUpdated(self, event): 
      if hasattr(self.object, 'height'):
        dh = self.hEditor.GetValue() - self.object.height
        if dh: 
--- 740,746 ----
      else: 
        self.wEditor.SetValue(0)
  
!   def OnHeightUpdated(self, event):
      if hasattr(self.object, 'height'):
        dh = self.hEditor.GetValue() - self.object.height
        if dh: 
***************
*** 770,776 ****
      if hasattr(object, 'width'): 
        self.wEditor.SetValue(object.width)
  #      self.wEditor.SetEditable(1)
!     else: 
        self.wEditor.SetValue(0)
  #      self.wEditor.SetEditable(0)
  
--- 770,776 ----
      if hasattr(object, 'width'): 
        self.wEditor.SetValue(object.width)
  #      self.wEditor.SetEditable(1)
!     else:
        self.wEditor.SetValue(0)
  #      self.wEditor.SetEditable(0)
  
***************
*** 865,872 ****
        y = int(y / self.editor.gridHeight)
  
        attributes = params['Attributes']
-       attributes['x'] = x
-       attributes['y'] = y
  
        # Entry types require a "block".. find or create one
        if params['Type'] in ('entry',):
--- 865,870 ----
***************
*** 903,910 ****
--- 901,946 ----
                          'block',
                          parent=self.editor.page,
                          attributes={'datasource':datasource})
+ 
+         createLabels = string.lower(GConfig.get("CreateLabelsOnDrop","left"))
+ 
+         if createLabels != "no":
+           label = params["Label"] + ":"
+ 
+           # Figure out the position of the label
+           # If the entry is for a multirow block,
+           # we assume that the label goes above.
+           if createLabels == "left" and not parent.rows > 1:
+             lx = x - len(label) - 1
+             if lx < 0:
+               x = len(label) + 1
+               lx = 0
+             ly = y
+           else:  # "above"
+             lx = x
+             ly = y - 1
+ 
+             if ly < 0:
+               ly = 0
+               y += 1
+ 
+           # Create a label
+           Incubator.createObject(
+                   self.editor._instance,
+                   self.editor._instance.rootObject,
+                   'label',
+                   parent=self.editor.page,
+                   attributes={'x': lx,
+                               'y': ly,
+                               'width': len(label),
+                               'text': label })
+ 
        else:
          parent = self.editor.page
+ 
+ 
+       attributes['x'] = x
+       attributes['y'] = y
  
        #
        # Create our new object



reply via email to

[Prev in Thread] Current Thread [Next in Thread]