Added a config dialog
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""novelWriter GUI Config Editor
|
||||
|
||||
novelWriter – GUI Config Editor
|
||||
=================================
|
||||
Class holding the config dialog
|
||||
|
||||
File History:
|
||||
Created: 2019-06-10 [0.1.5]
|
||||
|
||||
"""
|
||||
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from os import path
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QColor, QBrush, QStandardItemModel
|
||||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QFormLayout, QLineEdit, QPlainTextEdit, QLabel,
|
||||
QWidget, QTabWidget, QDialogButtonBox, QListWidget, QListWidgetItem, QPushButton,
|
||||
QColorDialog, QAbstractItemView, QTreeWidget, QTreeWidgetItem
|
||||
)
|
||||
from nw.enum import nwAlert
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class GuiConfigEditor(QDialog):
|
||||
|
||||
def __init__(self, theParent, theProject):
|
||||
QDialog.__init__(self, theParent)
|
||||
|
||||
logger.debug("Initialising ConfigEditor ...")
|
||||
|
||||
self.mainConf = nw.CONFIG
|
||||
self.theParent = theParent
|
||||
self.theProject = theProject
|
||||
self.outerBox = QHBoxLayout()
|
||||
self.innerBox = QVBoxLayout()
|
||||
|
||||
self.setWindowTitle("%s Configuration" % nw.__package__)
|
||||
|
||||
self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","block.svg"))
|
||||
self.svgGradient = QSvgWidget(self.gradPath)
|
||||
self.svgGradient.setFixedWidth(80)
|
||||
|
||||
self.theProject.countStatus()
|
||||
self.tabMain = GuiConfigEditGeneral(self.theParent, self.theProject)
|
||||
|
||||
self.tabWidget = QTabWidget()
|
||||
self.tabWidget.addTab(self.tabMain, "General")
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
self.outerBox.addWidget(self.svgGradient)
|
||||
self.outerBox.addLayout(self.innerBox)
|
||||
|
||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||
self.buttonBox.accepted.connect(self._doSave)
|
||||
self.buttonBox.rejected.connect(self._doClose)
|
||||
|
||||
self.innerBox.addWidget(self.tabWidget)
|
||||
self.innerBox.addWidget(self.buttonBox)
|
||||
|
||||
self.show()
|
||||
|
||||
logger.debug("ProjectEditor ConfigEditor complete")
|
||||
|
||||
return
|
||||
|
||||
def _doSave(self):
|
||||
logger.verbose("ConfigEditor save button clicked")
|
||||
self.close()
|
||||
return
|
||||
|
||||
def _doClose(self):
|
||||
logger.verbose("ConfigEditor close button clicked")
|
||||
self.close()
|
||||
return
|
||||
|
||||
# END Class GuiConfigEditor
|
||||
|
||||
class GuiConfigEditGeneral(QWidget):
|
||||
|
||||
def __init__(self, theParent, theProject):
|
||||
QWidget.__init__(self, theParent)
|
||||
|
||||
self.theParent = theParent
|
||||
self.theProject = theProject
|
||||
self.mainForm = QFormLayout()
|
||||
|
||||
self.setLayout(self.mainForm)
|
||||
|
||||
return
|
||||
|
||||
# END Class GuiConfigEditGeneral
|
||||
Reference in New Issue
Block a user