13 except NameError: |
13 except NameError: |
14 pass |
14 pass |
15 |
15 |
16 import os |
16 import os |
17 |
17 |
18 from PyQt5.QtCore import pyqtSlot, QProcess, QTimer, QUrl |
18 from PyQt5.QtCore import pyqtSlot, QProcess, QTimer, QUrl, QByteArray, \ |
|
19 qVersion |
19 from PyQt5.QtGui import QTextCursor |
20 from PyQt5.QtGui import QTextCursor |
20 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QApplication, QLineEdit |
21 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QApplication, QLineEdit |
21 |
22 |
22 from E5Gui.E5Application import e5App |
23 from E5Gui.E5Application import e5App |
23 from E5Gui import E5MessageBox |
24 from E5Gui import E5MessageBox |
338 parents = self.__getParents(rev) |
339 parents = self.__getParents(rev) |
339 for parent in parents: |
340 for parent in parents: |
340 url = QUrl() |
341 url = QUrl() |
341 url.setScheme("file") |
342 url.setScheme("file") |
342 url.setPath(self.filename) |
343 url.setPath(self.filename) |
343 query = parent.split(":")[0] + '_' + rev |
344 if qVersion() >= "5.0.0": |
344 url.setQuery(query) |
345 query = parent.split(":")[0] + '_' + rev |
|
346 url.setQuery(query) |
|
347 else: |
|
348 query = QByteArray() |
|
349 query.append(parent.split(":")[0]).append('_').append(rev) |
|
350 url.setEncodedQuery(query) |
345 dstr += ' [<a href="{0}" name="{1}" id="{1}">{2}</a>]'.format( |
351 dstr += ' [<a href="{0}" name="{1}" id="{1}">{2}</a>]'.format( |
346 url.toString(), query, |
352 url.toString(), query, |
347 self.tr('diff to {0}').format(parent), |
353 self.tr('diff to {0}').format(parent), |
348 ) |
354 ) |
349 dstr += '<br />\n' |
355 dstr += '<br />\n' |
485 """ |
491 """ |
486 filename = url.path() |
492 filename = url.path() |
487 if Utilities.isWindowsPlatform(): |
493 if Utilities.isWindowsPlatform(): |
488 if filename.startswith("/"): |
494 if filename.startswith("/"): |
489 filename = filename[1:] |
495 filename = filename[1:] |
490 ver = url.query() |
496 if qVersion() >= "5.0.0": |
|
497 ver = url.query() |
|
498 else: |
|
499 ver = bytes(url.encodedQuery()).decode() |
491 v1, v2 = ver.split('_') |
500 v1, v2 = ver.split('_') |
492 if v1 == "" or v2 == "": |
501 if v1 == "" or v2 == "": |
493 return |
502 return |
494 self.contents.scrollToAnchor(ver) |
503 self.contents.scrollToAnchor(ver) |
495 |
504 |