commit-gnue
[Top][All Lists]
Advanced

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

gnue/designer/src DataSourceEditor.py Incubator...


From: Jason Cater
Subject: gnue/designer/src DataSourceEditor.py Incubator...
Date: Wed, 16 Jan 2002 14:12:51 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/01/16 14:12:51

Modified files:
        designer/src   : DataSourceEditor.py Incubator.py 
                         LayoutEditor.py 

Log message:
        improved parent block detection for drag and drop schema support

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/DataSourceEditor.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/Incubator.py.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/LayoutEditor.py.diff?tr1=1.32&tr2=1.33&r1=text&r2=text

Patches:
Index: gnue/designer/src/DataSourceEditor.py
diff -c gnue/designer/src/DataSourceEditor.py:1.5 
gnue/designer/src/DataSourceEditor.py:1.6
*** gnue/designer/src/DataSourceEditor.py:1.5   Wed Jan 16 11:15:02 2002
--- gnue/designer/src/DataSourceEditor.py       Wed Jan 16 14:12:51 2002
***************
*** 399,406 ****
      data = { "Type" : "entry",
               "Attributes": {
                 "datasource": self.current.name,
!                "name": "fld%s__%s" % (self.current.name,
!                        string.lower(object.name))
               }
             }
  
--- 399,407 ----
      data = { "Type" : "entry",
               "Attributes": {
                 "datasource": self.current.name,
!                "name": "fld%s%s" % (
!                        string.upper(object.name[0]),
!                        string.lower(object.name[1:]))
               }
             }
  
Index: gnue/designer/src/Incubator.py
diff -c gnue/designer/src/Incubator.py:1.12 gnue/designer/src/Incubator.py:1.13
*** gnue/designer/src/Incubator.py:1.12 Tue Jan 15 14:08:01 2002
--- gnue/designer/src/Incubator.py      Wed Jan 16 14:12:51 2002
***************
*** 37,43 ****
    GDebug.printMesg(3,'Creating a "%s" object' % tag)
    GDebug.printMesg(6,"Object's parent is %s" % parentHint)
  
!   name = instance.getNextGenericName(tag)
  
    try:
      objclass = elements[tag]['BaseClass']
--- 37,46 ----
    GDebug.printMesg(3,'Creating a "%s" object' % tag)
    GDebug.printMesg(6,"Object's parent is %s" % parentHint)
  
!   try:
!     name = attributes['name']
!   except KeyError:
!     name = instance.getNextGenericName(tag)
  
    try:
      objclass = elements[tag]['BaseClass']
***************
*** 91,96 ****
--- 94,100 ----
    o._buildObject()
    instance.onCreateObject(o, __name__)
    instance.onSetCurrentObject(o, __name__)
+   return o
  
  
  def reparentObject(instance, form, object, newParent):
Index: gnue/designer/src/LayoutEditor.py
diff -c gnue/designer/src/LayoutEditor.py:1.32 
gnue/designer/src/LayoutEditor.py:1.33
*** gnue/designer/src/LayoutEditor.py:1.32      Tue Jan 15 18:12:56 2002
--- gnue/designer/src/LayoutEditor.py   Wed Jan 16 14:12:51 2002
***************
*** 868,879 ****
        attributes['x'] = x
        attributes['y'] = y
  
!       # TODO: Apply to a block!!!
  
!       Incubator.createObject(self.editor._instance,
!          self.editor._instance.rootObject,
!          params['Type'], parent=self.editor.page,
!          attributes=attributes)
  
      return d  # what is returned signals the source what to do
                # with the original data (move, copy, etc.)  In this
--- 868,920 ----
        attributes['x'] = x
        attributes['y'] = y
  
!       # Entry types require a "block".. find or create one
!       if params['Type'] in ('entry',):
!         try:
!           parent = params['Block']
!         except KeyError:
!           # Find the parent block
  
!           parent = None
!           datasource = string.lower(attributes['datasource'])
! 
!           for child in self.editor.page._children:
!             if child._type == 'GFBlock' and \
!               string.lower(child.datasource) == datasource:
!               parent = child
!               break
! 
!           if parent is None:
!             dlg = wxMessageDialog(NULL,
!               "The current page does not have a block\n"
!               "corresponding to Data Source %s.\n"
!               "Create a new block on the current page?" % \
!                    attributes['datasource'],
!               "No Target Block Found", style=wxYES_NO|wxICON_WARNING)
!             save = dlg.ShowModal()
!             dlg.Destroy()
!             if save == wxID_NO:
!               return d # TODO: This should actually return a failure
! 
!             # Create a parent block
!             parent = Incubator.createObject(
!                         self.editor._instance,
!                         self.editor._instance.rootObject,
!                         'block',
!                         parent=self.editor.page,
!                         attributes={'datasource':datasource})
!       else:
!         parent = self.editor.page
! 
!       #
!       # Create our new object
!       #
!       Incubator.createObject(
!               self.editor._instance,
!               self.editor._instance.rootObject,
!               params['Type'],
!               parent=parent,
!               attributes=attributes)
  
      return d  # what is returned signals the source what to do
                # with the original data (move, copy, etc.)  In this



reply via email to

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