174 if not procStarted: |
174 if not procStarted: |
175 self.inputGroup.setEnabled(False) |
175 self.inputGroup.setEnabled(False) |
176 self.inputGroup.hide() |
176 self.inputGroup.hide() |
177 E5MessageBox.critical( |
177 E5MessageBox.critical( |
178 self, |
178 self, |
179 self.trUtf8('Process Generation Error'), |
179 self.tr('Process Generation Error'), |
180 self.trUtf8( |
180 self.tr( |
181 'The process {0} could not be started. ' |
181 'The process {0} could not be started. ' |
182 'Ensure, that it is in the search path.' |
182 'Ensure, that it is in the search path.' |
183 ).format('svn')) |
183 ).format('svn')) |
184 |
184 |
185 def __procFinished(self, exitCode, exitStatus): |
185 def __procFinished(self, exitCode, exitStatus): |
192 self.inputGroup.setEnabled(False) |
192 self.inputGroup.setEnabled(False) |
193 self.inputGroup.hide() |
193 self.inputGroup.hide() |
194 |
194 |
195 if self.paras == 0: |
195 if self.paras == 0: |
196 self.contents.insertPlainText( |
196 self.contents.insertPlainText( |
197 self.trUtf8('There is no difference.')) |
197 self.tr('There is no difference.')) |
198 return |
198 return |
199 |
199 |
200 self.buttonBox.button(QDialogButtonBox.Save).setEnabled(True) |
200 self.buttonBox.button(QDialogButtonBox.Save).setEnabled(True) |
201 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
201 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
202 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
202 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
205 tc = self.contents.textCursor() |
205 tc = self.contents.textCursor() |
206 tc.movePosition(QTextCursor.Start) |
206 tc.movePosition(QTextCursor.Start) |
207 self.contents.setTextCursor(tc) |
207 self.contents.setTextCursor(tc) |
208 self.contents.ensureCursorVisible() |
208 self.contents.ensureCursorVisible() |
209 |
209 |
210 self.filesCombo.addItem(self.trUtf8("<Start>"), 0) |
210 self.filesCombo.addItem(self.tr("<Start>"), 0) |
211 self.filesCombo.addItem(self.trUtf8("<End>"), -1) |
211 self.filesCombo.addItem(self.tr("<End>"), -1) |
212 for oldFile, newFile, pos in sorted(self.__fileSeparators): |
212 for oldFile, newFile, pos in sorted(self.__fileSeparators): |
213 if oldFile != newFile: |
213 if oldFile != newFile: |
214 self.filesCombo.addItem( |
214 self.filesCombo.addItem( |
215 "{0}\n{1}".format(oldFile, newFile), pos) |
215 "{0}\n{1}".format(oldFile, newFile), pos) |
216 else: |
216 else: |
364 else: |
364 else: |
365 fname = self.vcs.splitPath(self.filename)[0] |
365 fname = self.vcs.splitPath(self.filename)[0] |
366 |
366 |
367 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
367 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
368 self, |
368 self, |
369 self.trUtf8("Save Diff"), |
369 self.tr("Save Diff"), |
370 fname, |
370 fname, |
371 self.trUtf8("Patch Files (*.diff)"), |
371 self.tr("Patch Files (*.diff)"), |
372 None, |
372 None, |
373 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
373 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
374 |
374 |
375 if not fname: |
375 if not fname: |
376 return # user aborted |
376 return # user aborted |
381 if ex: |
381 if ex: |
382 fname += ex |
382 fname += ex |
383 if QFileInfo(fname).exists(): |
383 if QFileInfo(fname).exists(): |
384 res = E5MessageBox.yesNo( |
384 res = E5MessageBox.yesNo( |
385 self, |
385 self, |
386 self.trUtf8("Save Diff"), |
386 self.tr("Save Diff"), |
387 self.trUtf8("<p>The patch file <b>{0}</b> already exists." |
387 self.tr("<p>The patch file <b>{0}</b> already exists." |
388 " Overwrite it?</p>").format(fname), |
388 " Overwrite it?</p>").format(fname), |
389 icon=E5MessageBox.Warning) |
389 icon=E5MessageBox.Warning) |
390 if not res: |
390 if not res: |
391 return |
391 return |
392 fname = Utilities.toNativeSeparators(fname) |
392 fname = Utilities.toNativeSeparators(fname) |
393 |
393 |
396 f = open(fname, "w", encoding="utf-8", newline="") |
396 f = open(fname, "w", encoding="utf-8", newline="") |
397 f.write(eol.join(self.contents.toPlainText().splitlines())) |
397 f.write(eol.join(self.contents.toPlainText().splitlines())) |
398 f.close() |
398 f.close() |
399 except IOError as why: |
399 except IOError as why: |
400 E5MessageBox.critical( |
400 E5MessageBox.critical( |
401 self, self.trUtf8('Save Diff'), |
401 self, self.tr('Save Diff'), |
402 self.trUtf8( |
402 self.tr( |
403 '<p>The patch file <b>{0}</b> could not be saved.' |
403 '<p>The patch file <b>{0}</b> could not be saved.' |
404 '<br>Reason: {1}</p>') |
404 '<br>Reason: {1}</p>') |
405 .format(fname, str(why))) |
405 .format(fname, str(why))) |
406 |
406 |
407 def on_passwordCheckBox_toggled(self, isOn): |
407 def on_passwordCheckBox_toggled(self, isOn): |