def get_ops_operators(container_name): operators = [] documentation = get_documentation() ops = documentation.get_operators_in_container(container_name) for op in ops: operators.append(ExtendWordOperator(op.name, additional_data = op)) return operators
def get_container_operators(): operators = [] documentation = get_documentation() container_names = documentation.get_operator_container_names() for name in container_names: operators.append(ExtendWordOperator(name)) return operators
def get_ops_operators(container_name): operators = [] documentation = get_documentation() ops = documentation.get_operators_in_container(container_name) for op in ops: operators.append(ExtendWordOperator(op.name, additional_data=op)) return operators
def draw(self, context): layout = self.layout if running: layout.operator("script_auto_complete.stop_auto_completion", icon = "PANEL_CLOSE") else: layout.operator("script_auto_complete.start_auto_completion", icon = "LIBRARY_DATA_DIRECT") if get_documentation().is_build: layout.operator("script_auto_complete.rebuild_documentation") layout.operator("script_auto_complete.correct_whitespaces")
def draw(self, context): layout = self.layout if running: layout.operator("script_auto_complete.stop_auto_completion", icon="PANEL_CLOSE") else: layout.operator("script_auto_complete.start_auto_completion", icon="LIBRARY_DATA_DIRECT") if get_documentation().is_build: layout.operator("script_auto_complete.rebuild_documentation") layout.operator("script_auto_complete.correct_whitespaces")
def get_functions_from_path(path): if "." not in path: return [] documentation = get_documentation() op = documentation.get_operator_by_full_name(path) if op is None: attributes = documentation.get_best_matching_attributes_of_path(path) else: attributes = [op] functions = [] for attribute in attributes: if isinstance(attribute, (OperatorDocumentation, FunctionDocumentation)): functions.append(attribute) return functions
def get_api_context_operators(text_block): documentation = get_documentation() parent_path = text_block.get_current_parent_path() attributes = documentation.get_best_matching_subattributes_of_path(parent_path) current_word = text_block.current_word.lower() operators = [] secondary_operators = [] for attribute in attributes: attribute_name = attribute.name.lower() if attribute_name.startswith(current_word): operators.append(ExtendWordOperator(attribute.name, additional_data = attribute)) elif current_word in attribute_name: secondary_operators.append(ExtendWordOperator(attribute.name, additional_data = attribute)) operators.sort(key = attrgetter("display_name")) secondary_operators.sort(key = attrgetter("display_name")) return operators + secondary_operators
def get_assign_or_compare_operators(text_block): operators = [] assign_in_line_path = text_block.get_current_line_assign_variable_path() compare_path = text_block.get_current_compare_variable_path() doc = get_documentation() if assign_in_line_path is not None: attributes = doc.get_best_matching_attributes_of_path(assign_in_line_path) enum_items = get_enum_items_from_attributes(attributes) pattern = assign_in_line_path + "\s*=\s*(\"|\')" word_start = text_block.get_current_text_after_pattern(pattern) operators = get_operators_from_enum_items(enum_items, word_start) elif compare_path is not None: attributes = doc.get_best_matching_attributes_of_path(compare_path) enum_items = get_enum_items_from_attributes(attributes) pattern = compare_path + "\s*(==|<|>|!=|(not )?in \[)\s*(\"|\')" word_start = text_block.get_current_text_after_pattern(pattern) operators = get_operators_from_enum_items(enum_items, word_start) return operators
def get_assign_or_compare_operators(text_block): operators = [] assign_in_line_path = text_block.get_current_line_assign_variable_path() compare_path = text_block.get_current_compare_variable_path() doc = get_documentation() if assign_in_line_path is not None: attributes = doc.get_best_matching_attributes_of_path( assign_in_line_path) enum_items = get_enum_items_from_attributes(attributes) pattern = assign_in_line_path + "\s*=\s*(\"|\')" word_start = text_block.get_current_text_after_pattern(pattern) operators = get_operators_from_enum_items(enum_items, word_start) elif compare_path is not None: attributes = doc.get_best_matching_attributes_of_path(compare_path) enum_items = get_enum_items_from_attributes(attributes) pattern = compare_path + "\s*(==|<|>|!=|(not )?in \[)\s*(\"|\')" word_start = text_block.get_current_text_after_pattern(pattern) operators = get_operators_from_enum_items(enum_items, word_start) return operators
("TOOL_PROPS", "e.g. lower part of the left side part in 3D view"), "PREVIEW" ] suggestions["\s*bl_region_type *= *(\"|\')"] = region_types suggestions["\s*bl_category *= *(\"|\')"] = [ "Tools", "Create", "Relations", "Animation", "Physics", "Grease Pencil" ] suggestions[r"\s*bl_options *=.*\W(\"|\')"] = [ "REGISTER", "UNDO", "BLOCKING", "GRAB_POINTER", "PRESET", "INTERNAL" ] suggestions["\s*return *\{ *(\"|\')"] = [ "RUNNING_MODAL", "CANCELLED", "FINISHED", "PASS_THROUGH" ] suggestions["class \w*\("] = ["bpy", "Panel", "Menu", "Operator"] suggestions["class \w*\(bpy\."] = ["types"] suggestions["class \w*\(bpy\.types\."] = ["Panel", "Menu", "Operator"] suggestions[".*bpy\."] = [ "context", "data", "ops", "types", "utils", "path", "app", "props" ] suggestions[".*bpy\.props\."] = [ type_name for type_name in dir(bpy.props) if type_name[0] != "_" ] suggestions["kmi\.properties\.name\s*=\s*(\"|\')"] = get_documentation( ).get_menu_names()
def execute(self, context): get_documentation().build() return {"FINISHED"}
def invoke(self, context, event): get_documentation().build_if_necessary() self.modal_handler = ModalHandler() context.window_manager.modal_handler_add(self) start() return { "RUNNING_MODAL" }
def poll(cls, context): return get_documentation().is_build
def invoke(self, context, event): get_documentation().build_if_necessary() self.modal_handler = ModalHandler() context.window_manager.modal_handler_add(self) start() return {"RUNNING_MODAL"}
elif suggestion.upper().startswith(word_start): operators.append(ExtendWordOperator(suggestion)) suggestions = {} space_types = [ "EMPTY", "VIEW_3D", "TIMELINE", "GRAPH_EDITOR", "DOPESHEET", "NLA_EDITOR", "IMAGE_EDITOR", "SEQUENCE_EDITOR", "CLIP_EDITOR", "TEXT_EDITOR", "NODE_EDITOR", "LOGIC_EDITOR", "PROPERTIES", "OUTLINER", "USER_PREFERENCES", "INFO", "FILE_BROWSER", "CONSOLE" ] suggestions["\sbl_space_type *= *(\"|\')"] = space_types region_types = ["WINDOW", "HEADER", "CHANNELS", "TEMPORARY", "UI", ("TOOLS", "e.g. left sidebar in 3D view"), ("TOOL_PROPS", "e.g. lower part of the left side part in 3D view"), "PREVIEW"] suggestions["\s*bl_region_type *= *(\"|\')"] = region_types suggestions["\s*bl_category *= *(\"|\')"] = ["Tools", "Create", "Relations", "Animation", "Physics", "Grease Pencil"] suggestions[r"\s*bl_options *=.*\W(\"|\')"] = ["REGISTER", "UNDO", "BLOCKING", "GRAB_POINTER", "PRESET", "INTERNAL"] suggestions["\s*return *\{ *(\"|\')"] = ["RUNNING_MODAL", "CANCELLED", "FINISHED", "PASS_THROUGH"] suggestions["class \w*\("] = ["bpy", "Panel", "Menu", "Operator"] suggestions["class \w*\(bpy\."] = ["types"] suggestions["class \w*\(bpy\.types\."] = ["Panel", "Menu", "Operator"] suggestions[".*bpy\."] = ["context", "data", "ops", "types", "utils", "path", "app", "props"] suggestions[".*bpy\.props\."] = [type_name for type_name in dir(bpy.props) if type_name[0] != "_"] suggestions["kmi\.properties\.name\s*=\s*(\"|\')"] = get_documentation().get_menu_names()
def execute(self, context): get_documentation().build() return { "FINISHED" }