6 """ |
6 """ |
7 Module implementing a dialog to show the output of the svn proplist command |
7 Module implementing a dialog to show the output of the svn proplist command |
8 process. |
8 process. |
9 """ |
9 """ |
10 |
10 |
11 |
11 import re |
12 from PyQt5.QtCore import ( |
12 |
13 pyqtSlot, QTimer, QProcess, QProcessEnvironment, QRegExp, Qt |
13 from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QProcess, QProcessEnvironment |
14 ) |
|
15 from PyQt5.QtWidgets import ( |
14 from PyQt5.QtWidgets import ( |
16 QWidget, QHeaderView, QDialogButtonBox, QTreeWidgetItem |
15 QWidget, QHeaderView, QDialogButtonBox, QTreeWidgetItem |
17 ) |
16 ) |
18 |
17 |
19 from E5Gui import E5MessageBox |
18 from E5Gui import E5MessageBox |
57 |
56 |
58 self.process.finished.connect(self.__procFinished) |
57 self.process.finished.connect(self.__procFinished) |
59 self.process.readyReadStandardOutput.connect(self.__readStdout) |
58 self.process.readyReadStandardOutput.connect(self.__readStdout) |
60 self.process.readyReadStandardError.connect(self.__readStderr) |
59 self.process.readyReadStandardError.connect(self.__readStderr) |
61 |
60 |
62 self.rx_path = QRegExp(r"Properties on '([^']+)':\s*") |
61 self.rx_path = re.compile(r"Properties on '([^']+)':\s*") |
63 self.rx_prop = QRegExp(r" (.*) *: *(.*)[\r\n]") |
62 self.rx_prop = re.compile(r" (.*) *: *(.*)[\r\n]") |
64 |
63 |
65 def __resort(self): |
64 def __resort(self): |
66 """ |
65 """ |
67 Private method to resort the tree. |
66 Private method to resort the tree. |
68 """ |
67 """ |
221 |
220 |
222 while self.process.canReadLine(): |
221 while self.process.canReadLine(): |
223 s = str(self.process.readLine(), |
222 s = str(self.process.readLine(), |
224 Preferences.getSystem("IOEncoding"), |
223 Preferences.getSystem("IOEncoding"), |
225 'replace') |
224 'replace') |
226 if self.rx_path.exactMatch(s): |
225 match = self.rx_path.fullmatch(s) or self.rx_prop.fullmatch(s) |
|
226 if match is None: |
|
227 self.propBuffer += ' ' |
|
228 self.propBuffer += s |
|
229 elif match.re is self.rx_path: |
227 if self.lastProp: |
230 if self.lastProp: |
228 self.__generateItem( |
231 self.__generateItem( |
229 self.lastPath, self.lastProp, self.propBuffer) |
232 self.lastPath, self.lastProp, self.propBuffer) |
230 self.lastPath = self.rx_path.cap(1) |
233 self.lastPath = match.group(1) |
231 self.lastProp = None |
234 self.lastProp = None |
232 self.propBuffer = "" |
235 self.propBuffer = "" |
233 elif self.rx_prop.exactMatch(s): |
236 elif match.re is self.rx_prop: |
234 if self.lastProp: |
237 if self.lastProp: |
235 self.__generateItem( |
238 self.__generateItem( |
236 self.lastPath, self.lastProp, self.propBuffer) |
239 self.lastPath, self.lastProp, self.propBuffer) |
237 self.lastProp = self.rx_prop.cap(1) |
240 self.lastProp = match.group(1) |
238 self.propBuffer = self.rx_prop.cap(2) |
241 self.propBuffer = match.group(2) |
239 else: |
242 |
240 self.propBuffer += ' ' |
|
241 self.propBuffer += s |
|
242 |
|
243 def __readStderr(self): |
243 def __readStderr(self): |
244 """ |
244 """ |
245 Private slot to handle the readyReadStandardError signal. |
245 Private slot to handle the readyReadStandardError signal. |
246 |
246 |
247 It reads the error output of the process and inserts it into the |
247 It reads the error output of the process and inserts it into the |