[core/widget] Use __ for private variables

This commit is contained in:
tobi-wan-kenobi 2020-04-04 13:58:22 +02:00
parent 7547537c81
commit 89247d834b

View file

@ -5,33 +5,33 @@ import util.store
class Widget(util.store.Store, core.input.Object): class Widget(util.store.Store, core.input.Object):
def __init__(self, full_text='', name=None, module=None): def __init__(self, full_text='', name=None, module=None):
super(Widget, self).__init__() super(Widget, self).__init__()
self._full_text = full_text self.__full_text = full_text
self._module = module self.__module = module
self._name = name self.__name = name
def name(self): def name(self):
return self._name return self.__name
def full_text(self, value=None): def full_text(self, value=None):
if value: if value:
self._full_text = value self.__full_text = value
else: else:
if callable(self._full_text): if callable(self.__full_text):
return self._full_text(self) return self.__full_text(self)
return self._full_text return self.__full_text
def module(self, module=None): def module(self, module=None):
if not module: if not module:
return self._module return self.__module
self._module = module self.__module = module
def state(self): def state(self):
rv = [] rv = []
if self.get('state', None): if self.get('state', None):
tmp = self.get('state') tmp = self.get('state')
rv = tmp[:] if isinstance(tmp, list) else [tmp] rv = tmp[:] if isinstance(tmp, list) else [tmp]
if self._module: if self.__module:
tmp = self._module.state(self) tmp = self.__module.state(self)
rv.extend(tmp if isinstance(tmp, list) else [tmp]) rv.extend(tmp if isinstance(tmp, list) else [tmp])
return rv return rv