Started adding the autoreplace tab to project settings

This commit is contained in:
Veronica K. B. Olsen
2019-06-04 23:17:06 +02:00
parent ec6937beeb
commit f5af655956
2 changed files with 43 additions and 10 deletions
+41 -8
View File
@@ -16,12 +16,12 @@ import nw
from os import path from os import path
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon, QPixmap, QColor, QBrush from PyQt5.QtGui import QIcon, QPixmap, QColor, QBrush, QStandardItemModel
from PyQt5.QtSvg import QSvgWidget from PyQt5.QtSvg import QSvgWidget
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QDialog, QHBoxLayout, QVBoxLayout, QFormLayout, QLineEdit, QPlainTextEdit, QLabel, QDialog, QHBoxLayout, QVBoxLayout, QFormLayout, QLineEdit, QPlainTextEdit, QLabel,
QWidget, QTabWidget, QDialogButtonBox, QListWidget, QListWidgetItem, QPushButton, QWidget, QTabWidget, QDialogButtonBox, QListWidget, QListWidgetItem, QPushButton,
QColorDialog, QAbstractItemView QColorDialog, QAbstractItemView, QTableView, QHeaderView, QAbstractItemView
) )
from nw.enum import nwAlert from nw.enum import nwAlert
@@ -47,14 +47,16 @@ class GuiProjectEditor(QDialog):
self.svgGradient.setFixedWidth(80) self.svgGradient.setFixedWidth(80)
self.theProject.countStatus() self.theProject.countStatus()
self.tabMain = GuiProjectEditMain(self.theParent, self.theProject) self.tabMain = GuiProjectEditMain(self.theParent, self.theProject)
self.tabStatus = GuiProjectEditStatus(self.theParent, self.theProject.statusItems) self.tabStatus = GuiProjectEditStatus(self.theParent, self.theProject.statusItems)
self.tabImport = GuiProjectEditStatus(self.theParent, self.theProject.importItems) self.tabImport = GuiProjectEditStatus(self.theParent, self.theProject.importItems)
self.tabReplace = GuiProjectEditReplace(self.theParent, self.theProject.importItems)
self.tabWidget = QTabWidget() self.tabWidget = QTabWidget()
self.tabWidget.addTab(self.tabMain, "Settings") self.tabWidget.addTab(self.tabMain, "Settings")
self.tabWidget.addTab(self.tabStatus,"Status") self.tabWidget.addTab(self.tabStatus, "Status")
self.tabWidget.addTab(self.tabImport,"Importance") self.tabWidget.addTab(self.tabImport, "Importance")
self.tabWidget.addTab(self.tabReplace,"Auto-Replace")
self.setLayout(self.outerBox) self.setLayout(self.outerBox)
self.outerBox.addWidget(self.svgGradient) self.outerBox.addWidget(self.svgGradient)
@@ -73,6 +75,12 @@ class GuiProjectEditor(QDialog):
return return
# def keyPressEvent(self, theEvent):
# if theEvent.key() == Qt.Key_Enter or theEvent.key() == Qt.Key_Return:
# return
# QDialog.keyPressEvent(self, theEvent)
# return
def _doSave(self): def _doSave(self):
logger.verbose("ProjectEditor save button clicked") logger.verbose("ProjectEditor save button clicked")
@@ -292,3 +300,28 @@ class GuiProjectEditStatus(QWidget):
return return
# END Class GuiProjectEditStatus # END Class GuiProjectEditStatus
class GuiProjectEditReplace(QWidget):
def __init__(self, theParent, theProject):
QWidget.__init__(self, theParent)
self.theParent = theParent
self.theProject = theProject
self.outerBox = QVBoxLayout()
self.mainTable = QTableView()
self.mainModel = QStandardItemModel()
self.mainTable.setModel(self.mainModel)
self.mainTable.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
self.mainTable.setEditTriggers(QAbstractItemView.DoubleClicked)
self.mainModel.setHorizontalHeaderLabels(["Keyword","Value"])
self.mainModel.setRowCount(3)
self.outerBox.addWidget(self.mainTable)
self.setLayout(self.outerBox)
return
# END Class GuiProjectEditReplace
+2 -2
View File
@@ -22,7 +22,6 @@ from PyQt5.QtWidgets import (
QShortcut, QMessageBox, QProgressDialog QShortcut, QMessageBox, QProgressDialog
) )
from nw.theme import Theme
from nw.gui.doctree import GuiDocTree from nw.gui.doctree import GuiDocTree
from nw.gui.doceditor import GuiDocEditor from nw.gui.doceditor import GuiDocEditor
from nw.gui.docviewer import GuiDocViewer from nw.gui.docviewer import GuiDocViewer
@@ -38,9 +37,10 @@ from nw.project.item import NWItem
from nw.project.index import NWIndex from nw.project.index import NWIndex
from nw.convert.tokenizer import Tokenizer from nw.convert.tokenizer import Tokenizer
from nw.convert.tohtml import ToHtml from nw.convert.tohtml import ToHtml
from nw.tools.wordcount import countWords
from nw.theme import Theme
from nw.enum import nwItemType, nwAlert from nw.enum import nwItemType, nwAlert
from nw.constants import nwFiles from nw.constants import nwFiles
from nw.tools.wordcount import countWords
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)