[core/widget] allow to override widget IDs
to uniquely identify a widget, allow the user to specify an ID on the CLI TODO: document this
This commit is contained in:
parent
8e71201030
commit
972ada0697
1 changed files with 15 additions and 0 deletions
|
@ -11,6 +11,21 @@ class Widget(util.store.Store, core.input.Object):
|
||||||
self.module = module
|
self.module = module
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def module(self):
|
||||||
|
return self.__module
|
||||||
|
|
||||||
|
@module.setter
|
||||||
|
def module(self, module):
|
||||||
|
self.__module = module
|
||||||
|
|
||||||
|
if self.index() < 0: return
|
||||||
|
|
||||||
|
if module:
|
||||||
|
custom_ids = util.format.aslist(module.parameter('id'))
|
||||||
|
if len(custom_ids) > self.index():
|
||||||
|
self.id = custom_ids[self.index()]
|
||||||
|
|
||||||
def index(self):
|
def index(self):
|
||||||
if not self.module: return 0
|
if not self.module: return 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue