Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3023
34ce20603bf7
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
196 procStarted = self.process.waitForStarted(5000) 196 procStarted = self.process.waitForStarted(5000)
197 if not procStarted: 197 if not procStarted:
198 QApplication.restoreOverrideCursor() 198 QApplication.restoreOverrideCursor()
199 self.inputGroup.setEnabled(False) 199 self.inputGroup.setEnabled(False)
200 self.inputGroup.hide() 200 self.inputGroup.hide()
201 E5MessageBox.critical(self, 201 E5MessageBox.critical(
202 self,
202 self.trUtf8('Process Generation Error'), 203 self.trUtf8('Process Generation Error'),
203 self.trUtf8( 204 self.trUtf8(
204 'The process {0} could not be started. ' 205 'The process {0} could not be started. '
205 'Ensure, that it is in the search path.' 206 'Ensure, that it is in the search path.'
206 ).format('hg')) 207 ).format('hg'))
423 if not ext: 424 if not ext:
424 ex = selectedFilter.split("(*")[1].split(")")[0] 425 ex = selectedFilter.split("(*")[1].split(")")[0]
425 if ex: 426 if ex:
426 fname += ex 427 fname += ex
427 if QFileInfo(fname).exists(): 428 if QFileInfo(fname).exists():
428 res = E5MessageBox.yesNo(self, 429 res = E5MessageBox.yesNo(
430 self,
429 self.trUtf8("Save Diff"), 431 self.trUtf8("Save Diff"),
430 self.trUtf8("<p>The patch file <b>{0}</b> already exists." 432 self.trUtf8("<p>The patch file <b>{0}</b> already exists."
431 " Overwrite it?</p>").format(fname), 433 " Overwrite it?</p>").format(fname),
432 icon=E5MessageBox.Warning) 434 icon=E5MessageBox.Warning)
433 if not res: 435 if not res:
438 try: 440 try:
439 f = open(fname, "w", encoding="utf-8") 441 f = open(fname, "w", encoding="utf-8")
440 f.write(eol.join(self.contents.toPlainText().splitlines())) 442 f.write(eol.join(self.contents.toPlainText().splitlines()))
441 f.close() 443 f.close()
442 except IOError as why: 444 except IOError as why:
443 E5MessageBox.critical(self, self.trUtf8('Save Diff'), 445 E5MessageBox.critical(
444 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' 446 self, self.trUtf8('Save Diff'),
447 self.trUtf8(
448 '<p>The patch file <b>{0}</b> could not be saved.'
445 '<br>Reason: {1}</p>') 449 '<br>Reason: {1}</p>')
446 .format(fname, str(why))) 450 .format(fname, str(why)))
447 451
448 def on_passwordCheckBox_toggled(self, isOn): 452 def on_passwordCheckBox_toggled(self, isOn):
449 """ 453 """

eric ide

mercurial