Addon Manager: Refactor installation code

Improve testability of installation code by refactoring it to completely
separate the GUI and non-GUI code, and to provide more robust support
for non-GUI access to some type of Addon Manager activity.
This commit is contained in:
Chris Hennes
2022-11-18 18:51:04 -06:00
parent 98cdd47e5f
commit 611e13305b
46 changed files with 4012 additions and 1666 deletions

View File

@@ -35,6 +35,7 @@ try:
QRegularExpressionValidator,
)
from PySide.QtCore import QRegularExpression
RegexWrapper = QRegularExpression
RegexValidatorWrapper = QRegularExpressionValidator
except ImportError:
@@ -42,11 +43,13 @@ except ImportError:
QRegExpValidator,
)
from PySide.QtCore import QRegExp
RegexWrapper = QRegExp
RegexValidatorWrapper = QRegExpValidator
#pylint: disable=too-few-public-methods
# pylint: disable=too-few-public-methods
class NameValidator(QValidator):
"""Simple validator to exclude characters that are not valid in filenames."""
@@ -73,7 +76,7 @@ class PythonIdentifierValidator(QValidator):
"""Validates whether input is a valid Python identifier."""
def validate(self, value: str, _: int):
""" The function that does the validation. """
"""The function that does the validation."""
if not value:
return QValidator.Intermediate
@@ -130,7 +133,6 @@ class CalVerValidator(RegexValidatorWrapper):
else:
self.setRegExp(CalVerValidator.calver_re)
@classmethod
def check(cls, value: str) -> bool:
"""Returns true if value validates, and false if not"""