Skip to content

Commit

Permalink
[BUG] support PyQt5 removal of QUrl query delimiter methods
Browse files Browse the repository at this point in the history
[MNT] version up to 0.12.1
  • Loading branch information
mds-dwa committed Nov 18, 2021
1 parent 383217d commit e2b57c6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions usdmanager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,29 @@ def qUrlPath(self):
return self.toString(QtCore.QUrl.PrettyDecoded | QtCore.QUrl.RemoveQuery)

QtCore.QUrl.path = qUrlPath
elif Qt.IsPyQt5:
# Add query pair/value delimiters until we move fully onto Qt5 and switch to the QUrlQuery class.
def queryPairDelimiter(self):
try:
return self._queryPairDelimiter
except AttributeError:
self._queryPairDelimiter = "&"
return self._queryPairDelimiter

def queryValueDelimiter(self):
try:
return self._queryValueDelimiter
except AttributeError:
self._queryValueDelimiter = "="
return self._queryValueDelimiter

def setQueryDelimiters(self, valueDelimiter, pairDelimiter):
self._queryValueDelimiter = valueDelimiter
self._queryPairDelimiter = pairDelimiter

QtCore.QUrl.queryPairDelimiter = queryPairDelimiter
QtCore.QUrl.queryValueDelimiter = queryValueDelimiter
QtCore.QUrl.setQueryDelimiters = setQueryDelimiters
elif Qt.IsPySide or Qt.IsPyQt4:
# Add basic support for QUrl.setQuery to PySide and PyQt4 (added in Qt5).
def qUrlSetQuery(self, query, mode=QtCore.QUrl.TolerantMode):
Expand Down
2 changes: 1 addition & 1 deletion usdmanager/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = '0.12.0'
__version__ = '0.12.1'

0 comments on commit e2b57c6

Please sign in to comment.