Rather than manually parsing the output from the repo's host, the Addon Manager
now uses an embedded QWebEngineView to display the README data. This makes the
display more repo-location agnostic (rather than trying to parse the specific
code from GitHub, Gitlab, etc.). Special handling of known hosts is still
provided to improve the display of the page, but it is not required. Clicking a
link on the page still loads in a new system browser window, with the exception
of links to the FreeCAD wiki, which are loaded in the same browser. This is
expected to be used primarily to access traslated pages for Macros, so no
advanced web-browsing features are displayed (e.g. back buttons, history
access, etc.).
pylupdate does not extract translations when f-strings are used for the
translated text, so all f-strings are migrated to calls to format().
Several other minor translation issues are also addressed.
NOTE: This code has been run through the Black reformatter, which adds
trailing commas in many places that the stock Qt 5.x pylupdate does not
recognize. This code must be processed with the corrected pylupdate to
generate the correct translations.
To enable single-login authenticated proxy use, and simplified multi-threaded
network accesses, this commit adds a new wrapper around a QNetworkAccessManager
and includes a global instantiation of the class intended to exist for the
lifetime of the program. This instance can be used to enqueue any number of
network requests, which the manager will send out to the networking subsystem
in an appropriate manner.
Addon Manager: Dependency Installation
The Addon Manager can now attempt to use pip directly to install
required packages as specified in either metadata.txt or
requirements.txt files provided by AddOns. The packages are installed
into FreeCAD.getUserAppDataDir()/AdditionalPythonPackages directory.
Only simplified requirements.txt data is supported: any version
information is stripped out, and only packages are supported (that is,
no pip arguments, included files, etc.). Further, packages are checked
against a list of allowed packages prior to being suggested for
installation. Addon authors should submit a PR to the FreeCAD repo
adding their requirements to the allowed list, for packages that are not
already on the list (this is a malware-prevention mechanism).
The pyrate has moved to salsa.debian.org, so this commit adds the
beginnings of support for those repos.The Markdown library is required
for nice rendering of repos that don't have a package.xml metadata file.
This shifts to use the model-view-controller pattern for the list of addons,
and moves to using a full model class rather than an indexed array for the
data storage and management. This enables much more information to be stored
as part of the new AddonManagerRepo data type. It now wraps the Macro class
for macros, supports Preference Packs, and provides access to the Metadata
object.
The URLs used to detect whether a repo is at github, gitlab, or framagit
could potentially be mis-detected by a maliciously-crafted URL,
resulting in incorrect detection of the README file, etc. To silence the
LGTM warning about this, proper URL sanitization and comparison is now
used.
Update formatting in compliance with pep8 with the following exceptions:
* truncate to 120 characters in line
* prefer double quotes `"` to single quotes `'` in strings
Switch addon lookup mechanism from parsing html page to extracting info
from .gitmodules file.
This simplifies logic and allows using non-Github repos.
Readme for Github repos are extracted from HTML pages using regex.
Gitlab pages are converted to HTML using Python Markdown lib if present,
falling back to displaying raw markdown.
In this case image links are converted from relative to absolute paths.
Correct crash when Macro description is not reachable
Python crashed when under proxy - Macro list is charged - Proxy is undone ( internet connection lost) - Try to load macro description (u=None)
Add Proxy setting in Addon Manager Option UI
Correction of SSL context
Replace ssl.Purpose.CLIENT_AUTH by ssl.Purpose.SERVER_AUTH as context for a client
Add configuration of proxy setting UI
Add proxy management by urllib
Separate the Macro class of the AddonManager into addonmanager_macro.py
to prepare for future support for dependent files for macros from the
git repository.