156 elif os.path.exists('/usr/tmp'): |
156 elif os.path.exists('/usr/tmp'): |
157 tmpdir = '/usr/tmp' |
157 tmpdir = '/usr/tmp' |
158 elif os.path.exists('/tmp'): |
158 elif os.path.exists('/tmp'): |
159 tmpdir = '/tmp' |
159 tmpdir = '/tmp' |
160 else: |
160 else: |
161 E5MessageBox.critical(self, |
161 E5MessageBox.critical( |
|
162 self, |
162 self.trUtf8("Subversion Diff"), |
163 self.trUtf8("Subversion Diff"), |
163 self.trUtf8("""There is no temporary directory available.""")) |
164 self.trUtf8("""There is no temporary directory available.""")) |
164 return |
165 return |
165 |
166 |
166 tmpdir = os.path.join(tmpdir, 'svn_tmp') |
167 tmpdir = os.path.join(tmpdir, 'svn_tmp') |
417 if not ext: |
418 if not ext: |
418 ex = selectedFilter.split("(*")[1].split(")")[0] |
419 ex = selectedFilter.split("(*")[1].split(")")[0] |
419 if ex: |
420 if ex: |
420 fname += ex |
421 fname += ex |
421 if QFileInfo(fname).exists(): |
422 if QFileInfo(fname).exists(): |
422 res = E5MessageBox.yesNo(self, |
423 res = E5MessageBox.yesNo( |
|
424 self, |
423 self.trUtf8("Save Diff"), |
425 self.trUtf8("Save Diff"), |
424 self.trUtf8("<p>The patch file <b>{0}</b> already exists." |
426 self.trUtf8("<p>The patch file <b>{0}</b> already exists." |
425 " Overwrite it?</p>").format(fname), |
427 " Overwrite it?</p>").format(fname), |
426 icon=E5MessageBox.Warning) |
428 icon=E5MessageBox.Warning) |
427 if not res: |
429 if not res: |
432 try: |
434 try: |
433 f = open(fname, "w", encoding="utf-8", newline="") |
435 f = open(fname, "w", encoding="utf-8", newline="") |
434 f.write(eol.join(self.contents.toPlainText().splitlines())) |
436 f.write(eol.join(self.contents.toPlainText().splitlines())) |
435 f.close() |
437 f.close() |
436 except IOError as why: |
438 except IOError as why: |
437 E5MessageBox.critical(self, self.trUtf8('Save Diff'), |
439 E5MessageBox.critical( |
|
440 self, self.trUtf8('Save Diff'), |
438 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |
441 self.trUtf8('<p>The patch file <b>{0}</b> could not be saved.' |
439 '<br>Reason: {1}</p>') |
442 '<br>Reason: {1}</p>') |
440 .format(fname, str(why))) |
443 .format(fname, str(why))) |
441 |
444 |
442 def __showError(self, msg): |
445 def __showError(self, msg): |