def Value(self): # if its the hook, get a list of hooks and display in human-readable if self.Id == envvars.HOOKS_ENVVAR: return coreutils.join_strings( [x.UniqueId for x in hooks.get_event_hooks()]) else: return self._value
def _read_bundle_metadata(self): # using classname otherwise exceptions in superclasses won't show GenericUIComponent._read_bundle_metadata(self) if exts.MDATA_ENGINE in self.meta: self.requires_clean_engine = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_CLEAN, 'false').lower() == 'true' self.requires_fullframe_engine = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_FULLFRAME, 'false').lower() == 'true' self.requires_persistent_engine = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_PERSISTENT, 'false').lower() == 'true' # panel buttons should be active always if self.type_id == exts.PANEL_PUSH_BUTTON_POSTFIX: self.context = exts.CTX_ZERODOC[0] else: self.context = \ self.meta.get(exts.MDATA_COMMAND_CONTEXT, None) if isinstance(self.context, list): self.context = coreutils.join_strings(self.context) if self.context and exts.CTX_ZERODOC[1] in self.context: mlogger.deprecate( "\"zerodoc\" context is deprecated. " "use \"zero-doc\" instead. | %s", self)
def _make_python_types(extension, module_builder, cmd_component): """ Args: module_builder: cmd_component (pyrevit.extensions.genericcomps.GenericUICommand): Returns: """ logger.debug('Creating executor type for: {}'.format(cmd_component)) # by default, core uses a clean engine for each command execution use_clean_engine = True # use_clean_engine will be set to false only when: # core is in rocket-mode # AND extension is rocket-mode compatible # AND the command is not asking for a clean engine if user_config.core.get_option('rocketmode', False) \ and _is_rocketmode_compat(extension.name) \ and not cmd_component.requires_clean_engine: use_clean_engine = False logger.debug('{} uses clean engine: {}'.format(cmd_component.name, use_clean_engine)) logger.debug('{} requires Fullframe engine: {}'.format( cmd_component.name, cmd_component.requires_fullframe_engine)) create_type(module_builder, CMD_EXECUTOR_TYPE, cmd_component.unique_name, create_ext_command_attrs(), cmd_component.get_full_script_address(), cmd_component.get_full_config_script_address(), join_strings(cmd_component.get_search_paths()), cmd_component.get_help_url() or '', cmd_component.name, cmd_component.bundle_name, extension.name, cmd_component.unique_name, int(use_clean_engine), int(cmd_component.requires_fullframe_engine)) logger.debug( 'Successfully created executor type for: {}'.format(cmd_component)) cmd_component.class_name = cmd_component.unique_name # create command availability class for this command if cmd_component.cmd_context: try: logger.debug( 'Creating availability type for: {}'.format(cmd_component)) cmd_component.avail_class_name = \ _make_python_avail_type(module_builder, cmd_component) logger.debug( 'Successfully created availability type for: {}'.format( cmd_component)) except Exception as cmd_avail_err: cmd_component.avail_class_name = None logger.error('Error creating availability type: {} | {}'.format( cmd_component, cmd_avail_err))
def _read_bundle_metadata(self): # using classname otherwise exceptions in superclasses won't show GenericUIComponent._read_bundle_metadata(self) # determine engine configs if exts.MDATA_ENGINE in self.meta: self.requires_clean_engine = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_CLEAN, 'false').lower() == 'true' self.requires_fullframe_engine = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_FULLFRAME, 'false').lower() == 'true' self.requires_persistent_engine = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_PERSISTENT, 'false').lower() == 'true' # determine if engine is required to run on main thread # MDATA_ENGINE_MAINTHREAD is the generic option rme = self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_MAINTHREAD, 'false') == 'true' # MDATA_ENGINE_DYNAMO_AUTOMATE is specific naming for dynamo automate = self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_DYNAMO_AUTOMATE, 'false') == 'true' self.requires_mainthread_engine = rme or automate # process engine options specific to dynamo self.dynamo_path = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_DYNAMO_PATH, None) # self.dynamo_path_exec = \ # self.meta[exts.MDATA_ENGINE].get( # exts.MDATA_ENGINE_DYNAMO_PATH_EXEC, 'true') == 'true' self.dynamo_path_check_existing = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_DYNAMO_PATH_CHECK_EXIST, 'false') == 'true' self.dynamo_force_manual_run = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_DYNAMO_FORCE_MANUAL_RUN, 'false') == 'true' self.dynamo_model_nodes_info = \ self.meta[exts.MDATA_ENGINE].get( exts.MDATA_ENGINE_DYNAMO_MODEL_NODES_INFO, None) # panel buttons should be active always if self.type_id == exts.PANEL_PUSH_BUTTON_POSTFIX: self.context = exts.CTX_ZERODOC[0] else: self.context = \ self.meta.get(exts.MDATA_COMMAND_CONTEXT, None) if isinstance(self.context, list): self.context = coreutils.join_strings(self.context) if self.context and exts.CTX_ZERODOC[1] in self.context: mlogger.deprecate( "\"zerodoc\" context is deprecated. " "use \"zero-doc\" instead. | %s", self)
def create_bundle_type( module_builder, type_name, bundle_script, bundle_config_script, bundle_search_paths, bundle_arguments, bundle_help_url, bundle_tooltip, bundle_name, bundle_full_name, bundle_extension_name, bundle_unique_name, bundle_control_id, engine_cfgs, ): runtime.create_type(module_builder, runtime.CMD_EXECUTOR_TYPE, type_name, runtime.create_ext_command_attrs(), bundle_script, bundle_config_script, coreutils.join_strings(bundle_search_paths), coreutils.join_strings(bundle_arguments), bundle_help_url, bundle_tooltip, bundle_name, bundle_full_name, bundle_extension_name, bundle_unique_name, bundle_control_id, engine_cfgs)
def _make_python_types(extension, module_builder, cmd_component): """ Args: module_builder: cmd_component (pyrevit.extensions.genericcomps.GenericUICommand): Returns: """ logger.debug('Creating executor type for: {}'.format(cmd_component)) create_type(module_builder, CMD_EXECUTOR_TYPE, cmd_component.unique_name, create_ext_command_attrs(), cmd_component.get_full_script_address(), cmd_component.get_full_config_script_address(), join_strings(cmd_component.get_search_paths()), cmd_component.name, cmd_component.bundle_name, extension.name, cmd_component.unique_name) logger.debug( 'Successfully created executor type for: {}'.format(cmd_component)) cmd_component.class_name = cmd_component.unique_name # create command availability class for this command if cmd_component.cmd_context: try: logger.debug( 'Creating availability type for: {}'.format(cmd_component)) cmd_component.avail_class_name = \ _make_python_avail_type(module_builder, cmd_component) logger.debug( 'Successfully created availability type for: {}'.format( cmd_component)) except Exception as cmd_avail_err: cmd_component.avail_class_name = None logger.error('Error creating availability type: {} | {}'.format( cmd_component, cmd_avail_err))
def _read_bundle_metadata_from_python_script(self): try: # reading script file content to extract parameters script_content = \ coreutils.ScriptFileParser(self.script_file) self._ui_title = \ script_content.extract_param(exts.UI_TITLE_PARAM) \ or self._ui_title script_docstring = script_content.get_docstring() custom_docstring = \ script_content.extract_param(exts.DOCSTRING_PARAM) self._tooltip = \ custom_docstring or script_docstring or self._tooltip script_author = script_content.extract_param(exts.AUTHOR_PARAM) script_author = script_content.extract_param(exts.AUTHORS_PARAM) if isinstance(script_author, list): script_author = '\n'.join(script_author) self.author = script_author or self.author # extracting min requried Revit and pyRevit versions self.max_revit_ver = \ script_content.extract_param(exts.MAX_REVIT_VERSION_PARAM) \ or self.max_revit_ver self.min_revit_ver = \ script_content.extract_param(exts.MIN_REVIT_VERSION_PARAM) \ or self.min_revit_ver self._help_url = \ script_content.extract_param(exts.COMMAND_HELP_URL_PARAM) \ or self._help_url self.is_beta = \ script_content.extract_param(exts.BETA_SCRIPT_PARAM) \ or self.is_beta self.highlight_type = \ script_content.extract_param(exts.HIGHLIGHT_SCRIPT_PARAM) \ or self.highlight_type # only True when command is specifically asking for # a clean engine or a fullframe engine. False if not set. self.requires_clean_engine = \ script_content.extract_param(exts.CLEAN_ENGINE_SCRIPT_PARAM) \ or False self.requires_fullframe_engine = \ script_content.extract_param(exts.FULLFRAME_ENGINE_PARAM) \ or False self.requires_persistent_engine = \ script_content.extract_param(exts.PERSISTENT_ENGINE_PARAM) \ or False # panel buttons should be active always if self.type_id == exts.PANEL_PUSH_BUTTON_POSTFIX: self.context = exts.CTX_ZERODOC[0] else: self.context = \ script_content.extract_param(exts.COMMAND_CONTEXT_PARAM) if isinstance(self.context, list): self.context = coreutils.join_strings(self.context) if self.context and exts.CTX_ZERODOC[1] in self.context: mlogger.deprecate( "\"zerodoc\" context is deprecated. " "use \"zero-doc\" instead. | %s", self) except Exception as parse_err: mlogger.log_parse_except(self.script_file, parse_err)
cloudcount_dataset = chart.data.new_dataset('Revision Cloud Count') cloudcount_dataset.set_color('black') cloudcount_dataset.data = [rs.cloud_count for rs in revised_sheets if rs.cloud_count > 0] chart.draw() # print info on sheets for rev_sheet in revised_sheets: if rev_sheet.rev_count > 0: console.print_md( '** Sheet {}: {}**\n\n' 'Revision Count: {}\n\n' 'Revision Cloud Count: {}\n\n' 'Revision Numbers: {}' .format(rev_sheet.sheet_number, rev_sheet.sheet_name, rev_sheet.rev_count, rev_sheet.cloud_count, coreutils.join_strings(rev_sheet.get_revision_numbers(), separator=','))) comments = rev_sheet.get_comments() if comments: print('\t\tRevision comments:\n{}' .format('\n'.join(['\t\t{}'.format(cmt) for cmt in comments]))) console.insert_divider()