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'] + ':' |
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, |
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, |
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 |
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 |