summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2012-12-02 18:00:36 +0200
committerYakov Goldberg <yakov.g@samsung.com>2012-12-03 18:32:27 +0200
commit36d2ea0229cbd666704078316ff89b49da664f00 (patch)
tree5e3abd66d43425fbe6bcfbc4aaec794de293a913
parentb4ddf1a6cefe5af1994a5b9592ed8b2366679450 (diff)
SET_GET, GET_ONLY, SET_ONLY properties (JS)
- If 'set' or 'get' function is found, parameters are checked on direction 'in' for 'set' prop and on 'out' for 'get' prop. If it's wrong, this function will be generated as a method. - JS 'null' can be passed to func instead of string. So internal char* will be assigbed NULL - 'free' added for each 'strdup' string - if func can not be generated because of type casting; it will be generated with printf - Minor fixes, example updated Signed-off-by: Yakov Goldberg <yakov.g@samsung.com>
-rw-r--r--eo_js/elm.h6
-rw-r--r--eoparser/xmlparser.py175
-rw-r--r--examples/evas_elem_test.py1
3 files changed, 135 insertions, 47 deletions
diff --git a/eo_js/elm.h b/eo_js/elm.h
index 25644d7..0dd1507 100644
--- a/eo_js/elm.h
+++ b/eo_js/elm.h
@@ -66,6 +66,12 @@ extern int log_domain;
66#define PROPERTY(name_) \ 66#define PROPERTY(name_) \
67 #name_, Callback_## name_ ##_get, Callback_## name_ ##_set, NULL 67 #name_, Callback_## name_ ##_get, Callback_## name_ ##_set, NULL
68 68
69#define PROPERTY_RO(name_) \
70 #name_, Callback_## name_ ##_get, NULL, NULL
71
72#define PROPERTY_SO(name_) \
73 #name_, NULL, Callback_## name_ ##_set, NULL
74
69#define METHOD(name_) \ 75#define METHOD(name_) \
70 #name_, NULL, NULL, Callback_## name_ 76 #name_, NULL, NULL, Callback_## name_
71 77
diff --git a/eoparser/xmlparser.py b/eoparser/xmlparser.py
index 6cf690c..c46e327 100644
--- a/eoparser/xmlparser.py
+++ b/eoparser/xmlparser.py
@@ -27,9 +27,8 @@ class VAcceptor(object):
27#Class to save data about each function 27#Class to save data about each function
28#This is one item from Mod.functions list 28#This is one item from Mod.functions list
29class Func(VAcceptor): 29class Func(VAcceptor):
30 def __init__(self, _name, _prop_name,_op_id, _c_macro, _parameters, _prop_type, _cl_obj): 30 def __init__(self, _name, _op_id, _c_macro, _parameters, _prop_type, _cl_obj):
31 self.name = _name 31 self.name = _name
32 self.prop_name = _prop_name
33 self.op_id = _op_id 32 self.op_id = _op_id
34 self.c_macro = _c_macro 33 self.c_macro = _c_macro
35 self.parameters = _parameters 34 self.parameters = _parameters
@@ -212,27 +211,27 @@ class JsVisitor(Visitor):
212 self.visit_prop_set_get(_o) 211 self.visit_prop_set_get(_o)
213 prop_name = _o.name[:-4] 212 prop_name = _o.name[:-4]
214 self.c_file.cb_generate_macros.append("EO_GENERATE_PROPERTY_SET_CALLBACK(%s, %s);\n"%(_o.cl_obj.kl_id, prop_name)) 213 self.c_file.cb_generate_macros.append("EO_GENERATE_PROPERTY_SET_CALLBACK(%s, %s);\n"%(_o.cl_obj.kl_id, prop_name))
215 self.c_file.cb_generate_macros.append("EO_GENERATE_PROPERTY_GET_EMPTY_CALLBACK(%s, %s);\n"%(_o.cl_obj.kl_id, prop_name)) 214 #self.c_file.cb_generate_macros.append("EO_GENERATE_PROPERTY_GET_EMPTY_CALLBACK(%s, %s);\n"%(_o.cl_obj.kl_id, prop_name))
216 215
217 self.class_info.public.append(" Handle<Value> %s%s_get() const;\n"%(self.func_name_prefix, prop_name)) 216 #self.class_info.public.append(" Handle<Value> %s%s_get() const;\n"%(self.func_name_prefix, prop_name))
218 self.class_info.public.append(" void %s%s_set(Handle<Value> val);\n"%(self.func_name_prefix, prop_name)) 217 self.class_info.public.append(" void %s%s_set(Handle<Value> val);\n"%(self.func_name_prefix, prop_name))
219 218
220 self.c_file.tmpl.append(" PROPERTY(%s)"% prop_name) 219 self.c_file.tmpl.append(" PROPERTY_SO(%s)"% prop_name)
221 self.h_file.prop_cb_headers.append(" Handle<Value> Callback_%s_get(Local<String>, const AccessorInfo &info);\n"%(prop_name)) 220 #self.h_file.prop_cb_headers.append(" Handle<Value> Callback_%s_get(Local<String>, const AccessorInfo &info);\n"%(prop_name))
222 self.h_file.prop_cb_headers.append(" void Callback_%s_set(Local<String>, Local<Value> val, const AccessorInfo &info);\n"%(prop_name)) 221 self.h_file.prop_cb_headers.append(" void Callback_%s_set(Local<String>, Local<Value> val, const AccessorInfo &info);\n"%(prop_name))
223 222
224 elif _o.prop_type == const.GET_ONLY: 223 elif _o.prop_type == const.GET_ONLY:
225 self.visit_prop_set_get(_o) 224 self.visit_prop_set_get(_o)
226 prop_name = _o.name[:-4] 225 prop_name = _o.name[:-4]
227 self.c_file.cb_generate_macros.append("EO_GENERATE_PROPERTY_GET_CALLBACK(%s, %s);\n"%(_o.cl_obj.kl_id, prop_name)) 226 self.c_file.cb_generate_macros.append("EO_GENERATE_PROPERTY_GET_CALLBACK(%s, %s);\n"%(_o.cl_obj.kl_id, prop_name))
228 self.c_file.cb_generate_macros.append("EO_GENERATE_PROPERTY_SET_EMPTY_CALLBACK(%s, %s);\n"%(_o.cl_obj.kl_id, prop_name)) 227 #self.c_file.cb_generate_macros.append("EO_GENERATE_PROPERTY_SET_EMPTY_CALLBACK(%s, %s);\n"%(_o.cl_obj.kl_id, prop_name))
229 228
230 self.class_info.public.append(" Handle<Value> %s%s_get() const;\n"%(self.func_name_prefix, prop_name)) 229 self.class_info.public.append(" Handle<Value> %s%s_get() const;\n"%(self.func_name_prefix, prop_name))
231 self.class_info.public.append(" void %s%s_set(Handle<Value> val);\n"%(self.func_name_prefix, prop_name)) 230 #self.class_info.public.append(" void %s%s_set(Handle<Value> val);\n"%(self.func_name_prefix, prop_name))
232 231
233 self.c_file.tmpl.append(" PROPERTY(%s)"% prop_name) 232 self.c_file.tmpl.append(" PROPERTY_RO(%s)"% prop_name)
234 self.h_file.prop_cb_headers.append(" Handle<Value> Callback_%s_get(Local<String>, const AccessorInfo &info);\n"%(prop_name)) 233 self.h_file.prop_cb_headers.append(" Handle<Value> Callback_%s_get(Local<String>, const AccessorInfo &info);\n"%(prop_name))
235 self.h_file.prop_cb_headers.append(" void Callback_%s_set(Local<String>, Local<Value> val, const AccessorInfo &info);\n"%(prop_name)) 234 #self.h_file.prop_cb_headers.append(" void Callback_%s_set(Local<String>, Local<Value> val, const AccessorInfo &info);\n"%(prop_name))
236 235
237 elif _o.prop_type == const.METHOD: 236 elif _o.prop_type == const.METHOD:
238 self.visit_method(_o) 237 self.visit_method(_o)
@@ -311,12 +310,12 @@ class JsVisitor(Visitor):
311 direction = "out" if prop_type == "_get" else "in" 310 direction = "out" if prop_type == "_get" else "in"
312 311
313 params_tmp = [] 312 params_tmp = []
314 add_this_func = True 313 add_this_func_with_error = False
315 for i, (n, modifier, c_t, d, p_t) in enumerate(_o.parameters): 314 for i, (n, modifier, c_t, d, p_t) in enumerate(_o.parameters):
316 if d != direction: 315 if d != direction:
317 print "Warning wrong direction: class: \"%s\"; property: \"%s\"; parameter: \"%s\"; direction: \"%s\""%(_o.cl_obj.c_name, prop_name + "_get", n, d) 316 print "Warning wrong direction: class: \"%s\"; property: \"%s\"; parameter: \"%s\"; direction: \"%s\""%(_o.cl_obj.c_name, _o.name, n, d)
318 print "Property \"%s\" will not be defined"%(prop_name + "_get") 317 print "Property \"%s\", from class \"%s\" will be added with message error"%(_o.name, _o.cl_obj.c_name)
319 add_this_func = False 318 add_this_func_with_error = True
320 break 319 break
321 320
322 c_t_tmp = self.cast(p_t) 321 c_t_tmp = self.cast(p_t)
@@ -326,19 +325,23 @@ class JsVisitor(Visitor):
326 if c_t_tmp in self.internal_types: 325 if c_t_tmp in self.internal_types:
327 c_t_internal = self.internal_types[c_t_tmp][0] 326 c_t_internal = self.internal_types[c_t_tmp][0]
328 if len(self.internal_types[c_t_tmp]) < 3: 327 if len(self.internal_types[c_t_tmp]) < 3:
329 add_this_func = False 328 add_this_func_with_error = True
330 break 329 break
331 js_type = self.internal_types[c_t_tmp][2] 330 js_type = self.internal_types[c_t_tmp][2]
332 params_tmp.append((modifier, c_t, n, d, c_t_internal, js_type)) 331 params_tmp.append((modifier, c_t, n, d, c_t_internal, js_type))
333 else: 332 else:
334 print "Warning: type: \"%s\" wasn't found in self.internal_types.\n Function \"%s\", from class \"%s\" will not be defined"%(c_t_tmp, prop_name + "_get", _o.cl_obj.c_name) 333 print "Warning: type: \"%s\" wasn't found in self.internal_types.\n Property \"%s\", from class \"%s\" will be added with error message"%(c_t_tmp, _o.name, _o.cl_obj.c_name)
335 add_this_func = False 334 add_this_func_with_error = True
336 break 335 break
337 336
338 if not add_this_func: 337 if add_this_func_with_error:
339 return 338 if prop_type == "_get":
339 self.prop_get_err_generate(_o, params_tmp)
340 elif prop_type == "_set":
341 self.prop_set_err_generate(_o, params_tmp)
340 342
341 if prop_type == "_get": 343
344 elif prop_type == "_get":
342 self.prop_get_generate(_o, params_tmp) 345 self.prop_get_generate(_o, params_tmp)
343 346
344 elif prop_type == "_set": 347 elif prop_type == "_set":
@@ -375,7 +378,10 @@ class JsVisitor(Visitor):
375 in_param_counter = 0 378 in_param_counter = 0
376 379
377 add_this_func = True 380 add_this_func = True
381 add_end_func = []
382 args_not_used = True
378 for i, (n, modifier, c_t, d, p_t) in enumerate(_o.parameters): 383 for i, (n, modifier, c_t, d, p_t) in enumerate(_o.parameters):
384 args_not_used = False
379 c_t_tmp = self.cast(p_t) 385 c_t_tmp = self.cast(p_t)
380 casting = "(%s %s)"%(modifier, c_t) 386 casting = "(%s %s)"%(modifier, c_t)
381 387
@@ -403,7 +409,9 @@ class JsVisitor(Visitor):
403 self.c_file.functions.append(" %s %s;\n"%(c_t_internal, n)) 409 self.c_file.functions.append(" %s %s;\n"%(c_t_internal, n))
404 410
405 if js_type == "ToString": 411 if js_type == "ToString":
406 self.c_file.functions.append(" %s = strdup(*String::Utf8Value(_%s->%s()));\n"%(n, n, js_type)) 412 self.c_file.functions.append(" %s = strdup(*String::Utf8Value(_%s->%s()));\n"%(n, n, js_type))
413 self.c_file.functions.append(" if (!strcmp(%s, \"null\")) %s = NULL;\n"%(n, n))
414 add_end_func.append(" free(%s);\n"%n)
407 pass_params.append(casting + n) 415 pass_params.append(casting + n)
408 elif js_type == "ToEo": 416 elif js_type == "ToEo":
409 self.c_file.functions.append(" %s = static_cast<CElmObject*>(_%s->ToObject()->GetPointerFromInternalField(0))->GetEo();\n"%(n, n)) 417 self.c_file.functions.append(" %s = static_cast<CElmObject*>(_%s->ToObject()->GetPointerFromInternalField(0))->GetEo();\n"%(n, n))
@@ -423,8 +431,8 @@ class JsVisitor(Visitor):
423 """ 431 """
424 432
425 elif d == "out": 433 elif d == "out":
426 self.c_file.functions.append(" %s %s %s;\n"%(modifier, c_t_internal, n)) 434 self.c_file.functions.append(" %s %s;\n"%(c_t_internal, n))
427 pass_params.append('&' + n) 435 pass_params.append(casting + '&' + n)
428 436
429 js_constr = self.c_to_js_constr[js_type] 437 js_constr = self.c_to_js_constr[js_type]
430 ret_params.append((n, js_type, js_constr)) 438 ret_params.append((n, js_type, js_constr))
@@ -436,6 +444,8 @@ class JsVisitor(Visitor):
436 444
437 if js_type == "ToString": 445 if js_type == "ToString":
438 self.c_file.functions.append(" %s = strdup(*String::Utf8Value(_%s->%s()));\n"%(n, n, js_type)) 446 self.c_file.functions.append(" %s = strdup(*String::Utf8Value(_%s->%s()));\n"%(n, n, js_type))
447 self.c_file.functions.append(" if (!strcmp(%s, \"null\")) %s = NULL;\n"%(n, n))
448 add_end_func.append(" free(%s);\n"%n)
439 elif js_type == "ToEo": 449 elif js_type == "ToEo":
440 self.c_file.functions.append(" %s = static_cast<CElmObject*>(_%s->ToObject()->GetPointerFromInternalField(0))->GetEo();\n"%(n, n)) 450 self.c_file.functions.append(" %s = static_cast<CElmObject*>(_%s->ToObject()->GetPointerFromInternalField(0))->GetEo();\n"%(n, n))
441 else: 451 else:
@@ -448,19 +458,31 @@ class JsVisitor(Visitor):
448 self.c_file.functions.append(" eo_do(eobj, %s(%s));\n"%( _o.c_macro, ", ".join(pass_params))) 458 self.c_file.functions.append(" eo_do(eobj, %s(%s));\n"%( _o.c_macro, ", ".join(pass_params)))
449 459
450 if len(ret_params) == 1: 460 if len(ret_params) == 1:
461 args_not_used = False
451 for par, js_type, js_constr in ret_params: 462 for par, js_type, js_constr in ret_params:
452#FIXME: case then we work with EO 463#FIXME: case then we work with EO
453 if js_type in ["ToEo", "ToVoid"]: 464 if js_type in ["ToEo", "ToVoid"]:
454 self.c_file.functions.append(" return Undefined(); //need to fix case when returning object!\n") 465 self.c_file.functions.append(" return Undefined(); //need to fix case when returning object!\n")
455 else: 466 else:
467 self.c_file.functions += add_end_func
468 add_end_func = []
456 self.c_file.functions.append(" return scope.Close(%s::New(%s));//need to put proper values\n"%(js_constr, par)) 469 self.c_file.functions.append(" return scope.Close(%s::New(%s));//need to put proper values\n"%(js_constr, par))
457 elif len(ret_params) > 1: 470 elif len(ret_params) > 1:
471 args_not_used = False
458 self.c_file.functions.append(" Local<Object> obj__ = Object::New();\n") 472 self.c_file.functions.append(" Local<Object> obj__ = Object::New();\n")
459 for par, js_type, js_constr in ret_params: 473 for par, js_type, js_constr in ret_params:
460 self.c_file.functions.append(" obj__->Set(String::NewSymbol(\"%s\"), %s::New(%s));\n"%(par, js_constr, par)) 474 self.c_file.functions.append(" obj__->Set(String::NewSymbol(\"%s\"), %s::New(%s));\n"%(par, js_constr, par))
475 self.c_file.functions += add_end_func
476 add_end_func = []
461 self.c_file.functions.append(" return scope.Close(obj__); //should be right\n") 477 self.c_file.functions.append(" return scope.Close(obj__); //should be right\n")
462 else: 478 else:
479 self.c_file.functions += add_end_func
480 add_end_func = []
463 self.c_file.functions.append(" return Undefined();\n") 481 self.c_file.functions.append(" return Undefined();\n")
482 #if no return params
483
484 if args_not_used:
485 self.c_file.functions.append(" (void)args;\n")
464 486
465 self.c_file.functions.append("}\n") 487 self.c_file.functions.append("}\n")
466 self.c_file.functions.append("\n") 488 self.c_file.functions.append("\n")
@@ -503,7 +525,6 @@ class JsVisitor(Visitor):
503 525
504 self.c_file.functions.append("}\n\n") 526 self.c_file.functions.append("}\n\n")
505 527
506
507 # is called by prop_set_get_visit, to generate body for property setter 528 # is called by prop_set_get_visit, to generate body for property setter
508 def prop_set_generate(self, _o, params_tmp): 529 def prop_set_generate(self, _o, params_tmp):
509 self.c_file.functions.append("/* generated by 'prop_set_generate() ' */\n") 530 self.c_file.functions.append("/* generated by 'prop_set_generate() ' */\n")
@@ -519,9 +540,11 @@ class JsVisitor(Visitor):
519 for (modifier, c_t, n, d, c_t_internal, js_type) in params_tmp: 540 for (modifier, c_t, n, d, c_t_internal, js_type) in params_tmp:
520 casting = "(%s %s)"%(modifier, c_t) 541 casting = "(%s %s)"%(modifier, c_t)
521 542
522 self.c_file.functions.append(" %s %s %s;\n"%(modifier, c_t_internal, n)) 543 self.c_file.functions.append(" %s %s;\n"%(c_t_internal, n))
523 if js_type == "ToString": 544 if js_type == "ToString":
524 self.c_file.functions.append(" %s = strdup(*String::Utf8Value(__o->Get(String::NewSymbol(\"%s\"))->%s()));\n"%(n, n, js_type)) 545 self.c_file.functions.append(" %s = strdup(*String::Utf8Value(__o->Get(String::NewSymbol(\"%s\"))->%s()));\n"%(n, n, js_type))
546 self.c_file.functions.append(" if (!strcmp(%s, \"null\")) %s = NULL;\n"%(n, n))
547 add_end_func.append(" free(%s);\n"%n)
525 pass_params.append(casting + n) 548 pass_params.append(casting + n)
526 549
527 else: 550 else:
@@ -544,14 +567,15 @@ class JsVisitor(Visitor):
544 if js_type == "ToString": 567 if js_type == "ToString":
545 self.c_file.functions.append(" %s %s;\n"%(c_t_internal, n)) 568 self.c_file.functions.append(" %s %s;\n"%(c_t_internal, n))
546 self.c_file.functions.append(" %s = strdup(*String::Utf8Value(val->%s()));\n"%(n, js_type)) 569 self.c_file.functions.append(" %s = strdup(*String::Utf8Value(val->%s()));\n"%(n, js_type))
547 add_end_func.append(" free(%s);"%n) 570 self.c_file.functions.append(" if (!strcmp(%s, \"null\")) %s = NULL;\n"%(n, n))
571 add_end_func.append(" free(%s);\n"%n)
548 pass_params.append(casting + n) 572 pass_params.append(casting + n)
549 elif js_type == "ToEo": 573 elif js_type == "ToEo":
550 self.c_file.functions.append(" %s %s %s;\n"%(modifier, c_t_internal, n)) 574 self.c_file.functions.append(" %s %s;\n"%(c_t_internal, n))
551 self.c_file.functions.append(" %s = static_cast<CElmObject*>(val->ToObject()->GetPointerFromInternalField(0))->GetEo();\n"%(n)) 575 self.c_file.functions.append(" %s = static_cast<CElmObject*>(val->ToObject()->GetPointerFromInternalField(0))->GetEo();\n"%(n))
552 pass_params.append(casting + n) 576 pass_params.append(casting + n)
553 else: 577 else:
554 self.c_file.functions.append(" %s %s %s;\n"%(modifier, c_t_internal, n)) 578 self.c_file.functions.append(" %s %s;\n"%(c_t_internal, n))
555 self.c_file.functions.append(" %s = val->%s()->Value();\n"%(n, js_type)) 579 self.c_file.functions.append(" %s = val->%s()->Value();\n"%(n, js_type))
556 580
557 if c_t.find("*") != -1: 581 if c_t.find("*") != -1:
@@ -572,6 +596,26 @@ class JsVisitor(Visitor):
572 self.c_file.functions.append("}\n") 596 self.c_file.functions.append("}\n")
573 self.c_file.functions.append("\n") 597 self.c_file.functions.append("\n")
574 598
599 # is called by prop_set_get_visit, to generate body for property getter
600 def prop_get_err_generate(self, _o, params_tmp):
601 self.c_file.functions.append("/* generated by 'prop_get_err_generate() ' */\n")
602 self.c_file.functions.append("Handle<Value> %s::%s%s() const\n"%(_o.cl_obj.kl_id, self.func_name_prefix, _o.name))
603 self.c_file.functions.append("{\n")
604 self.c_file.functions.append(" printf(\"%s : This method wasn't implemented becase of type issue\\n\",__func__);\n")
605
606 self.c_file.functions.append(" return Undefined(); //need to fix case when returning object!\n")
607 self.c_file.functions.append("}\n\n")
608
609 # is called by prop_set_get_visit, to generate body for property setter
610 def prop_set_err_generate(self, _o, params_tmp):
611 self.c_file.functions.append("/* generated by 'prop_set_err_generate() ' */\n")
612 self.c_file.functions.append("void %s::%s%s(Handle<Value> val)\n"%(_o.cl_obj.kl_id, self.func_name_prefix, _o.name))
613 self.c_file.functions.append("{\n")
614 self.c_file.functions.append(" printf(\"%s : This method wasn't implemented becase of type issue\\n\",__func__);")
615 self.c_file.functions.append("}\n")
616 self.c_file.functions.append("\n")
617
618
575 def visit_Init(self, _o): 619 def visit_Init(self, _o):
576 620
577 self.c_file.name = _o.cl_obj.js_cc_file 621 self.c_file.name = _o.cl_obj.js_cc_file
@@ -1258,29 +1302,62 @@ class XMLparser(object):
1258 # Saving function's description as Func object 1302 # Saving function's description as Func object
1259 # Defining if current function can be set/get property, property type is saved in seperate field 1303 # Defining if current function can be set/get property, property type is saved in seperate field
1260 # Properties are relevant only for JS 1304 # Properties are relevant only for JS
1305 func_name_list_not_visited = []
1306 for name in self.functions:
1307 func_name_list_not_visited.append(name)
1308
1261 for i in self.functions: 1309 for i in self.functions:
1262 T = "" 1310 T = ""
1263 prop_name = i
1264 if mod_o.kl_id == "Eo Base": 1311 if mod_o.kl_id == "Eo Base":
1265 T = const.METHOD 1312 T = const.METHOD
1266 mod_o.visitees[i] = Func(i, prop_name, self.functions[i][const.OP_ID], self.functions[i][const.C_MACRO], self.functions[i][const.PARAMETERS], T, mod_o) 1313 mod_o.visitees[i] = Func(i, self.functions[i][const.OP_ID], self.functions[i][const.C_MACRO], self.functions[i][const.PARAMETERS], T, mod_o)
1267 continue 1314 continue
1268 if i[-4:] == "_set": 1315
1269 prop_name = i[:-4] 1316 #check if both properties are in tree; and if they are in,
1270 if i[:-4]+"_get" in self.functions: 1317 # if their parameters are all in or out
1271 T = const.SET_GET 1318 prefix = i[:-4]
1272 else: 1319 postfix = i[-4:]
1273 T = const.SET_ONLY 1320 if postfix in ["_set", "_get"]:
1274 elif i[-4:] == "_get": 1321 if prefix + "_set" in func_name_list_not_visited and prefix + "_get" in func_name_list_not_visited:
1275 prop_name = i[:-4] 1322 T = const.SET_GET
1276 if i[:-4]+"_set" in self.functions: 1323 for (n, m ,t1, d, t2) in self.functions[prefix+"_set"][const.PARAMETERS]:
1277 T = const.SET_GET 1324 if d != "in":
1278 else: 1325 T = const.METHOD
1279 T = const.GET_ONLY 1326
1327 for (n, m ,t1, d, t2) in self.functions[prefix+"_get"][const.PARAMETERS]:
1328 if d != "out":
1329 T = const.METHOD
1330
1331 n = prefix + "_get"
1332 mod_o.visitees[n] = Func(n, self.functions[n][const.OP_ID], self.functions[n][const.C_MACRO], self.functions[n][const.PARAMETERS], T, mod_o)
1333 func_name_list_not_visited.remove(n)
1334
1335 n = prefix + "_set"
1336 mod_o.visitees[n] = Func(n, self.functions[n][const.OP_ID], self.functions[n][const.C_MACRO], self.functions[n][const.PARAMETERS], T, mod_o)
1337 func_name_list_not_visited.remove(n)
1338
1339 elif prefix + "_set" in func_name_list_not_visited:
1340 T = const.SET_ONLY
1341 for (n, m ,t1, d, t2) in self.functions[prefix+"_set"][const.PARAMETERS]:
1342 if d != "in":
1343 T = const.METHOD
1344 n = prefix + "_set"
1345 mod_o.visitees[n] = Func(n, self.functions[n][const.OP_ID], self.functions[n][const.C_MACRO], self.functions[n][const.PARAMETERS], T, mod_o)
1346 func_name_list_not_visited.remove(n)
1347
1348 elif prefix + "_get" in func_name_list_not_visited:
1349 T = const.GET_ONLY
1350 for (n, m ,t1, d, t2) in self.functions[prefix+"_get"][const.PARAMETERS]:
1351 if d != "out":
1352 T = const.METHOD
1353 n = prefix + "_get"
1354 mod_o.visitees[n] = Func(n, self.functions[n][const.OP_ID], self.functions[n][const.C_MACRO], self.functions[n][const.PARAMETERS], T, mod_o)
1355 func_name_list_not_visited.remove(n)
1356
1280 else: 1357 else:
1281 T = const.METHOD 1358 T = const.METHOD
1282 mod_o.visitees[i] = Func(i, prop_name, self.functions[i][const.OP_ID], self.functions[i][const.C_MACRO], self.functions[i][const.PARAMETERS], T, mod_o) 1359 mod_o.visitees[i] = Func(i, self.functions[i][const.OP_ID], self.functions[i][const.C_MACRO], self.functions[i][const.PARAMETERS], T, mod_o)
1283 1360 func_name_list_not_visited.remove(i)
1284 1361
1285 for i in self.ev_ids: 1362 for i in self.ev_ids:
1286 mod_o.visitees[i] = Ev(i, mod_o) 1363 mod_o.visitees[i] = Ev(i, mod_o)
@@ -1569,9 +1646,13 @@ class XMLparser(object):
1569 o.V.c_file.tmpl.append(" METHOD(%s)"%f.name) 1646 o.V.c_file.tmpl.append(" METHOD(%s)"%f.name)
1570 continue 1647 continue
1571 if f.prop_type == const.METHOD: 1648 if f.prop_type == const.METHOD:
1572 o.V.c_file.tmpl.append(" METHOD(%s)"%f.prop_name) 1649 o.V.c_file.tmpl.append(" METHOD(%s)"%f.name)
1573 else: 1650 elif f.prop_type == const.SET_GET:
1574 o.V.c_file.tmpl.append(" PROPERTY(%s)"%f.prop_name) 1651 o.V.c_file.tmpl.append(" PROPERTY(%s)"%f.name[:-4])
1652 elif f.prop_type == const.SET_ONLY:
1653 o.V.c_file.tmpl.append(" PROPERTY_SO(%s)"%f.name[:-4])
1654 elif f.prop_type == const.GET_ONLY:
1655 o.V.c_file.tmpl.append(" PROPERTY_RO(%s)"%f.name[:-4])
1575 elif f.__class__.__name__ == "Ev": 1656 elif f.__class__.__name__ == "Ev":
1576 o.V.c_file.tmpl.append(" PROPERTY(%s)"%f.ev_id.lower()) 1657 o.V.c_file.tmpl.append(" PROPERTY(%s)"%f.ev_id.lower())
1577 1658
diff --git a/examples/evas_elem_test.py b/examples/evas_elem_test.py
index 08e7bd1..022f3e1 100644
--- a/examples/evas_elem_test.py
+++ b/examples/evas_elem_test.py
@@ -31,6 +31,7 @@ box = ElmBox(w1)
31box.evas_obj_size_hint_weight_set(1.0, 1.0) 31box.evas_obj_size_hint_weight_set(1.0, 1.0)
32w1.elm_obj_win_resize_object_add(box) 32w1.elm_obj_win_resize_object_add(box)
33box.evas_obj_visibility_set(1) 33box.evas_obj_visibility_set(1)
34box.elm_wdg_text_part_set(None, "Button")
34 35
35but = ElmButton(w1) 36but = ElmButton(w1)
36#but.text_set("Button") 37#but.text_set("Button")