Beispiel #1
0
    def remove_pkg_config(self):
        """
        Removes the installed extension configuration.
        """

        user_config.remove_section(self.ext_dirname)
        user_config.save_changes()
Beispiel #2
0
def reset_config():
    """Reset pyRevit config.

    Script should call this to reset any saved configuration by removing section related to current script
    """
    from pyrevit.userconfig import user_config
    script_cfg_postfix = 'config'

    user_config.remove_section(EXEC_PARAMS.command_name +
                                   script_cfg_postfix)
    user_config.save_changes()
Beispiel #3
0
def reset_config(section=None):
    """Reset pyRevit config.

    Script should call this to reset any save configuration by removing
    section related to current script.

    Args:
        section (str, optional): config section name
    """
    from pyrevit.userconfig import user_config
    if not section:
        script_cfg_postfix = 'config'
        section = EXEC_PARAMS.command_name + script_cfg_postfix
    elif section in [TargetApps.Revit.PyRevitConsts.ConfigsCoreSection]:
        raise PyRevitException(
            'Can not remove internal config section: {}'.format(section))

    try:
        user_config.remove_section(section)
        user_config.save_changes()
    except Exception:
        mlogger.debug('Failed resetting config for %s (%s)',
                      EXEC_PARAMS.command_name, section)