Remove cmd_set from component

This commit is contained in:
ChrisLR 2024-02-24 11:09:44 -05:00
parent 1bfb3643ad
commit 8bda7c10f7
2 changed files with 1 additions and 15 deletions

View file

@ -50,8 +50,6 @@ class Component(metaclass=BaseComponent):
name = "" name = ""
slot = None slot = None
cmd_set: CmdSet = None
_fields = {} _fields = {}
def __init__(self, host=None): def __init__(self, host=None):
@ -115,11 +113,7 @@ class Component(metaclass=BaseComponent):
Component: The loaded instance of the component Component: The loaded instance of the component
""" """
inst = cls(host) return cls(host)
if inst.cmd_set:
host.cmdset.add(inst.cmd_set)
return inst
def at_added(self, host): def at_added(self, host):
""" """
@ -132,9 +126,6 @@ class Component(metaclass=BaseComponent):
if self.host and self.host != host: if self.host and self.host != host:
raise exceptions.InvalidComponentError("Components must not register twice!") raise exceptions.InvalidComponentError("Components must not register twice!")
if self.cmd_set:
self.host.cmdset.add(self.cmd_set)
self.host = host self.host = host
def at_removed(self, host): def at_removed(self, host):
@ -148,9 +139,6 @@ class Component(metaclass=BaseComponent):
if host != self.host: if host != self.host:
raise ValueError("Component attempted to remove from the wrong host.") raise ValueError("Component attempted to remove from the wrong host.")
if self.cmd_set:
self.host.cmdset.remove(self.cmd_set)
self.host = None self.host = None
@property @property

View file

@ -118,8 +118,6 @@ class ComponentHandler:
field.at_removed(component) field.at_removed(component)
component.at_removed(self.host) component.at_removed(self.host)
if component.cmd_set:
self.host.cmdset.remove(component.cmd_set)
self.host.tags.remove(component.name, category="components") self.host.tags.remove(component.name, category="components")
self.host.signals.remove_object_listeners_and_responders(component) self.host.signals.remove_object_listeners_and_responders(component)