Parent is now mandatory when creating a new BaseInstance class
This commit is contained in:
@@ -77,12 +77,12 @@ class Commands(BaseCommands):
|
||||
class TabsManager(MultipleInstance):
|
||||
_tab_count = 0
|
||||
|
||||
def __init__(self, session, _id=None):
|
||||
super().__init__(session, Ids.TabsManager, _id=_id)
|
||||
def __init__(self, parent, _id=None):
|
||||
super().__init__(Ids.TabsManager, parent, _id=_id)
|
||||
self._state = TabsManagerState(self)
|
||||
self.commands = Commands(self)
|
||||
self._boundaries = Boundaries()
|
||||
self._search = Search(self._session,
|
||||
self._search = Search(self,
|
||||
items=self._get_tab_list(),
|
||||
get_attr=lambda x: x["label"],
|
||||
template=self._mk_tab_button)
|
||||
@@ -102,7 +102,7 @@ class TabsManager(MultipleInstance):
|
||||
tab_config = self._state.tabs[tab_id]
|
||||
if tab_config["component_type"] is None:
|
||||
return None
|
||||
return InstancesHelper.dynamic_get(self._session, tab_config["component_type"], tab_config["component_id"])
|
||||
return InstancesHelper.dynamic_get(self, tab_config["component_type"], tab_config["component_id"])
|
||||
|
||||
@staticmethod
|
||||
def _get_tab_count():
|
||||
@@ -114,7 +114,7 @@ class TabsManager(MultipleInstance):
|
||||
logger.debug(f"on_new_tab {label=}, {component=}, {auto_increment=}")
|
||||
if auto_increment:
|
||||
label = f"{label}_{self._get_tab_count()}"
|
||||
component = component or VisNetwork(self._session, nodes=vis_nodes, edges=vis_edges)
|
||||
component = component or VisNetwork(self, nodes=vis_nodes, edges=vis_edges)
|
||||
tab_id = self.add_tab(label, component)
|
||||
return (
|
||||
self._mk_tabs_controller(),
|
||||
@@ -328,7 +328,7 @@ class TabsManager(MultipleInstance):
|
||||
tab_content = self._mk_tab_content(active_tab, content)
|
||||
self._state._tabs_content[active_tab] = tab_content
|
||||
else:
|
||||
tab_content = self._mk_tab_content("", None)
|
||||
tab_content = self._mk_tab_content(None, None)
|
||||
|
||||
return Div(
|
||||
tab_content,
|
||||
|
||||
Reference in New Issue
Block a user