Add ask before exit setting in Preferences
This commit is contained in:
@@ -271,10 +271,10 @@ class GuiPreferences(NDialog):
|
|||||||
self.tr("Include project notes in status bar word count"), self.incNotesWCount
|
self.tr("Include project notes in status bar word count"), self.incNotesWCount
|
||||||
)
|
)
|
||||||
|
|
||||||
# Auto Save
|
# Behaviour
|
||||||
# =========
|
# =========
|
||||||
|
|
||||||
title = self.tr("Auto Save")
|
title = self.tr("Behaviour")
|
||||||
section += 1
|
section += 1
|
||||||
self.sidebar.addButton(title, section)
|
self.sidebar.addButton(title, section)
|
||||||
self.mainForm.addGroupLabel(title, section)
|
self.mainForm.addGroupLabel(title, section)
|
||||||
@@ -301,6 +301,13 @@ class GuiPreferences(NDialog):
|
|||||||
self.tr("How often the project is automatically saved."), unit=self.tr("seconds")
|
self.tr("How often the project is automatically saved."), unit=self.tr("seconds")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Ask before exiting novelWriter
|
||||||
|
self.askBeforeExit = NSwitch(self)
|
||||||
|
self.askBeforeExit.setChecked(CONFIG.askBeforeExit)
|
||||||
|
self.mainForm.addRow(
|
||||||
|
self.tr("Ask before exiting novelWriter"), self.askBeforeExit
|
||||||
|
)
|
||||||
|
|
||||||
# Project Backup
|
# Project Backup
|
||||||
# ==============
|
# ==============
|
||||||
|
|
||||||
@@ -927,9 +934,10 @@ class GuiPreferences(NDialog):
|
|||||||
CONFIG.incNotesWCount = self.incNotesWCount.isChecked()
|
CONFIG.incNotesWCount = self.incNotesWCount.isChecked()
|
||||||
CONFIG.setTextFont(self._textFont)
|
CONFIG.setTextFont(self._textFont)
|
||||||
|
|
||||||
# Auto Save
|
# Behaviour
|
||||||
CONFIG.autoSaveDoc = self.autoSaveDoc.value()
|
CONFIG.autoSaveDoc = self.autoSaveDoc.value()
|
||||||
CONFIG.autoSaveProj = self.autoSaveProj.value()
|
CONFIG.autoSaveProj = self.autoSaveProj.value()
|
||||||
|
CONFIG.askBeforeExit = self.askBeforeExit.isChecked()
|
||||||
|
|
||||||
# Project Backup
|
# Project Backup
|
||||||
CONFIG.setBackupPath(self.backupPath)
|
CONFIG.setBackupPath(self.backupPath)
|
||||||
|
|||||||
@@ -182,12 +182,14 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, tstPaths):
|
|||||||
assert CONFIG.showFullPath is True
|
assert CONFIG.showFullPath is True
|
||||||
assert CONFIG.incNotesWCount is True
|
assert CONFIG.incNotesWCount is True
|
||||||
|
|
||||||
# Auto Save
|
# Behaviour
|
||||||
prefs.autoSaveDoc.stepUp()
|
prefs.autoSaveDoc.stepUp()
|
||||||
prefs.autoSaveProj.stepUp()
|
prefs.autoSaveProj.stepUp()
|
||||||
|
prefs.askBeforeExit.setChecked(False)
|
||||||
|
|
||||||
assert CONFIG.autoSaveDoc == 30
|
assert CONFIG.autoSaveDoc == 30
|
||||||
assert CONFIG.autoSaveProj == 60
|
assert CONFIG.autoSaveProj == 60
|
||||||
|
assert CONFIG.askBeforeExit is True
|
||||||
|
|
||||||
# Project Backup
|
# Project Backup
|
||||||
with monkeypatch.context() as mp:
|
with monkeypatch.context() as mp:
|
||||||
@@ -333,9 +335,10 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, tstPaths):
|
|||||||
assert CONFIG.showFullPath is False
|
assert CONFIG.showFullPath is False
|
||||||
assert CONFIG.incNotesWCount is False
|
assert CONFIG.incNotesWCount is False
|
||||||
|
|
||||||
# Auto Save
|
# Behaviour
|
||||||
assert CONFIG.autoSaveDoc == 31
|
assert CONFIG.autoSaveDoc == 31
|
||||||
assert CONFIG.autoSaveProj == 61
|
assert CONFIG.autoSaveProj == 61
|
||||||
|
assert CONFIG.askBeforeExit is False
|
||||||
|
|
||||||
# Project Backup
|
# Project Backup
|
||||||
assert CONFIG._backupPath == tstPaths.testDir
|
assert CONFIG._backupPath == tstPaths.testDir
|
||||||
|
|||||||
Reference in New Issue
Block a user