def __init_from_dir__(self, package_dir): GenericUIContainer.__init_from_dir__(self, package_dir) self.pyrvt_version = get_pyrevit_version().get_formatted() self.dir_hash_value = self._read_dir_hash() if not self.dir_hash_value: self.dir_hash_value = self._calculate_extension_dir_hash()
def _update_from_directory(self): #pylint: disable=W0221 # using classname otherwise exceptions in superclasses won't show GenericUIContainer._update_from_directory(self) self.pyrvt_version = versionmgr.get_pyrevit_version().get_formatted() # extensions can store event hooks under # hooks/ inside the component folder hooks_path = op.join(self.directory, exts.COMP_HOOKS_DIR_NAME) self.hooks_path = hooks_path if op.exists(hooks_path) else None self.dir_hash_value = self._calculate_extension_dir_hash()
def __init__(self, cmp_path=None): # using classname otherwise exceptions in superclasses won't show GenericUIContainer.__init__(self, cmp_path=cmp_path) self.panel_background = \ self.title_background = \ self.slideout_background = None # read metadata from metadata file if self.meta: # check for background color configs self.panel_background = \ self.meta.get(exts.MDATA_BACKGROUND_KEY, None) if self.panel_background: if isinstance(self.panel_background, dict): self.title_background = self.panel_background.get( exts.MDATA_BACKGROUND_TITLE_KEY, None) self.slideout_background = self.panel_background.get( exts.MDATA_BACKGROUND_SLIDEOUT_KEY, None) self.panel_background = self.panel_background.get( exts.MDATA_BACKGROUND_PANEL_KEY, None) elif not isinstance(self.panel_background, str): mlogger.error("%s bad background definition in metadata.", self)
def contains(self, item_name): # Panels contain stacks. But stacks itself does not have any ui and its subitems are displayed within the ui of # the parent panel. This is different from pulldowns and other button groups. Button groups, contain and display # their sub components in their own drop down menu. # So when checking if panel has a button, panel should check all the items visible to the user and respond. item_exists = GenericUIContainer.contains(self, item_name) if item_exists: return True else: # if child is a stack item, check its children too for component in self._sub_components: if isinstance(component, GenericStack) and component.contains(item_name): return True
def __init__(self, cmp_path=None): self.pyrvt_version = None self.dir_hash_value = None # using classname otherwise exceptions in superclasses won't show GenericUIContainer.__init__(self, cmp_path=cmp_path)
def __init__(self): GenericUIContainer.__init__(self) self.author = None self.version = None self.pyrvt_version = self.dir_hash_value = None
def __init_from_dir__(self, package_dir): GenericUIContainer.__init_from_dir__(self, package_dir) self.pyrvt_version = PYREVIT_VERSION.get_formatted() self.dir_hash_value = self._calculate_extension_dir_hash()