def __init__(self, **config): # name is a little odd; we can't resolve it until the class is defined # (i.e., we can't figure it out to define it in Layout.defaults), so # we resolve it here instead. if "name" not in config: config["name"] = self.__class__.__name__.lower() CommandObject.__init__(self) configurable.Configurable.__init__(self, **config) self.add_defaults(Layout.defaults)
def __init__(self, length, **config): """ length: bar.STRETCH, bar.CALCULATED, or a specified length. """ CommandObject.__init__(self) self.name = self.__class__.__name__.lower() if "name" in config: self.name = config["name"] configurable.Configurable.__init__(self, **config) self.add_defaults(_Widget.defaults) if length in (bar.CALCULATED, bar.STRETCH): self.length_type = length self.length = 0 else: assert isinstance(length, int) self.length_type = bar.STATIC self.length = length self.configured = False
def __init__(self, length, **config): """ length: bar.STRETCH, bar.CALCULATED, or a specified length. """ CommandObject.__init__(self) self.name = self.__class__.__name__.lower() if "name" in config: self.name = config["name"] configurable.Configurable.__init__(self, **config) self.add_defaults(_Widget.defaults) if length in (bar.CALCULATED, bar.STRETCH): self.length_type = length self.length = 0 elif isinstance(length, int): self.length_type = bar.STATIC self.length = length else: raise confreader.ConfigError("Widget width must be an int") self.configured = False self._futures: list[asyncio.TimerHandle] = []