11 import sys |
11 import sys |
12 |
12 |
13 from PyQt4.QtCore import * |
13 from PyQt4.QtCore import * |
14 from PyQt4.QtGui import * |
14 from PyQt4.QtGui import * |
15 |
15 |
16 from Ui_SvnLogDialog import Ui_SvnLogDialog |
16 from .Ui_SvnLogDialog import Ui_SvnLogDialog |
17 from SvnDiffDialog import SvnDiffDialog |
17 from .SvnDiffDialog import SvnDiffDialog |
18 |
18 |
19 import Utilities |
19 import Utilities |
|
20 import Preferences |
20 |
21 |
21 class SvnLogDialog(QWidget, Ui_SvnLogDialog): |
22 class SvnLogDialog(QWidget, Ui_SvnLogDialog): |
22 """ |
23 """ |
23 Class implementing a dialog to show the output of the svn log command process. |
24 Class implementing a dialog to show the output of the svn log command process. |
24 |
25 |
219 It reads the output of the process and inserts it into a buffer. |
220 It reads the output of the process and inserts it into a buffer. |
220 """ |
221 """ |
221 self.process.setReadChannel(QProcess.StandardOutput) |
222 self.process.setReadChannel(QProcess.StandardOutput) |
222 |
223 |
223 while self.process.canReadLine(): |
224 while self.process.canReadLine(): |
224 line = unicode(self.process.readLine()) |
225 line = str(self.process.readLine(), |
|
226 Preferences.getSystem("IOEncoding"), |
|
227 'replace') |
225 self.buf.append(line) |
228 self.buf.append(line) |
226 if self.rx_rev.exactMatch(line): |
229 if self.rx_rev.exactMatch(line): |
227 ver = self.rx_rev.cap(1) |
230 ver = self.rx_rev.cap(1) |
228 # save revision number for later use |
231 # save revision number for later use |
229 self.revisions.append(ver) |
232 self.revisions.append(ver) |
239 It reads the error output of the process and inserts it into the |
242 It reads the error output of the process and inserts it into the |
240 error pane. |
243 error pane. |
241 """ |
244 """ |
242 if self.process is not None: |
245 if self.process is not None: |
243 self.errorGroup.show() |
246 self.errorGroup.show() |
244 s = unicode(self.process.readAllStandardError()) |
247 s = str(self.process.readAllStandardError(), |
|
248 Preferences.getSystem("IOEncoding"), |
|
249 'replace') |
245 self.errors.insertPlainText(s) |
250 self.errors.insertPlainText(s) |
246 self.errors.ensureCursorVisible() |
251 self.errors.ensureCursorVisible() |
247 |
252 |
248 def __sourceChanged(self, url): |
253 def __sourceChanged(self, url): |
249 """ |
254 """ |
254 self.contents.setSource(QUrl('')) |
259 self.contents.setSource(QUrl('')) |
255 filename = url.path() |
260 filename = url.path() |
256 if Utilities.isWindowsPlatform(): |
261 if Utilities.isWindowsPlatform(): |
257 if filename.startswith("/"): |
262 if filename.startswith("/"): |
258 filename = filename[1:] |
263 filename = filename[1:] |
259 ver = unicode(url.encodedQuery()) |
264 ver = str(url.encodedQuery()) |
260 v1 = ver.split('_')[0] |
265 v1 = ver.split('_')[0] |
261 v2 = ver.split('_')[1] |
266 v2 = ver.split('_')[1] |
262 if v1 == "" or v2 == "": |
267 if v1 == "" or v2 == "": |
263 return |
268 return |
264 self.contents.scrollToAnchor(ver) |
269 self.contents.scrollToAnchor(ver) |