genlib/record: support passing params in same object

This commit is contained in:
Sebastien Bourdeauducq 2013-10-21 22:05:28 +02:00
parent 4fb3e970b1
commit 018afe57ef
1 changed files with 12 additions and 2 deletions

View File

@ -56,9 +56,19 @@ def layout_partial(layout, *elements):
insert_ref.append(layout_get(copy_ref, last)) insert_ref.append(layout_get(copy_ref, last))
return r return r
class LayoutP:
def __init__(self, layout, **layout_dict):
self.layout = layout
self.layout_dict = layout_dict
class Record: class Record:
def __init__(self, layout, name=None, **layout_dict): def __init__(self, layout, name=None, **layout_dict):
self.name = get_obj_var_name(name, "") self.name = get_obj_var_name(name, "")
if isinstance(layout, LayoutP):
self.layout = layout.layout
self.layout_dict = layout.layout_dict
assert(not layout_dict)
else:
self.layout = layout self.layout = layout
self.layout_dict = layout_dict self.layout_dict = layout_dict