addonmanager_utilities Namespace Reference

Functions

str attention_color_string ()
 
str bright_color_string ()
 
def construct_git_url (repo, filename)
 
Optional[strget_assigned_string_literal (str line)
 
def get_desc_regex (repo)
 
str get_macro_version_from_file (str filename)
 
def get_metadata_url (url)
 
def get_readme_html_url (repo)
 
def get_readme_url (repo)
 
def get_zip_url (repo)
 
bool is_darkmode ()
 
bool is_float (Any element)
 
bool recognized_git_location (repo)
 
def remove_directory_if_empty (dir)
 
None repair_git_repo (str repo_url, str clone_dir)
 
def restart_freecad ()
 
def symlink (source, link_name)
 
def update_macro_details (old_macro, new_macro)
 
None update_macro_installation_details (repo)
 
str warning_color_string ()
 

Variables

 translate = FreeCAD.Qt.translate
 

Function Documentation

◆ attention_color_string()

str addonmanager_utilities.attention_color_string ( )
A shade of orange, adapted to darkmode if possible. Targets a minimum 7:1 contrast ratio.

References is_darkmode().

◆ bright_color_string()

str addonmanager_utilities.bright_color_string ( )
A shade of green, adapted to darkmode if possible. Targets a minimum 7:1 contrast ratio.

References is_darkmode().

◆ construct_git_url()

def addonmanager_utilities.construct_git_url (   repo,
  filename 
)
Returns a direct download link to a file in an online Git repo

Referenced by get_metadata_url(), and get_readme_url().

◆ get_assigned_string_literal()

Optional[str] addonmanager_utilities.get_assigned_string_literal ( str  line)
Look for a line of the form my_var = "A string literal" and return the string literal.
If the assignment is of a floating point value, that value is converted to a string
and returned. If neither is true, returns None.

References is_float().

Referenced by get_macro_version_from_file().

◆ get_desc_regex()

def addonmanager_utilities.get_desc_regex (   repo)
Returns a regex string that extracts a WB description to be displayed in the description
panel of the Addon manager, if the README could not be found

◆ get_macro_version_from_file()

str addonmanager_utilities.get_macro_version_from_file ( str  filename)
Get the version of the macro from a local macro file. Supports strings, ints, and floats, as
well as a reference to __date__

References get_assigned_string_literal().

Referenced by update_macro_installation_details().

◆ get_metadata_url()

def addonmanager_utilities.get_metadata_url (   url)
Returns the location of a package.xml metadata file

References construct_git_url().

◆ get_readme_html_url()

def addonmanager_utilities.get_readme_html_url (   repo)
Returns the location of a html file containing readme

◆ get_readme_url()

def addonmanager_utilities.get_readme_url (   repo)
Returns the location of a readme file

References construct_git_url().

◆ get_zip_url()

def addonmanager_utilities.get_zip_url (   repo)
Returns the location of a zip file from a repo, if available

◆ is_darkmode()

bool addonmanager_utilities.is_darkmode ( )
Heuristics to determine if we are in a darkmode stylesheet

Referenced by attention_color_string(), bright_color_string(), and warning_color_string().

◆ is_float()

bool addonmanager_utilities.is_float ( Any  element)

◆ recognized_git_location()

bool addonmanager_utilities.recognized_git_location (   repo)
Returns whether this repo is based at a known git repo location: works with github, gitlab, framagit, and salsa.debian.org

◆ remove_directory_if_empty()

def addonmanager_utilities.remove_directory_if_empty (   dir)
Remove the directory if it is empty

Directory FreeCAD.getUserMacroDir(True) will not be removed even if empty.

◆ repair_git_repo()

None addonmanager_utilities.repair_git_repo ( str  repo_url,
str  clone_dir 
)

◆ restart_freecad()

def addonmanager_utilities.restart_freecad ( )
Shuts down and restarts FreeCAD

◆ symlink()

def addonmanager_utilities.symlink (   source,
  link_name 
)
Creates a symlink of a file, if possible. Note that it fails on most modern Windows installations

◆ update_macro_details()

def addonmanager_utilities.update_macro_details (   old_macro,
  new_macro 
)
Update a macro with information from another one

Update a macro with information from another one, supposedly the same but
from a different source. The first source is supposed to be git, the second
one the wiki.

◆ update_macro_installation_details()

None addonmanager_utilities.update_macro_installation_details (   repo)

◆ warning_color_string()

str addonmanager_utilities.warning_color_string ( )
A shade of red, adapted to darkmode if possible. Targets a minimum 7:1 contrast ratio.

References is_darkmode().

Variable Documentation

◆ translate

addonmanager_utilities.translate = FreeCAD.Qt.translate