diff --git a/nw/gui/projecteditor.py b/nw/gui/projecteditor.py index 0fdb1fb8..515f709b 100644 --- a/nw/gui/projecteditor.py +++ b/nw/gui/projecteditor.py @@ -16,12 +16,12 @@ import nw from os import path 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.QtWidgets import ( QDialog, QHBoxLayout, QVBoxLayout, QFormLayout, QLineEdit, QPlainTextEdit, QLabel, QWidget, QTabWidget, QDialogButtonBox, QListWidget, QListWidgetItem, QPushButton, - QColorDialog, QAbstractItemView + QColorDialog, QAbstractItemView, QTableView, QHeaderView, QAbstractItemView ) from nw.enum import nwAlert @@ -47,14 +47,16 @@ class GuiProjectEditor(QDialog): self.svgGradient.setFixedWidth(80) self.theProject.countStatus() - self.tabMain = GuiProjectEditMain(self.theParent, self.theProject) - self.tabStatus = GuiProjectEditStatus(self.theParent, self.theProject.statusItems) - self.tabImport = GuiProjectEditStatus(self.theParent, self.theProject.importItems) + self.tabMain = GuiProjectEditMain(self.theParent, self.theProject) + self.tabStatus = GuiProjectEditStatus(self.theParent, self.theProject.statusItems) + self.tabImport = GuiProjectEditStatus(self.theParent, self.theProject.importItems) + self.tabReplace = GuiProjectEditReplace(self.theParent, self.theProject.importItems) self.tabWidget = QTabWidget() - self.tabWidget.addTab(self.tabMain, "Settings") - self.tabWidget.addTab(self.tabStatus,"Status") - self.tabWidget.addTab(self.tabImport,"Importance") + self.tabWidget.addTab(self.tabMain, "Settings") + self.tabWidget.addTab(self.tabStatus, "Status") + self.tabWidget.addTab(self.tabImport, "Importance") + self.tabWidget.addTab(self.tabReplace,"Auto-Replace") self.setLayout(self.outerBox) self.outerBox.addWidget(self.svgGradient) @@ -73,6 +75,12 @@ class GuiProjectEditor(QDialog): 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): logger.verbose("ProjectEditor save button clicked") @@ -292,3 +300,28 @@ class GuiProjectEditStatus(QWidget): return # 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 diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index a4cbec70..bbf2cb0b 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -22,7 +22,6 @@ from PyQt5.QtWidgets import ( QShortcut, QMessageBox, QProgressDialog ) -from nw.theme import Theme from nw.gui.doctree import GuiDocTree from nw.gui.doceditor import GuiDocEditor from nw.gui.docviewer import GuiDocViewer @@ -38,9 +37,10 @@ from nw.project.item import NWItem from nw.project.index import NWIndex from nw.convert.tokenizer import Tokenizer 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.constants import nwFiles -from nw.tools.wordcount import countWords logger = logging.getLogger(__name__)