def _save(self, event): old_config = self.config.clone() self.machine_config.save() self.dictionary_config.save() self.logging_config.save() self.display_config.save() self.output_config.save() try: update_engine(self.engine, old_config, self.config) except InvalidConfigurationError as e: alert_dialog = wx.MessageDialog(self, unicode(e), "Configuration error", wx.OK | wx.ICON_INFORMATION) alert_dialog.ShowModal() alert_dialog.Destroy() return with open(self.config.target_file, 'wb') as f: self.config.save(f) if self.IsModal(): self.EndModal(wx.ID_SAVE) else: self.Close()
def test_engine_reconnect(self): with self._setup(): app.init_engine(self.engine, self.cfg) self.engine.machine._ready() self.engine.set_is_running(True) self.engine.machine._error() app.update_engine(self.engine, self.cfg, reset_machine=True) self.engine.machine._ready() self.assertEqual(self.state_transitions, [ (None , False), # engine init (None , False), # ('connected' , False), # machine ready (None , True ), # set_is_running(True) ('disconnected', True ), # machine error (None , True ), # engine update ('connected' , True ), # machine ready ])
def _save(self, event): self.machine_config.save() self.dictionary_config.save() self.logging_config.save() self.display_config.save() self.output_config.save() try: update_engine(self.engine, self.config) except Exception: log.error('updating engine configuration failed', exc_info=True) return with open(self.config.target_file, 'wb') as f: self.config.save(f) if self.IsModal(): self.EndModal(wx.ID_SAVE) else: self.Close()
def _save(self, event): self.machine_config.save() self.dictionary_config.save() self.logging_config.save() self.display_config.save() self.output_config.save() try: update_engine(self.engine, self.config) except Exception: log.error("updating engine configuration failed", exc_info=True) return with open(self.config.target_file, "wb") as f: self.config.save(f) if self.IsModal(): self.EndModal(wx.ID_SAVE) else: self.Close()