Esempio n. 1
0
def _is_extension_enabled(ext_info):
    try:
        ext_pkg = extpkgs.get_ext_package_by_name(ext_info.name)
        if ext_pkg:
            return ext_pkg.is_enabled and ext_pkg.user_has_access
        else:
            mlogger.debug('Extension package is not defined: %s',
                          ext_info.name)
    except Exception as ext_check_err:
        mlogger.error('Error checking state for extension: %s | %s',
                      ext_info.name, ext_check_err)

    # Lets be nice and load the package if it is not defined
    return True
Esempio n. 2
0
    def __init__(self, extension, check_type, script_path):
        self.check_case = check_type
        self.name = getattr(self.check_case, "name", None) \
            or _get_check_name(script_path)
        self.script_path = script_path

        self.extension = extension.name
        self.author = getattr(self.check_case, "author", None)
        if not self.author:
            self.author = "Unknown"
            extension_pkg = extpkg.get_ext_package_by_name(extension.name)
            if extension_pkg:
                self.author = extension_pkg.author

        desc_lines = getattr(self.check_case, "__doc__",
                             "").strip().split('\n')
        if desc_lines:
            self.subtitle = desc_lines[0]
            self.description = '\n'.join([x.strip() for x in desc_lines[1:]])
Esempio n. 3
0
def _is_rocketmode_compat(ext_name):
    # pyRevitCore is rocket-mode compatible
    # this line is needed since pyRevitCore does not have an extension
    # definition in extensions/extensions.json
    if ext_name == 'pyRevitCore':
        return True

    try:
        ext_pkg = extpkgs.get_ext_package_by_name(ext_name)
        if ext_pkg:
            return ext_pkg.rocket_mode_compatible
        else:
            mlogger.debug('Extension package is not defined: %s', ext_name)
    except Exception as ext_check_err:
        mlogger.error(
            'Error checking rocket-mode compatibility '
            'for extension: %s | %s', ext_name, ext_check_err)

    # assume not-compatible if not set
    return False