Cooperation/ChatWidget.py

changeset 546
c3e7bf5648be
parent 539
87f9bce38a44
child 553
5af61623ae3c
equal deleted inserted replaced
545:1538031b5175 546:c3e7bf5648be
6 """ 6 """
7 Module implementing the chat dialog. 7 Module implementing the chat dialog.
8 """ 8 """
9 9
10 from PyQt4.QtCore import Qt, pyqtSlot, pyqtSignal, QDateTime, QPoint, QFileInfo 10 from PyQt4.QtCore import Qt, pyqtSlot, pyqtSignal, QDateTime, QPoint, QFileInfo
11 from PyQt4.QtGui import QWidget, QColor, QListWidgetItem, QMenu, QFileDialog, \ 11 from PyQt4.QtGui import QWidget, QColor, QListWidgetItem, QMenu, QFileDialog, QApplication
12 QMessageBox, QApplication
13 12
14 from E5Gui.E5Application import e5App 13 from E5Gui.E5Application import e5App
15 from E5Gui import E5MessageBox 14 from E5Gui import E5MessageBox
16 15
17 from Globals import recentNameHosts 16 from Globals import recentNameHosts
542 if not ext: 541 if not ext:
543 ex = selectedFilter.split("(*")[1].split(")")[0] 542 ex = selectedFilter.split("(*")[1].split(")")[0]
544 if ex: 543 if ex:
545 fname += ex 544 fname += ex
546 if QFileInfo(fname).exists(): 545 if QFileInfo(fname).exists():
547 res = E5MessageBox.warning(self, 546 res = E5MessageBox.yesNo(self,
548 self.trUtf8("Save Chat"), 547 self.trUtf8("Save Chat"),
549 self.trUtf8("<p>The file <b>{0}</b> already exists.</p>") 548 self.trUtf8("<p>The file <b>{0}</b> already exists."
550 .format(fname), 549 " Overwrite it?</p>").format(fname),
551 QMessageBox.StandardButtons(\ 550 type_ = E5MessageBox.Warning)
552 QMessageBox.Abort | \ 551 if not res:
553 QMessageBox.Save),
554 QMessageBox.Abort)
555 if res != QMessageBox.Save:
556 return 552 return
557 fname = Utilities.toNativeSeparators(fname) 553 fname = Utilities.toNativeSeparators(fname)
558 554
559 try: 555 try:
560 f = open(fname, "w", encoding = "utf-8") 556 f = open(fname, "w", encoding = "utf-8")

eric ide

mercurial