def draw_keymaps(context): from bl_keymap_utils.io import keyconfig_merge wm = context.window_manager kc_user = wm.keyconfigs.user display_keymaps = keyconfig_merge( kc_user, kc_user) # TODO: Is this doing anything?? draw_hierarchy(display_keymaps)
def draw_keymaps(context, layout): from bl_keymap_utils.io import keyconfig_merge wm = context.window_manager kc_user = wm.keyconfigs.user kc_active = wm.keyconfigs.active spref = context.space_data subsplit = layout.split() subcol = subsplit.column() col = subcol.column() row = col.row(align=True) # row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config") text = bpy.path.display_name(kc_active.name) if not text: text = "Blender (default)" row.menu("USERPREF_MT_keyconfigs", text=text) row.operator("wm.keyconfig_preset_add", text="", icon='ADD') row.operator("wm.keyconfig_preset_add", text="", icon='REMOVE').remove_active = True # layout.context_pointer_set("keyconfig", wm.keyconfigs.active) # row.operator("wm.keyconfig_remove", text="", icon='X') row.separator() rowsub = row.split(factor=0.33, align=True) # postpone drawing into rowsub, so we can set alert! layout.separator() display_keymaps = keyconfig_merge(kc_user, kc_user) filter_type = spref.filter_type filter_text = spref.filter_text.strip() if filter_text: filter_text = filter_text.lower() ok = draw_filtered(display_keymaps, filter_type, filter_text, layout) else: draw_hierarchy(display_keymaps, layout) ok = True # go back and fill in rowsub rowsub.prop(spref, "filter_type", text="") rowsubsub = rowsub.row(align=True) if not ok: rowsubsub.alert = True rowsubsub.prop(spref, "filter_text", text="", icon='VIEWZOOM') if not filter_text: # When the keyconfig defines it's own preferences. kc_prefs = kc_active.preferences if kc_prefs is not None: box = col.box() row = box.row(align=True) prefs = context.preferences inputs = prefs.inputs show_ui_keyconfig = inputs.show_ui_keyconfig row.prop( inputs, "show_ui_keyconfig", text="", icon='TRIA_DOWN' if show_ui_keyconfig else 'TRIA_RIGHT', emboss=False, ) row.label(text="Preferences") if show_ui_keyconfig: # Defined by user preset, may contain mistakes out of our control. try: kc_prefs.draw(box) except Exception: import traceback traceback.print_exc() del box del kc_prefs
def draw_keymaps(context, layout): from bl_keymap_utils.io import keyconfig_merge wm = context.window_manager kc_user = wm.keyconfigs.user kc_active = wm.keyconfigs.active spref = context.space_data # row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config") text = bpy.path.display_name(kc_active.name, has_ext=False) if not text: text = "Blender (default)" split = layout.split(factor=0.6) row = split.row() rowsub = row.row(align=True) rowsub.menu("USERPREF_MT_keyconfigs", text=text) rowsub.operator("wm.keyconfig_preset_add", text="", icon='ADD') rowsub.operator("wm.keyconfig_preset_add", text="", icon='REMOVE').remove_active = True rowsub = split.row(align=True) rowsub.operator("preferences.keyconfig_import", text="Import...", icon='IMPORT') rowsub.operator("preferences.keyconfig_export", text="Export...", icon='EXPORT') row = layout.row() col = layout.column() # layout.context_pointer_set("keyconfig", wm.keyconfigs.active) # row.operator("preferences.keyconfig_remove", text="", icon='X') #rowsub = row.split(factor=0.3, align=True) # bfa - turned off, puts the filter_type buttons underneath rowsub = layout.row(align=True) # bfa - put the buttons for the filter_type prop in row # postpone drawing into rowsub, so we can set alert! layout.separator() display_keymaps = keyconfig_merge(kc_user, kc_user) filter_type = spref.filter_type filter_text = spref.filter_text.strip() if filter_text: filter_text = filter_text.lower() ok = draw_filtered(display_keymaps, filter_type, filter_text, layout) else: draw_hierarchy(display_keymaps, layout) ok = True # go back and fill in rowsub rowsubsub = rowsub.row(align=True) rowsubsub.prop(spref, "filter_type", expand=True)# bfa - radio buttons instead of dropdown rowsubsub = rowsub.row(align=True) if not ok: rowsubsub.alert = True rowsubsub.prop(spref, "filter_text", text="", icon='VIEWZOOM') if not filter_text: # When the keyconfig defines its own preferences. kc_prefs = kc_active.preferences if kc_prefs is not None: box = col.box() row = box.row(align=True) pref = context.preferences keymappref = pref.keymap show_ui_keyconfig = keymappref.show_ui_keyconfig row.prop( keymappref, "show_ui_keyconfig", text="", icon='DISCLOSURE_TRI_DOWN' if show_ui_keyconfig else 'DISCLOSURE_TRI_RIGHT', emboss=False, ) row.label(text="Preferences") if show_ui_keyconfig: # Defined by user preset, may contain mistakes out of our control. try: kc_prefs.draw(box) except Exception: import traceback traceback.print_exc() del box del kc_prefs
def draw_keymaps(context, layout): from bl_keymap_utils.io import keyconfig_merge wm = context.window_manager kc_user = wm.keyconfigs.user kc_active = wm.keyconfigs.active spref = context.space_data # row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config") text = bpy.path.display_name(kc_active.name, has_ext=False) if not text: text = "Blender (default)" split = layout.split(factor=0.6) row = split.row() rowsub = row.row(align=True) rowsub.menu("USERPREF_MT_keyconfigs", text=text) rowsub.operator("wm.keyconfig_preset_add", text="", icon='ADD') rowsub.operator("wm.keyconfig_preset_add", text="", icon='REMOVE').remove_active = True rowsub = split.row(align=True) rowsub.operator("preferences.keyconfig_import", text="Import...", icon='IMPORT') rowsub.operator("preferences.keyconfig_export", text="Export...", icon='EXPORT') row = layout.row() col = layout.column() # layout.context_pointer_set("keyconfig", wm.keyconfigs.active) # row.operator("preferences.keyconfig_remove", text="", icon='X') rowsub = row.split(factor=0.3, align=True) # postpone drawing into rowsub, so we can set alert! layout.separator() display_keymaps = keyconfig_merge(kc_user, kc_user) filter_type = spref.filter_type filter_text = spref.filter_text.strip() if filter_text: filter_text = filter_text.lower() ok = draw_filtered(display_keymaps, filter_type, filter_text, layout) else: draw_hierarchy(display_keymaps, layout) ok = True # go back and fill in rowsub rowsub.prop(spref, "filter_type", text="") rowsubsub = rowsub.row(align=True) if not ok: rowsubsub.alert = True rowsubsub.prop(spref, "filter_text", text="", icon='VIEWZOOM') if not filter_text: # When the keyconfig defines it's own preferences. kc_prefs = kc_active.preferences if kc_prefs is not None: box = col.box() row = box.row(align=True) pref = context.preferences keymappref = pref.keymap show_ui_keyconfig = keymappref.show_ui_keyconfig row.prop( keymappref, "show_ui_keyconfig", text="", icon='DISCLOSURE_TRI_DOWN' if show_ui_keyconfig else 'DISCLOSURE_TRI_RIGHT', emboss=False, ) row.label(text="Preferences") if show_ui_keyconfig: # Defined by user preset, may contain mistakes out of our control. try: kc_prefs.draw(box) except Exception: import traceback traceback.print_exc() del box del kc_prefs