def _advanced_config(self, event=None): config_instance = SimpleNamespace(**self.advanced_options) if 'port' in self.advanced_options: scd = SerialConfigDialog(config_instance, self, self.config) scd.ShowModal() # SerialConfigDialog destroys itself. else: kbd = KeyboardConfigDialog(config_instance, self, self.config) kbd.ShowModal() self.advanced_options = config_instance.__dict__
def _advanced_config(self, event=None): class Struct(object): def __init__(self, **kwargs): self.__dict__.update(kwargs) config_instance = Struct(**self.advanced_options) if 'port' in self.advanced_options: scd = SerialConfigDialog(config_instance, self, self.config) scd.ShowModal() # SerialConfigDialog destroys itself. else: kbd = KeyboardConfigDialog(config_instance, self, self.config) kbd.ShowModal() self.advanced_options = config_instance.__dict__