예제 #1
0
    def drop_config(self, path, row):
        if not ConfigManager.config_exists(path):
            return False
        config = ConfigManager()
        config.load_only_config(path)
        config_dict = config.full_dict(include_defaults=False)
        config_dict.pop("PRIVATE", None)

        self.data_contents[row].client.send_message("config",
                                                    kwargs={
                                                        "config": config_dict,
                                                        "mode": "rewrite"
                                                    })
        return False
예제 #2
0
    def call_config_dialog(self,
                           cfg: config.ConfigManager,
                           on_save=None,
                           on_restart=None,
                           name="Untitled.ini"):
        self.setupModel(cfg.full_dict(include_defaults=True),
                        convert_types=(not cfg.validated))
        self.ui.do_restart.setEnabled(on_restart is not None)
        self._filename = name
        self.update_title()

        if not self.validation_loop(cfg, cfg.config.configspec):
            return False

        if on_save is not None:
            on_save()

        if on_restart is not None and self.ui.do_restart.isChecked():
            on_restart()
        return True