# coding: utf-8
import ui
class doesnotcallsuperinit(ui.View):
def __init__(self,*args,**kwargs):
pass
class hasnoinit(ui.View):
def somotherfunc(self):
pass
class callssuperinit(ui.View):
def __init__(self,*args,**kwargs):
ui.View.__init__(self,*args,**kwargs)
def test_class(cls):
obj=cls(bg_color='red')
print '{} kwargs were {} properly initted'.format(cls.__name__,
'NOT'*(not obj.bg_color==(1,0,0,1)))
test_class(doesnotcallsuperinit)
test_class(hasnoinit)
test_class(callssuperinit)
'''
doesnotcallsuperinit kwargs were NOT properly initted
hasnoinit kwargs were properly initted
callssuperinit kwargs were properly initted
'''
No need to call ui.View.init if you don't provide your own. If you do, you must call it.
In your case, you are really just better off handling them yourself, since not all attributes are settable in the constructor, and different components don't behave the way they are supposed to ( for example, TableView did not respond to flex in the constructor, at least in the last beta, Buttons and Labels i think behave differently if setting the title in the constructor vs after, i.e it autoresizes or not). Write a function that sets attributes then forget about it.