Browse Source

fix save warning crash on new document and change save warning dialog icon

master
Ivan Holmes 3 years ago
parent
commit
44147406c8
  1. 2
      csgui/messageBox.py
  2. 7
      gui.py

2
csgui/messageBox.py

@ -8,7 +8,7 @@ class UnsavedMessageBox(QMessageBox):
def __init__(self, fileName):
super().__init__()
self.setIcon(QMessageBox.Question)
self.setIcon(QMessageBox.Information)
self.setWindowTitle("Unsaved changes")
self.setText(f"The document \"{fileName}\" has been modified.")
self.setInformativeText("Do you want to save your changes?")

7
gui.py

@ -1059,7 +1059,12 @@ class DocumentWindow(QMdiSubWindow):
if self.lastHash == self.doc.getHash():
return True
else:
wantToSave = UnsavedMessageBox(os.path.basename(self.currentFilePath)).exec()
if self.currentFilePath:
fileName = os.path.basename(self.currentFilePath)
else:
fileName = "Unsaved"
wantToSave = UnsavedMessageBox(fileName).exec()
if wantToSave == QMessageBox.Save:
if not self.currentFilePath:

Loading…
Cancel
Save