diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/space_userpref.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 136 |
1 files changed, 102 insertions, 34 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 1feb1eec0c5..13edc3471d2 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Header, Menu, Operator, Panel import os import addon_utils @@ -75,7 +76,7 @@ def opengl_lamp_buttons(column, lamp): col.prop(lamp, "direction", text="") -class USERPREF_HT_header(bpy.types.Header): +class USERPREF_HT_header(Header): bl_space_type = 'USER_PREFERENCES' def draw(self, context): @@ -99,7 +100,7 @@ class USERPREF_HT_header(bpy.types.Header): layout.operator("ui.reset_default_theme") -class USERPREF_PT_tabs(bpy.types.Panel): +class USERPREF_PT_tabs(Panel): bl_label = "" bl_space_type = 'USER_PREFERENCES' bl_region_type = 'WINDOW' @@ -113,14 +114,14 @@ class USERPREF_PT_tabs(bpy.types.Panel): layout.prop(userpref, "active_section", expand=True) -class USERPREF_MT_interaction_presets(bpy.types.Menu): +class USERPREF_MT_interaction_presets(Menu): bl_label = "Presets" preset_subdir = "interaction" preset_operator = "script.execute_preset" - draw = bpy.types.Menu.draw_preset + draw = Menu.draw_preset -class USERPREF_MT_appconfigs(bpy.types.Menu): +class USERPREF_MT_appconfigs(Menu): bl_label = "AppPresets" preset_subdir = "keyconfig" preset_operator = "wm.appconfig_activate" @@ -129,10 +130,10 @@ class USERPREF_MT_appconfigs(bpy.types.Menu): self.layout.operator("wm.appconfig_default", text="Blender (default)") # now draw the presets - bpy.types.Menu.draw_preset(self, context) + Menu.draw_preset(self, context) -class USERPREF_MT_splash(bpy.types.Menu): +class USERPREF_MT_splash(Menu): bl_label = "Splash" def draw(self, context): @@ -149,7 +150,7 @@ class USERPREF_MT_splash(bpy.types.Menu): row.menu("USERPREF_MT_appconfigs", text="Preset") -class USERPREF_PT_interface(bpy.types.Panel): +class USERPREF_PT_interface(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = "Interface" bl_region_type = 'WINDOW' @@ -246,7 +247,7 @@ class USERPREF_PT_interface(bpy.types.Panel): col.prop(view, "show_splash") -class USERPREF_PT_edit(bpy.types.Panel): +class USERPREF_PT_edit(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = "Edit" bl_region_type = 'WINDOW' @@ -359,7 +360,7 @@ class USERPREF_PT_edit(bpy.types.Panel): col.prop(edit, "use_duplicate_particle", text="Particle") -class USERPREF_PT_system(bpy.types.Panel): +class USERPREF_PT_system(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = "System" bl_region_type = 'WINDOW' @@ -496,7 +497,7 @@ class USERPREF_PT_system(bpy.types.Panel): sub.template_color_ramp(system, "weight_color_range", expand=True) -class USERPREF_PT_theme(bpy.types.Panel): +class USERPREF_PT_theme(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = "Themes" bl_region_type = 'WINDOW' @@ -679,7 +680,7 @@ class USERPREF_PT_theme(bpy.types.Panel): self._theme_generic(split, getattr(theme, theme.theme_area.lower())) -class USERPREF_PT_file(bpy.types.Panel): +class USERPREF_PT_file(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = "Files" bl_region_type = 'WINDOW' @@ -755,7 +756,32 @@ class USERPREF_PT_file(bpy.types.Panel): from bl_ui.space_userpref_keymap import InputKeyMapPanel -class USERPREF_PT_input(bpy.types.Panel, InputKeyMapPanel): +class USERPREF_MT_ndof_settings(Menu): + # accessed from the window keybindings in C (only) + bl_label = "3D Mouse Settings" + + def draw(self, context): + layout = self.layout + input_prefs = context.user_preferences.inputs + + layout.separator() + layout.prop(input_prefs, "ndof_sensitivity") + + if context.space_data.type == 'VIEW_3D': + layout.separator() + layout.prop(input_prefs, "ndof_show_guide") + + layout.separator() + layout.label(text="orbit options") + layout.prop(input_prefs, "ndof_orbit_invert_axes") + + layout.separator() + layout.label(text="fly options") + layout.prop(input_prefs, "ndof_fly_helicopter", icon='NDOF_FLY') + layout.prop(input_prefs, "ndof_lock_horizon", icon='NDOF_DOM') + + +class USERPREF_PT_input(Panel, InputKeyMapPanel): bl_space_type = 'USER_PREFERENCES' bl_label = "Input" @@ -845,7 +871,7 @@ class USERPREF_PT_input(bpy.types.Panel, InputKeyMapPanel): #print("runtime", time.time() - start) -class USERPREF_MT_addons_dev_guides(bpy.types.Menu): +class USERPREF_MT_addons_dev_guides(Menu): bl_label = "Development Guides" # menu to open webpages with addons development guides @@ -856,7 +882,7 @@ class USERPREF_MT_addons_dev_guides(bpy.types.Menu): layout.operator('wm.url_open', text='How to share your addon', icon='URL').url = 'http://wiki.blender.org/index.php/Dev:Py/Sharing' -class USERPREF_PT_addons(bpy.types.Panel): +class USERPREF_PT_addons(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = "Addons" bl_region_type = 'WINDOW' @@ -924,6 +950,12 @@ class USERPREF_PT_addons(bpy.types.Panel): "(see console for details)", ) + if addon_utils.error_encoding: + self.draw_error(col, + "One or more addons do not have UTF-8 encoding\n" + "(see console for details)", + ) + filter = context.window_manager.addon_filter search = context.window_manager.addon_search.lower() support = context.window_manager.addon_support @@ -1040,54 +1072,84 @@ class USERPREF_PT_addons(bpy.types.Panel): row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name -class WM_OT_addon_enable(bpy.types.Operator): +class WM_OT_addon_enable(Operator): "Enable an addon" bl_idname = "wm.addon_enable" bl_label = "Enable Add-On" - module = StringProperty(name="Module", description="Module name of the addon to enable") + module = StringProperty( + name="Module", + description="Module name of the addon to enable", + ) def execute(self, context): mod = addon_utils.enable(self.module) if mod: - # check if add-on is written for current blender version, or raise a warning info = addon_utils.module_bl_info(mod) - if info.get("blender", (0, 0, 0)) > bpy.app.version: - self.report("WARNING','This script was written for a newer version of Blender and might not function (correctly).\nThe script is enabled though.") + info_ver = info.get("blender", (0, 0, 0)) + + if info_ver > bpy.app.version: + self.report({'WARNING'}, ("This script was written Blender " + "version %d.%d.%d and might not " + "function (correctly).\n" + "The script is enabled though.") % + info_ver) return {'FINISHED'} else: return {'CANCELLED'} -class WM_OT_addon_disable(bpy.types.Operator): +class WM_OT_addon_disable(Operator): "Disable an addon" bl_idname = "wm.addon_disable" bl_label = "Disable Add-On" - module = StringProperty(name="Module", description="Module name of the addon to disable") + module = StringProperty( + name="Module", + description="Module name of the addon to disable", + ) def execute(self, context): addon_utils.disable(self.module) return {'FINISHED'} -class WM_OT_addon_install(bpy.types.Operator): +class WM_OT_addon_install(Operator): "Install an addon" bl_idname = "wm.addon_install" bl_label = "Install Add-On..." - overwrite = BoolProperty(name="Overwrite", description="Remove existing addons with the same ID", default=True) + overwrite = BoolProperty( + name="Overwrite", + description="Remove existing addons with the same ID", + default=True, + ) target = EnumProperty( name="Target Path", items=(('DEFAULT', "Default", ""), - ('PREFS', "User Prefs", ""))) - - filepath = StringProperty(name="File Path", description="File path to write file to") - filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'}) - filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'}) - filter_glob = StringProperty(default="*.py;*.zip", options={'HIDDEN'}) + ('PREFS', "User Prefs", "")), + ) + + filepath = StringProperty( + name="File Path", + description="File path to write file to", + ) + filter_folder = BoolProperty( + name="Filter folders", + default=True, + options={'HIDDEN'}, + ) + filter_python = BoolProperty( + name="Filter python", + default=True, + options={'HIDDEN'}, + ) + filter_glob = StringProperty( + default="*.py;*.zip", + options={'HIDDEN'}, + ) @staticmethod def _module_remove(path_addons, module): @@ -1219,12 +1281,15 @@ class WM_OT_addon_install(bpy.types.Operator): return {'RUNNING_MODAL'} -class WM_OT_addon_remove(bpy.types.Operator): +class WM_OT_addon_remove(Operator): "Disable an addon" bl_idname = "wm.addon_remove" bl_label = "Remove Add-On" - module = StringProperty(name="Module", description="Module name of the addon to remove") + module = StringProperty( + name="Module", + description="Module name of the addon to remove", + ) @staticmethod def path_from_addon(module): @@ -1267,12 +1332,15 @@ class WM_OT_addon_remove(bpy.types.Operator): return wm.invoke_props_dialog(self, width=600) -class WM_OT_addon_expand(bpy.types.Operator): +class WM_OT_addon_expand(Operator): "Display more information on this add-on" bl_idname = "wm.addon_expand" bl_label = "" - module = StringProperty(name="Module", description="Module name of the addon to expand") + module = StringProperty( + name="Module", + description="Module name of the addon to expand", + ) def execute(self, context): module_name = self.module |