/[gnue]/gnue-designer/src/forms/LayoutEditor/DisplayDropTarget.py
ViewVC logotype

Diff of /gnue-designer/src/forms/LayoutEditor/DisplayDropTarget.py

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

revision 1.19 by jcater, Wed Jun 4 23:24:12 2003 UTC revision 1.20 by jcater, Thu Jul 10 22:56:21 2003 UTC
# Line 328  class DisplayDropTarget(wxPyDropTarget): Line 328  class DisplayDropTarget(wxPyDropTarget):
328      maxWidth = x      maxWidth = x
329      page = self.editor.page      page = self.editor.page
330      instance = self.editor.instance      instance = self.editor.instance
331        selection = []
332      for f in fields:      for f in fields:
333        try:        try:
334          label=f['label'] + ':'          label=f['label'] + ':'
# Line 391  class DisplayDropTarget(wxPyDropTarget): Line 392  class DisplayDropTarget(wxPyDropTarget):
392    
393    
394        # Create the labels        # Create the labels
395        instance.incubator.createObject(        selection.append(instance.incubator.createObject(
396                  instance.rootObject,                  instance.rootObject,
397                  'label',                  'label',
398                  page,                  page,
# Line 400  class DisplayDropTarget(wxPyDropTarget): Line 401  class DisplayDropTarget(wxPyDropTarget):
401                              'Char:x': x,                              'Char:x': x,
402                              'Char:y': y,                              'Char:y': y,
403                              'Char:width': len(label)},                              'Char:width': len(label)},
404                  select=0)                  select=0))
405    
406        # Create the entry        # Create the entry
407        instance.incubator.createObject(        selection.append(instance.incubator.createObject(
408                  instance.rootObject,                  instance.rootObject,
409                  'entry',                  'entry',
410                  page,                  page,
# Line 413  class DisplayDropTarget(wxPyDropTarget): Line 414  class DisplayDropTarget(wxPyDropTarget):
414                              'Char:x': x + len(label) + 1,                              'Char:x': x + len(label) + 1,
415                              'Char:y': y,                              'Char:y': y,
416                              'Char:width': width},                              'Char:width': width},
417                  select=0)                  select=0))
418    
419        maxWidth = max(maxWidth, x + len(label) + width + 2)        maxWidth = max(maxWidth, x + len(label) + width + 2)
420        y += 1        y += 1
# Line 421  class DisplayDropTarget(wxPyDropTarget): Line 422  class DisplayDropTarget(wxPyDropTarget):
422      # Adjust form height if necessary      # Adjust form height if necessary
423      if y > instance.rootObject._layout.Char__height or \      if y > instance.rootObject._layout.Char__height or \
424         maxWidth > instance.rootObject._layout.Char__width:         maxWidth > instance.rootObject._layout.Char__width:
425    
426          old = {}
427          new = {}
428    
429          if y > instance.rootObject._layout.Char__height:
430            old['Char:height'] = instance.rootObject._layout.Char__height
431            new['Char:height'] = y
432            instance.rootObject._layout.Char__height = y
433    
434          if maxWidth > instance.rootObject._layout.Char__width:
435            old['Char:width'] = instance.rootObject._layout.Char__width
436            new['Char:width'] = maxWidth
437            instance.rootObject._layout.Char__width = maxWidth
438    
439        instance.dispatchEvent('ObjectModified',        instance.dispatchEvent('ObjectModified',
440               object=instance.rootObject._layout,               object=instance.rootObject._layout,
441               old={'Char:height': instance.rootObject._layout.Char__height,               old=old,
442                    'Char:width': instance.rootObject._layout.Char__width},               new=new,
              new={'Char:height': y,  
                   'Char:width': maxWidth},  
443               originator=__name__)               originator=__name__)
444    
445      # Select the new block      # Select the new block
446      instance.dispatchEvent('ObjectSelected', object=block, originator=__name__)      if selection:
447          o = selection[0]
448        else:
449          o = block
450    
451        instance.dispatchEvent('ObjectSelected', object=o,
452                               originator=__name__,
453                               selection=selection)
454    
455        # Move the focus onto our grid panel
456        self.editor.panel.SetFocus()
457    
458    #    #
459    # User requested we create a new block and add fields    # User requested we create a new block and add fields

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

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