8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, QFileInfo |
12 from PyQt4.QtCore import pyqtSlot, QProcess, QTimer, QFileInfo |
13 from PyQt4.QtGui import QWidget, QDialogButtonBox, QBrush, QColor, QMessageBox, \ |
13 from PyQt4.QtGui import QWidget, QDialogButtonBox, QBrush, QColor, \ |
14 QTextCursor, QFileDialog, QLineEdit |
14 QTextCursor, QFileDialog, QLineEdit |
15 |
15 |
16 from E5Gui import E5MessageBox |
16 from E5Gui import E5MessageBox |
17 |
17 |
18 from .Ui_HgDiffDialog import Ui_HgDiffDialog |
18 from .Ui_HgDiffDialog import Ui_HgDiffDialog |
275 if not ext: |
275 if not ext: |
276 ex = selectedFilter.split("(*")[1].split(")")[0] |
276 ex = selectedFilter.split("(*")[1].split(")")[0] |
277 if ex: |
277 if ex: |
278 fname += ex |
278 fname += ex |
279 if QFileInfo(fname).exists(): |
279 if QFileInfo(fname).exists(): |
280 res = E5MessageBox.warning(self, |
280 res = E5MessageBox.yesNo(self, |
281 self.trUtf8("Save Diff"), |
281 self.trUtf8("Save Diff"), |
282 self.trUtf8("<p>The patch file <b>{0}</b> already exists.</p>") |
282 self.trUtf8("<p>The patch file <b>{0}</b> already exists." |
283 .format(fname), |
283 " Overwrite it?</p>").format(fname), |
284 QMessageBox.StandardButtons(\ |
284 type_ = E5MessageBox.Warning) |
285 QMessageBox.Abort | \ |
285 if not res: |
286 QMessageBox.Save), |
|
287 QMessageBox.Abort) |
|
288 if res != QMessageBox.Save: |
|
289 return |
286 return |
290 fname = Utilities.toNativeSeparators(fname) |
287 fname = Utilities.toNativeSeparators(fname) |
291 |
288 |
292 try: |
289 try: |
293 f = open(fname, "w", encoding = "utf-8") |
290 f = open(fname, "w", encoding = "utf-8") |