Added autosave and theme to preferences dialog
This commit is contained in:
+15
-8
@@ -19,7 +19,7 @@ from PyQt5.QtCore import Qt, QTimer
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QColor
|
||||
from PyQt5.QtWidgets import (
|
||||
qApp, QWidget, QMainWindow, QVBoxLayout, QFrame, QSplitter, QFileDialog,
|
||||
QShortcut, QMessageBox, QProgressDialog
|
||||
QShortcut, QMessageBox, QProgressDialog, QDialog
|
||||
)
|
||||
|
||||
from nw.gui.doctree import GuiDocTree
|
||||
@@ -50,7 +50,7 @@ class GuiMain(QMainWindow):
|
||||
|
||||
logger.debug("Initialising GUI ...")
|
||||
self.mainConf = nw.CONFIG
|
||||
self.theTheme = Theme()
|
||||
self.theTheme = Theme(self)
|
||||
self.theProject = NWProject(self)
|
||||
self.theIndex = NWIndex(self.theProject, self)
|
||||
self.hasProject = False
|
||||
@@ -119,15 +119,11 @@ class GuiMain(QMainWindow):
|
||||
|
||||
# Set Up Autosaving Project Timer
|
||||
self.asProjTimer = QTimer()
|
||||
self.asProjTimer.setInterval(int(self.mainConf.autoSaveProj*1000))
|
||||
self.asProjTimer.timeout.connect(self._autoSaveProject)
|
||||
self.asProjTimer.start()
|
||||
|
||||
# Set Up Autosaving Document Timer
|
||||
self.asDocTimer = QTimer()
|
||||
self.asDocTimer.setInterval(int(self.mainConf.autoSaveDoc*1000))
|
||||
self.asDocTimer.timeout.connect(self._autoSaveDocument)
|
||||
self.asDocTimer.start()
|
||||
|
||||
# Keyboard Shortcuts
|
||||
QShortcut(Qt.Key_Return, self.treeView, context=Qt.WidgetShortcut, activated=self._treeKeyPressReturn)
|
||||
@@ -139,6 +135,10 @@ class GuiMain(QMainWindow):
|
||||
if self.mainConf.showGUI:
|
||||
self.show()
|
||||
|
||||
self.initMain()
|
||||
self.asProjTimer.start()
|
||||
self.asDocTimer.start()
|
||||
|
||||
logger.debug("GUI initialisation complete")
|
||||
|
||||
return
|
||||
@@ -150,6 +150,11 @@ class GuiMain(QMainWindow):
|
||||
self.statusBar.clearStatus()
|
||||
return True
|
||||
|
||||
def initMain(self):
|
||||
self.asProjTimer.setInterval(int(self.mainConf.autoSaveProj*1000))
|
||||
self.asDocTimer.setInterval(int(self.mainConf.autoSaveDoc*1000))
|
||||
return True
|
||||
|
||||
##
|
||||
# Project Actions
|
||||
##
|
||||
@@ -456,8 +461,10 @@ class GuiMain(QMainWindow):
|
||||
return None
|
||||
|
||||
def editConfigDialog(self):
|
||||
dlgProj = GuiConfigEditor(self, self.theProject)
|
||||
dlgProj.exec_()
|
||||
dlgConf = GuiConfigEditor(self, self.theProject)
|
||||
if dlgConf.exec_() == QDialog.Accepted:
|
||||
logger.debug("Applying new preferences")
|
||||
self.initMain()
|
||||
return True
|
||||
|
||||
def editProjectDialog(self):
|
||||
|
||||
Reference in New Issue
Block a user