Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_userpref.py
| Show First 20 Lines • Show All 1,377 Lines • ▼ Show 20 Lines | class USERPREF_PT_addons(Panel): | ||||
| def draw(self, context): | def draw(self, context): | ||||
| import os | import os | ||||
| import addon_utils | import addon_utils | ||||
| layout = self.layout | layout = self.layout | ||||
| userpref = context.user_preferences | userpref = context.user_preferences | ||||
| workspace = context.workspace | |||||
| use_ui_tags = workspace.use_ui_tags | |||||
| used_ui_tags = {ui_tag.name for ui_tag in workspace.ui_tags} | |||||
| used_ext = {ext.module for ext in userpref.addons} | used_ext = {ext.module for ext in userpref.addons} | ||||
| userpref_addons_folder = os.path.join(userpref.filepaths.script_directory, "addons") | userpref_addons_folder = os.path.join(userpref.filepaths.script_directory, "addons") | ||||
| scripts_addons_folder = bpy.utils.user_resource('SCRIPTS', "addons") | scripts_addons_folder = bpy.utils.user_resource('SCRIPTS', "addons") | ||||
| # collect the categories that can be filtered on | # collect the categories that can be filtered on | ||||
| addons = [ | addons = [ | ||||
| (mod, addon_utils.module_bl_info(mod)) | (mod, addon_utils.module_bl_info(mod)) | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| ).module = module_name | ).module = module_name | ||||
| row.operator( | row.operator( | ||||
| "wm.addon_disable" if is_enabled else "wm.addon_enable", | "wm.addon_disable" if is_enabled else "wm.addon_enable", | ||||
| icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', text="", | icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', text="", | ||||
| emboss=False, | emboss=False, | ||||
| ).module = module_name | ).module = module_name | ||||
| if use_ui_tags: | |||||
| is_enabled_tag = module_name in used_ui_tags | |||||
| row.operator( | |||||
| "wm.ui_tag_disable" if is_enabled_tag else "wm.ui_tag_enable", | |||||
| icon='CHECKBOX_HLT' if is_enabled_tag else 'CHECKBOX_DEHLT', text="", | |||||
| ).ui_tag = module_name | |||||
| sub = row.row() | sub = row.row() | ||||
| sub.active = is_enabled | sub.active = is_enabled | ||||
| sub.label(text="%s: %s" % (info["category"], info["name"])) | sub.label(text="%s: %s" % (info["category"], info["name"])) | ||||
| if info["warning"]: | if info["warning"]: | ||||
| sub.label(icon='ERROR') | sub.label(icon='ERROR') | ||||
| # icon showing support level. | # icon showing support level. | ||||
| sub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION')) | sub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION')) | ||||
| ▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines | |||||