Addon Manager: Protect refs to QRegularExpressionValidator
This commit is contained in:
@@ -30,9 +30,24 @@ import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
from PySide2.QtWidgets import QFileDialog, QDialog
|
||||
from PySide2.QtGui import QDesktopServices, QRegularExpressionValidator
|
||||
from PySide2.QtGui import QDesktopServices
|
||||
from PySide2.QtCore import QUrl, QFile, QRegularExpression, QIODevice
|
||||
|
||||
try:
|
||||
from PySide2.QtGui import (
|
||||
QRegularExpressionValidator,
|
||||
)
|
||||
from PySide2.QtCore import QRegularExpression
|
||||
RegexWrapper = QRegularExpression
|
||||
RegexValidatorWrapper = QRegularExpressionValidator
|
||||
except ImportError:
|
||||
from PySide2.QtGui import (
|
||||
QRegExpValidator,
|
||||
)
|
||||
from PySide2.QtCore import QRegExp
|
||||
RegexWrapper = QRegExp
|
||||
RegexValidatorWrapper = QRegExpValidator
|
||||
|
||||
translate = FreeCAD.Qt.translate
|
||||
|
||||
|
||||
@@ -243,7 +258,7 @@ class LicenseSelector:
|
||||
)
|
||||
)
|
||||
info_dlg.yearLineEdit.setValidator(
|
||||
QRegularExpressionValidator(QRegularExpression("^[12]\\d{3}$"))
|
||||
RegexValidatorWrapper(RegexWrapper("^[12]\\d{3}$"))
|
||||
)
|
||||
info_dlg.yearLineEdit.setText(str(date.today().year))
|
||||
result = info_dlg.exec()
|
||||
|
||||
@@ -26,7 +26,6 @@ import keyword
|
||||
|
||||
from PySide2.QtGui import (
|
||||
QValidator,
|
||||
QRegularExpressionValidator,
|
||||
)
|
||||
|
||||
# QRegularExpressionValidator was only added at the very end of the PySide2
|
||||
|
||||
Reference in New Issue
Block a user