111 self.filesCombo.clear() |
111 self.filesCombo.clear() |
112 |
112 |
113 args = [] |
113 args = [] |
114 if qdiff: |
114 if qdiff: |
115 args.append('qdiff') |
115 args.append('qdiff') |
116 self.setWindowTitle(self.trUtf8("Patch Contents")) |
116 self.setWindowTitle(self.tr("Patch Contents")) |
117 else: |
117 else: |
118 args.append('diff') |
118 args.append('diff') |
119 self.vcs.addArguments(args, self.vcs.options['global']) |
119 self.vcs.addArguments(args, self.vcs.options['global']) |
120 self.vcs.addArguments(args, self.vcs.options['diff']) |
120 self.vcs.addArguments(args, self.vcs.options['diff']) |
121 |
121 |
192 QApplication.restoreOverrideCursor() |
192 QApplication.restoreOverrideCursor() |
193 self.inputGroup.setEnabled(False) |
193 self.inputGroup.setEnabled(False) |
194 self.inputGroup.hide() |
194 self.inputGroup.hide() |
195 E5MessageBox.critical( |
195 E5MessageBox.critical( |
196 self, |
196 self, |
197 self.trUtf8('Process Generation Error'), |
197 self.tr('Process Generation Error'), |
198 self.trUtf8( |
198 self.tr( |
199 'The process {0} could not be started. ' |
199 'The process {0} could not be started. ' |
200 'Ensure, that it is in the search path.' |
200 'Ensure, that it is in the search path.' |
201 ).format('hg')) |
201 ).format('hg')) |
202 |
202 |
203 def __procFinished(self, exitCode, exitStatus): |
203 def __procFinished(self, exitCode, exitStatus): |
218 self.inputGroup.setEnabled(False) |
218 self.inputGroup.setEnabled(False) |
219 self.inputGroup.hide() |
219 self.inputGroup.hide() |
220 |
220 |
221 if self.paras == 0: |
221 if self.paras == 0: |
222 self.contents.insertPlainText( |
222 self.contents.insertPlainText( |
223 self.trUtf8('There is no difference.')) |
223 self.tr('There is no difference.')) |
224 return |
224 return |
225 |
225 |
226 self.buttonBox.button(QDialogButtonBox.Save).setEnabled(True) |
226 self.buttonBox.button(QDialogButtonBox.Save).setEnabled(True) |
227 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
227 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
228 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
228 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
231 tc = self.contents.textCursor() |
231 tc = self.contents.textCursor() |
232 tc.movePosition(QTextCursor.Start) |
232 tc.movePosition(QTextCursor.Start) |
233 self.contents.setTextCursor(tc) |
233 self.contents.setTextCursor(tc) |
234 self.contents.ensureCursorVisible() |
234 self.contents.ensureCursorVisible() |
235 |
235 |
236 self.filesCombo.addItem(self.trUtf8("<Start>"), 0) |
236 self.filesCombo.addItem(self.tr("<Start>"), 0) |
237 self.filesCombo.addItem(self.trUtf8("<End>"), -1) |
237 self.filesCombo.addItem(self.tr("<End>"), -1) |
238 for oldFile, newFile, pos in sorted(self.__fileSeparators): |
238 for oldFile, newFile, pos in sorted(self.__fileSeparators): |
239 if oldFile != newFile: |
239 if oldFile != newFile: |
240 self.filesCombo.addItem( |
240 self.filesCombo.addItem( |
241 "{0}\n{1}".format(oldFile, newFile), pos) |
241 "{0}\n{1}".format(oldFile, newFile), pos) |
242 else: |
242 else: |
403 else: |
403 else: |
404 fname = self.vcs.splitPath(self.filename)[0] |
404 fname = self.vcs.splitPath(self.filename)[0] |
405 |
405 |
406 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
406 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
407 self, |
407 self, |
408 self.trUtf8("Save Diff"), |
408 self.tr("Save Diff"), |
409 fname, |
409 fname, |
410 self.trUtf8("Patch Files (*.diff)"), |
410 self.tr("Patch Files (*.diff)"), |
411 None, |
411 None, |
412 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
412 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
413 |
413 |
414 if not fname: |
414 if not fname: |
415 return # user aborted |
415 return # user aborted |
420 if ex: |
420 if ex: |
421 fname += ex |
421 fname += ex |
422 if QFileInfo(fname).exists(): |
422 if QFileInfo(fname).exists(): |
423 res = E5MessageBox.yesNo( |
423 res = E5MessageBox.yesNo( |
424 self, |
424 self, |
425 self.trUtf8("Save Diff"), |
425 self.tr("Save Diff"), |
426 self.trUtf8("<p>The patch file <b>{0}</b> already exists." |
426 self.tr("<p>The patch file <b>{0}</b> already exists." |
427 " Overwrite it?</p>").format(fname), |
427 " Overwrite it?</p>").format(fname), |
428 icon=E5MessageBox.Warning) |
428 icon=E5MessageBox.Warning) |
429 if not res: |
429 if not res: |
430 return |
430 return |
431 fname = Utilities.toNativeSeparators(fname) |
431 fname = Utilities.toNativeSeparators(fname) |
432 |
432 |
435 f = open(fname, "w", encoding="utf-8", newline="") |
435 f = open(fname, "w", encoding="utf-8", newline="") |
436 f.write(eol.join(self.contents.toPlainText().splitlines())) |
436 f.write(eol.join(self.contents.toPlainText().splitlines())) |
437 f.close() |
437 f.close() |
438 except IOError as why: |
438 except IOError as why: |
439 E5MessageBox.critical( |
439 E5MessageBox.critical( |
440 self, self.trUtf8('Save Diff'), |
440 self, self.tr('Save Diff'), |
441 self.trUtf8( |
441 self.tr( |
442 '<p>The patch file <b>{0}</b> could not be saved.' |
442 '<p>The patch file <b>{0}</b> could not be saved.' |
443 '<br>Reason: {1}</p>') |
443 '<br>Reason: {1}</p>') |
444 .format(fname, str(why))) |
444 .format(fname, str(why))) |
445 |
445 |
446 def on_passwordCheckBox_toggled(self, isOn): |
446 def on_passwordCheckBox_toggled(self, isOn): |