Added support for Flip, Genlist, Gengrid and Toolbar

This commit is contained in:
Davide Andreoli 2015-02-01 16:08:20 +01:00
parent 3c76ede01e
commit c737915efd
2 changed files with 174 additions and 11 deletions

View File

@ -54,7 +54,6 @@ except NameError:
KLASSES = {
'Elm_Actionslider': ('efl.elementary.actionslider', 'Actionslider'),
'Elm_Bg': ('efl.elementary.background', 'Background'),
'Elm_Box': ('efl.elementary.box', 'Box'),
@ -62,6 +61,9 @@ KLASSES = {
'Elm_Clock': ('efl.elementary.clock', 'Clock'),
'Elm_Check': ('efl.elementary.check', 'Check'),
'Elm_Entry': ('efl.elementary.entry', 'Entry'),
'Elm_Flip': ('efl.elementary.flip', 'Flip'),
'Elm_Genlist': ('efl.elementary.genlist', 'Genlist'),
'Elm_Gengrid': ('efl.elementary.gengrid', 'Gengrid'),
'Elm_Icon': ('efl.elementary.icon', 'Icon'),
'Elm_Image': ('efl.elementary.image', 'Image'),
'Elm_Label': ('efl.elementary.label', 'Label'),
@ -69,6 +71,7 @@ KLASSES = {
'Elm_Menu': ('efl.elementary.menu', 'Menu'),
'Elm_Radio': ('efl.elementary.radio', 'Radio'),
'Elm_Table': ('efl.elementary.table', 'Table'),
'Elm_Toolbar': ('efl.elementary.toolbar', 'Toolbar'),
'Elm_Win': ('efl.elementary.window', 'Window'),
}
@ -185,6 +188,11 @@ def _widget_generate(self, name, parent_name=None):
child = _widget_generate(self, c_name)
w.pack(child, x, y, cspan, rspan)
elif eo_klass_name == 'Elm_Flip':
for c_name, (swallow,) in w_data.get('Contains', {}).items():
child = _widget_generate(self, c_name)
w.part_content_set(swallow, child)
# callbacks
if 'Callbacks' in w_data:
@ -216,12 +224,14 @@ def _widget_generate(self, name, parent_name=None):
def _item_generate(self, parent_widget, parent_item, item_name, item_data):
self._print("Generating ITEM: %s" % item_name)
it = parent_widget.item_add(parent_item,
item_data['label'], # use kargs instead ?
item_data['icon'])
# print(item_data)
# TODO make the item accessible with his name from the base class ???
if parent_widget.__class__.__name__ == 'Toolbar':
it = parent_widget.item_append(item_data['icon'], item_data['label'])
elif parent_widget.__class__.__name__ == 'Menu':
it = parent_widget.item_add(parent_item, item_data['label'],
item_data['icon'])
if 'Items' in item_data:
for item_name, item_data in item_data['Items'].items():
_item_generate(self, parent_widget, it, item_name, item_data)

View File

@ -167,10 +167,11 @@
"elm_button5":[1, 1, 1, 1],
"elm_button6":[0, 2, 1, 1],
"elm_button8":[1, 2, 1, 1],
"elm_button9":[0, 3, 2, 1],
"elm_image1":[0, 4, 1, 2],
"elm_button10":[1, 4, 1, 1],
"elm_button11":[1, 5, 1, 1]
"elm_button9":[0, 4, 2, 1],
"elm_image1":[0, 6, 1, 2],
"elm_button10":[1, 6, 1, 1],
"elm_button11":[1, 7, 1, 1],
"elm_button12":[0, 5, 2, 1]
}
},
"elm_button2":
@ -653,6 +654,158 @@
"Elm_Entry.scrollable":[true],
"Elm_Widget.part_text":["guide", "Editable entry"]
}
},
"elm_button12":
{
"Desc":
{
"parent":"elm_table1",
"class":"Elm_Button"
},
"Properties":
{
"Evas.Object.size_hint_weight":[1, 1],
"Evas.Object.visibility":[true],
"Evas.Object.size_hint_align":[-1, 0.50],
"Elm_Widget.part_text":[null, "Test more widgets..."]
},
"Callbacks":
{
"clicked":["Create", "elm_win4", null]
}
},
"elm_win4":
{
"Desc":
{
"parent":null,
"class":"Elm_Win"
},
"Properties":
{
"Elm_Win.constructor":[null, "ELM_WIN_BASIC"],
"Elm_Win.title":["elm_win4"],
"Evas.Object.size_hint_weight":[1, 1],
"Evas.Object.visibility":[true],
"Elm_Win.autodel":[true],
"Evas.Object.size":[245, 336]
},
"Contains":["elm_bg4", "elm_box3"]
},
"elm_win4_main_menu":
{
"Desc":
{
"parent":"elm_win4",
"class":"Elm_Menu"
}
},
"elm_box3":
{
"Desc":
{
"parent":"elm_win4",
"class":"Elm_Box"
},
"Properties":
{
"Evas.Object.size_hint_weight":[1, 1],
"Evas.Object.visibility":[true],
"Evas.Object.size_hint_align":[-1, -1],
"Evas.Object.position":[97, 42]
},
"Contains":["elm_toolbar1", "elm_flip1"]
},
"elm_toolbar1":
{
"Desc":
{
"parent":"elm_box3",
"class":"Elm_Toolbar"
},
"Properties":
{
"Evas.Object.visibility":[true],
"Evas.Object.size_hint_align":[-1, 0],
"Elm_Toolbar.shrink_mode":["ELM_TOOLBAR_SHRINK_MENU"],
"Evas.Object.size_hint_weight":[1, 0]
},
"Items":
{
"elm_toolbar1_it0":
{
"type":"regular",
"icon":"home",
"label":"Genlist",
"callback":null
},
"elm_toolbar1_it1":
{
"type":"regular",
"icon":"clock",
"label":"Gengrid",
"callback":null
}
}
},
"elm_bg4":
{
"Desc":
{
"parent":"elm_win4",
"class":"Elm_Bg"
},
"Properties":
{
"Evas.Object.size_hint_weight":[1, 1],
"Evas.Object.visibility":[true],
"Evas.Object.position":[129, -8]
}
},
"elm_flip1":
{
"Desc":
{
"parent":"elm_box3",
"class":"Elm_Flip"
},
"Properties":
{
"Evas.Object.size_hint_weight":[1, 1],
"Evas.Object.visibility":[true],
"Evas.Object.size_hint_align":[-1, -1]
},
"Contains":
{
"elm_genlist1":["front"],
"elm_gengrid1":["back"]
}
},
"elm_genlist1":
{
"Desc":
{
"parent":"elm_flip1",
"class":"Elm_Genlist"
},
"Properties":
{
"Evas.Object.size_hint_weight":[1, 1],
"Evas.Object.visibility":[true]
}
},
"elm_gengrid1":
{
"Desc":
{
"parent":"elm_flip1",
"class":"Elm_Gengrid"
},
"Properties":
{
"Evas.Object.size_hint_weight":[1, 1],
"Evas.Object.visibility":[true]
}
}
}
}