Further PEP8 compliance changes
This commit is contained in:
@@ -15,15 +15,15 @@ import nw
|
||||
|
||||
from os import path
|
||||
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QColor, QBrush, QStandardItemModel, QFont
|
||||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QColor, QBrush, QStandardItemModel, QFont
|
||||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QFormLayout, QLineEdit, QPlainTextEdit, QLabel,
|
||||
QWidget, QTabWidget, QDialogButtonBox, QSpinBox, QGroupBox, QComboBox, QMessageBox,
|
||||
QCheckBox, QGridLayout, QFontComboBox, QPushButton, QFileDialog
|
||||
)
|
||||
from nw.enum import nwAlert
|
||||
from nw.enum import nwAlert
|
||||
from nw.constants import nwQuotes
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -80,8 +80,8 @@ class GuiConfigEditor(QDialog):
|
||||
|
||||
logger.verbose("ConfigEditor save button clicked")
|
||||
|
||||
validEntries = True
|
||||
needsRestart = False
|
||||
validEntries = True
|
||||
needsRestart = False
|
||||
|
||||
retA, retB = self.tabMain.saveValues()
|
||||
validEntries &= retA
|
||||
@@ -557,25 +557,33 @@ class GuiConfigEditEditor(QWidget):
|
||||
if self._checkQuoteSymbol(fmtSingleQuotesO):
|
||||
self.mainConf.fmtSingleQuotes[0] = fmtSingleQuotesO
|
||||
else:
|
||||
self.theParent.makeAlert("Invalid quote symbol: %s" % fmtSingleQuotesO, nwAlert.ERROR)
|
||||
self.theParent.makeAlert(
|
||||
"Invalid quote symbol: %s" % fmtSingleQuotesO, nwAlert.ERROR
|
||||
)
|
||||
validEntries = False
|
||||
|
||||
if self._checkQuoteSymbol(fmtSingleQuotesC):
|
||||
self.mainConf.fmtSingleQuotes[1] = fmtSingleQuotesC
|
||||
else:
|
||||
self.theParent.makeAlert("Invalid quote symbol: %s" % fmtSingleQuotesC, nwAlert.ERROR)
|
||||
self.theParent.makeAlert(
|
||||
"Invalid quote symbol: %s" % fmtSingleQuotesC, nwAlert.ERROR
|
||||
)
|
||||
validEntries = False
|
||||
|
||||
if self._checkQuoteSymbol(fmtDoubleQuotesO):
|
||||
self.mainConf.fmtDoubleQuotes[0] = fmtDoubleQuotesO
|
||||
else:
|
||||
self.theParent.makeAlert("Invalid quote symbol: %s" % fmtDoubleQuotesO, nwAlert.ERROR)
|
||||
self.theParent.makeAlert(
|
||||
"Invalid quote symbol: %s" % fmtDoubleQuotesO, nwAlert.ERROR
|
||||
)
|
||||
validEntries = False
|
||||
|
||||
if self._checkQuoteSymbol(fmtDoubleQuotesC):
|
||||
self.mainConf.fmtDoubleQuotes[1] = fmtDoubleQuotesC
|
||||
else:
|
||||
self.theParent.makeAlert("Invalid quote symbol: %s" % fmtDoubleQuotesC, nwAlert.ERROR)
|
||||
self.theParent.makeAlert(
|
||||
"Invalid quote symbol: %s" % fmtDoubleQuotesC, nwAlert.ERROR
|
||||
)
|
||||
validEntries = False
|
||||
|
||||
showTabsNSpaces = self.showTabsNSpaces.isChecked()
|
||||
|
||||
+36
-33
@@ -16,24 +16,25 @@ import nw
|
||||
|
||||
from os import path
|
||||
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QWidget, QTabWidget, QGridLayout, QGroupBox, QCheckBox,
|
||||
QLabel, QComboBox, QLineEdit, QPushButton, QFileDialog, QProgressBar, QSpinBox, QMessageBox
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QWidget, QTabWidget, QGridLayout,
|
||||
QGroupBox, QCheckBox, QLabel, QComboBox, QLineEdit, QPushButton,
|
||||
QFileDialog, QProgressBar, QSpinBox, QMessageBox
|
||||
)
|
||||
|
||||
from nw.project.document import NWDoc
|
||||
from nw.tools.translate import numberToWord
|
||||
from nw.tools.optlaststate import OptLastState
|
||||
from nw.convert.file.text import TextFile
|
||||
from nw.convert.file.html import HtmlFile
|
||||
from nw.project.document import NWDoc
|
||||
from nw.tools.translate import numberToWord
|
||||
from nw.tools.optlaststate import OptLastState
|
||||
from nw.convert.file.text import TextFile
|
||||
from nw.convert.file.html import HtmlFile
|
||||
from nw.convert.file.markdown import MarkdownFile
|
||||
from nw.convert.file.latex import LaTeXFile
|
||||
from nw.convert.file.concat import ConcatFile
|
||||
from nw.common import packageRefURL
|
||||
from nw.constants import nwFiles
|
||||
from nw.enum import nwItemType, nwAlert
|
||||
from nw.convert.file.latex import LaTeXFile
|
||||
from nw.convert.file.concat import ConcatFile
|
||||
from nw.common import packageRefURL
|
||||
from nw.constants import nwFiles
|
||||
from nw.enum import nwItemType, nwAlert
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -201,9 +202,10 @@ class GuiExport(QDialog):
|
||||
# Check that encoding was successful
|
||||
if outFile.texCodecFail:
|
||||
self.theParent.makeAlert((
|
||||
"Failed to escape unicode characters while writing LaTeX file. The generated "
|
||||
".tex file may not build properly. Make sure the python package '{package:s}' "
|
||||
"is installed and working."
|
||||
"Failed to escape unicode characters while writing LaTeX "
|
||||
"file. The generated .tex file may not build properly. "
|
||||
"Make sure the python package '{package:s}' is installed "
|
||||
"and working."
|
||||
).format(
|
||||
package = packageRefURL("latexcodec")
|
||||
), nwAlert.WARN)
|
||||
@@ -343,27 +345,31 @@ class GuiExportMain(QWidget):
|
||||
}
|
||||
FMT_HELP = {
|
||||
FMT_NWD : (
|
||||
"Exports a document using the novelWriter markdown format. The files selected by the "
|
||||
"filters are appended as-is, including comments and other settings."
|
||||
"Exports a document using the novelWriter markdown format. "
|
||||
"The files selected by the filters are appended as-is, "
|
||||
"including comments and other settings."
|
||||
),
|
||||
FMT_TXT : (
|
||||
"Exports a plain text file. All formatting is stripped and comments are in square "
|
||||
"brackets."
|
||||
"Exports a plain text file. All formatting is stripped and "
|
||||
"comments are in square brackets."
|
||||
),
|
||||
FMT_MD : (
|
||||
"Exports a standard markdown file. Comments are converted to preformatted text blocks."
|
||||
"Exports a standard markdown file. Comments are converted "
|
||||
"to preformatted text blocks."
|
||||
),
|
||||
FMT_HTML : (
|
||||
"Exports a plain html5 file. Comments are wrapped in blocks with a yellow background "
|
||||
"colour."
|
||||
"Exports a plain html5 file. Comments are wrapped in "
|
||||
"blocks with a yellow background colour."
|
||||
),
|
||||
FMT_TEX : (
|
||||
"Exports a LaTeX file that can be compiled to PDF using for instance PDFLaTeX. "
|
||||
"Comments are exported as LaTeX comments."
|
||||
"Exports a LaTeX file that can be compiled to PDF using "
|
||||
"for instance PDFLaTeX. Comments are exported as LaTeX "
|
||||
"comments."
|
||||
),
|
||||
FMT_PDOC : (
|
||||
"Exports first to markdown or html5. The file is then passed on to Pandoc for a "
|
||||
"second stage. Use the Pandoc tab for settings up the conversion."
|
||||
"Exports first to markdown or html5. The file is then "
|
||||
"passed on to Pandoc for a second stage. Use the Pandoc "
|
||||
"tab for settings up the conversion."
|
||||
),
|
||||
}
|
||||
|
||||
@@ -566,7 +572,8 @@ class GuiExportMain(QWidget):
|
||||
dlgOpt = QFileDialog.Options()
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
saveTo = QFileDialog.getSaveFileName(
|
||||
self,"Export File",self.exportPath.text(),options=dlgOpt,filter=";;".join(extFilter)
|
||||
self, "Export File", self.exportPath.text(),
|
||||
options=dlgOpt, filter=";;".join(extFilter)
|
||||
)
|
||||
if saveTo:
|
||||
self.exportPath.setText(saveTo[0])
|
||||
@@ -658,7 +665,6 @@ class GuiExportPandoc(QWidget):
|
||||
self.outputFormat.addItem("ePUB eBook v2 (.epub2)", self.FMT_EPUB2)
|
||||
self.outputFormat.addItem("ePUB eBook v3 (.epub3)", self.FMT_EPUB3)
|
||||
self.outputFormat.addItem("Zim Wiki (.txt)", self.FMT_ZIM)
|
||||
# self.outputFormat.currentIndexChanged.connect(self._updateFormat)
|
||||
|
||||
optIdx = self.outputFormat.findData(self.optState.getSetting("pFormat"))
|
||||
if optIdx == -1:
|
||||
@@ -674,9 +680,6 @@ class GuiExportPandoc(QWidget):
|
||||
self.outerBox.addWidget(self.guiInfo, 0, 0)
|
||||
self.outerBox.addWidget(self.guiOutput, 1, 0)
|
||||
self.outerBox.setRowStretch(2, 1)
|
||||
# self.outerBox.setColumnStretch(0, 1)
|
||||
# self.outerBox.setColumnStretch(1, 1)
|
||||
# self.outerBox.setColumnStretch(2, 1)
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
return
|
||||
|
||||
@@ -15,13 +15,14 @@ import nw
|
||||
|
||||
from os import path
|
||||
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QFormLayout, QLineEdit, QPushButton, QComboBox
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QFormLayout,
|
||||
QLineEdit, QPushButton, QComboBox
|
||||
)
|
||||
|
||||
from nw.enum import nwItemLayout, nwItemClass, nwItemType
|
||||
from nw.enum import nwItemLayout, nwItemClass, nwItemType
|
||||
from nw.constants import nwLabels
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -15,13 +15,14 @@ import nw
|
||||
|
||||
from os import path
|
||||
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QColor, QBrush, QStandardItemModel
|
||||
from PyQt5.QtSvg import QSvgWidget
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
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, QCheckBox
|
||||
QDialog, QHBoxLayout, QVBoxLayout, QFormLayout, QLineEdit, QPlainTextEdit,
|
||||
QLabel, QWidget, QTabWidget, QDialogButtonBox, QListWidget,
|
||||
QListWidgetItem, QPushButton, QColorDialog, QAbstractItemView, QTreeWidget,
|
||||
QTreeWidgetItem, QCheckBox
|
||||
)
|
||||
from nw.enum import nwAlert
|
||||
|
||||
@@ -173,7 +174,7 @@ class GuiProjectEditStatus(QWidget):
|
||||
for iName, iCol, nUse in self.theStatus:
|
||||
self._addItem(iName, iCol, iName, nUse)
|
||||
|
||||
self.editName = QLineEdit()
|
||||
self.editName = QLineEdit()
|
||||
self.editName.setEnabled(False)
|
||||
self.newButton = QPushButton("New")
|
||||
self.delButton = QPushButton("Delete")
|
||||
|
||||
@@ -13,18 +13,20 @@
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from os import path
|
||||
from datetime import datetime
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QColor, QPixmap, QFont
|
||||
from os import path
|
||||
from datetime import datetime
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QColor, QPixmap, QFont
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QVBoxLayout, QHBoxLayout, QTreeWidget, QTreeWidgetItem, QDialogButtonBox, QHeaderView,
|
||||
QGridLayout, QLabel, QGroupBox, QCheckBox
|
||||
QDialog, QVBoxLayout, QHBoxLayout, QTreeWidget, QTreeWidgetItem,
|
||||
QDialogButtonBox, QHeaderView, QGridLayout, QLabel, QGroupBox,
|
||||
QCheckBox
|
||||
)
|
||||
|
||||
from nw.tools.optlaststate import OptLastState
|
||||
from nw.constants import nwConst, nwFiles
|
||||
from nw.enum import nwAlert
|
||||
from nw.constants import nwConst, nwFiles
|
||||
from nw.enum import nwAlert
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -44,8 +46,8 @@ class GuiSessionLogView(QDialog):
|
||||
self.timeFilter = 0.0
|
||||
self.timeTotal = 0.0
|
||||
|
||||
self.outerBox = QGridLayout()
|
||||
self.bottomBox = QHBoxLayout()
|
||||
self.outerBox = QGridLayout()
|
||||
self.bottomBox = QHBoxLayout()
|
||||
|
||||
self.setWindowTitle("Session Log")
|
||||
self.setMinimumWidth(420)
|
||||
@@ -76,7 +78,7 @@ class GuiSessionLogView(QDialog):
|
||||
self.monoFont = QFont("Monospace",10)
|
||||
|
||||
sortValid = (Qt.AscendingOrder, Qt.DescendingOrder)
|
||||
sortCol = self.optState.validIntRange(
|
||||
sortCol = self.optState.validIntRange(
|
||||
self.optState.getSetting("sortCol"), 0, 2, 0
|
||||
)
|
||||
sortOrder = self.optState.validIntTuple(
|
||||
@@ -91,7 +93,7 @@ class GuiSessionLogView(QDialog):
|
||||
self.infoBoxForm = QGridLayout(self)
|
||||
self.infoBox.setLayout(self.infoBoxForm)
|
||||
|
||||
self.labelTotal = QLabel(self._formatTime(0))
|
||||
self.labelTotal = QLabel(self._formatTime(0))
|
||||
self.labelTotal.setFont(self.monoFont)
|
||||
self.labelTotal.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
|
||||
|
||||
@@ -162,11 +164,11 @@ class GuiSessionLogView(QDialog):
|
||||
inData = inLine.split()
|
||||
if len(inData) != 8:
|
||||
continue
|
||||
dStart = datetime.strptime("%s %s" % (inData[1],inData[2]),nwConst.tStampFmt)
|
||||
dEnd = datetime.strptime("%s %s" % (inData[4],inData[5]),nwConst.tStampFmt)
|
||||
nWords = int(inData[7])
|
||||
tDiff = dEnd - dStart
|
||||
sDiff = tDiff.total_seconds()
|
||||
dStart = datetime.strptime("%s %s" % (inData[1],inData[2]),nwConst.tStampFmt)
|
||||
dEnd = datetime.strptime("%s %s" % (inData[4],inData[5]),nwConst.tStampFmt)
|
||||
nWords = int(inData[7])
|
||||
tDiff = dEnd - dStart
|
||||
sDiff = tDiff.total_seconds()
|
||||
|
||||
self.timeTotal += sDiff
|
||||
if abs(nWords) > 0:
|
||||
|
||||
@@ -15,16 +15,17 @@ import nw
|
||||
|
||||
from os import path
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QColor, QPixmap
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon, QColor, QPixmap
|
||||
from PyQt5.QtWidgets import (
|
||||
QDialog, QVBoxLayout, QHBoxLayout, QTableWidget, QTableWidgetItem, QDialogButtonBox, QLabel,
|
||||
QPushButton, QHeaderView, QGridLayout, QGroupBox, QCheckBox
|
||||
QDialog, QVBoxLayout, QHBoxLayout, QTableWidget, QTableWidgetItem,
|
||||
QDialogButtonBox, QLabel, QPushButton, QHeaderView, QGridLayout,
|
||||
QGroupBox, QCheckBox
|
||||
)
|
||||
|
||||
from nw.tools.optlaststate import OptLastState
|
||||
from nw.constants import nwFiles
|
||||
from nw.enum import nwItemClass
|
||||
from nw.constants import nwFiles
|
||||
from nw.enum import nwItemClass
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from PyQt5.QtGui import QFont
|
||||
from PyQt5.QtGui import QFont
|
||||
from PyQt5.QtWidgets import QFrame, QGridLayout, QLabel
|
||||
|
||||
from nw.constants import nwLabels
|
||||
from nw.constants import nwLabels
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -15,18 +15,21 @@ import nw
|
||||
|
||||
from time import time
|
||||
|
||||
from PyQt5.QtCore import Qt, QTimer, QSizeF
|
||||
from PyQt5.QtWidgets import qApp, QTextEdit, QAction, QMenu, QShortcut, QMessageBox
|
||||
from PyQt5.QtGui import (
|
||||
QTextCursor, QTextOption, QIcon, QKeySequence, QFont, QColor, QPalette, QTextDocument,
|
||||
from PyQt5.QtCore import Qt, QTimer, QSizeF
|
||||
from PyQt5.QtWidgets import (
|
||||
qApp, QTextEdit, QAction, QMenu, QShortcut, QMessageBox
|
||||
)
|
||||
from PyQt5.QtGui import (
|
||||
QTextCursor, QTextOption, QIcon, QKeySequence, QFont, QColor,
|
||||
QPalette, QTextDocument,
|
||||
)
|
||||
|
||||
from nw.project.document import NWDoc
|
||||
from nw.project.document import NWDoc
|
||||
from nw.gui.tools.dochighlight import GuiDocHighlighter
|
||||
from nw.gui.tools.wordcounter import WordCounter
|
||||
from nw.tools.spellcheck import NWSpellCheck
|
||||
from nw.constants import nwFiles, nwUnicode
|
||||
from nw.enum import nwDocAction, nwAlert
|
||||
from nw.gui.tools.wordcounter import WordCounter
|
||||
from nw.tools.spellcheck import NWSpellCheck
|
||||
from nw.constants import nwFiles, nwUnicode
|
||||
from nw.enum import nwDocAction, nwAlert
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -85,20 +88,20 @@ class GuiDocEditor(QTextEdit):
|
||||
QShortcut(
|
||||
QKeySequence("Ctrl+."),
|
||||
self,
|
||||
context = Qt.WidgetShortcut,
|
||||
activated = self._openSpellContext
|
||||
context=Qt.WidgetShortcut,
|
||||
activated=self._openSpellContext
|
||||
)
|
||||
QShortcut(
|
||||
Qt.Key_Return | Qt.ControlModifier,
|
||||
self,
|
||||
context = Qt.WidgetShortcut,
|
||||
activated = self._followTag
|
||||
context=Qt.WidgetShortcut,
|
||||
activated=self._followTag
|
||||
)
|
||||
QShortcut(
|
||||
Qt.Key_Enter | Qt.ControlModifier,
|
||||
self,
|
||||
context = Qt.WidgetShortcut,
|
||||
activated = self._followTag
|
||||
context=Qt.WidgetShortcut,
|
||||
activated=self._followTag
|
||||
)
|
||||
|
||||
# Set Up Word Count Thread and Timer
|
||||
@@ -684,7 +687,7 @@ class GuiDocEditor(QTextEdit):
|
||||
the document. Wraps back to the top if not found.
|
||||
"""
|
||||
searchFor = self.theParent.searchBar.getSearchText()
|
||||
wasFound = self.find(searchFor)
|
||||
wasFound = self.find(searchFor)
|
||||
if not wasFound:
|
||||
theCursor = self.textCursor()
|
||||
theCursor.movePosition(QTextCursor.Start)
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtGui import QIcon, QFont, QColor
|
||||
from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QAbstractItemView, QApplication
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtGui import QIcon, QFont, QColor
|
||||
from PyQt5.QtWidgets import (
|
||||
QTreeWidget, QTreeWidgetItem, QAbstractItemView, QApplication
|
||||
)
|
||||
|
||||
from nw.project.item import NWItem
|
||||
from nw.constants import nwLabels
|
||||
from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert
|
||||
from nw.constants import nwLabels
|
||||
from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QTextBrowser
|
||||
from PyQt5.QtGui import QTextOption, QFont, QPalette, QColor
|
||||
from PyQt5.QtGui import QTextOption, QFont, QPalette, QColor
|
||||
|
||||
from nw.convert.tokenizer import Tokenizer
|
||||
from nw.convert.tokenizer import Tokenizer
|
||||
from nw.convert.text.tohtml import ToHtml
|
||||
from nw.enum import nwAlert, nwItemType
|
||||
from nw.enum import nwAlert, nwItemType
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPalette, QColor
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPalette, QColor
|
||||
from PyQt5.QtWidgets import QFrame, QHBoxLayout, QLabel, QPushButton
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -36,7 +36,8 @@ class GuiNoticeBar(QFrame):
|
||||
self.mainBox = QHBoxLayout(self)
|
||||
self.mainBox.setContentsMargins(8,2,2,2)
|
||||
|
||||
self.noteLabel = QLabel("Hi there!")
|
||||
self.noteLabel = QLabel("Hi there!")
|
||||
|
||||
self.closeButton = QPushButton(self.theTheme.getIcon("close"),"")
|
||||
self.closeButton.clicked.connect(self.hideNote)
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QFrame, QGridLayout, QLabel, QLineEdit, QPushButton, QApplication
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import (
|
||||
QFrame, QGridLayout, QLabel, QLineEdit, QPushButton, QApplication
|
||||
)
|
||||
|
||||
from nw.enum import nwDocAction
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtGui import QFont
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtGui import QFont
|
||||
from PyQt5.QtWidgets import (
|
||||
QWidget, QHBoxLayout, QVBoxLayout, QLabel, QGroupBox, QScrollArea, QFrame, QToolButton,
|
||||
QSizePolicy, QCheckBox, QGridLayout
|
||||
QWidget, QHBoxLayout, QVBoxLayout, QLabel, QGroupBox, QScrollArea, QFrame,
|
||||
QToolButton, QSizePolicy, QCheckBox, QGridLayout
|
||||
)
|
||||
|
||||
from nw.constants import nwLabels
|
||||
|
||||
+5
-3
@@ -13,8 +13,8 @@
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from PyQt5.QtCore import QUrl
|
||||
from PyQt5.QtGui import QIcon, QDesktopServices
|
||||
from PyQt5.QtCore import QUrl
|
||||
from PyQt5.QtGui import QIcon, QDesktopServices
|
||||
from PyQt5.QtWidgets import QMenuBar, QAction, QMessageBox
|
||||
|
||||
from nw.enum import nwItemType, nwItemClass, nwDocAction
|
||||
@@ -78,7 +78,9 @@ class GuiMainMenu(QMenuBar):
|
||||
recentProject = self.mainConf.recentList[n]
|
||||
if recentProject == "": continue
|
||||
menuItem = QAction("%s" % recentProject, self.projMenu)
|
||||
menuItem.triggered.connect(lambda menuItem, n=n : self.openRecentProject(menuItem, n))
|
||||
menuItem.triggered.connect(
|
||||
lambda menuItem, n=n : self.openRecentProject(menuItem, n)
|
||||
)
|
||||
self.recentMenu.addAction(menuItem)
|
||||
|
||||
self.recentMenu.addSeparator()
|
||||
|
||||
+4
-3
@@ -13,9 +13,10 @@
|
||||
import logging
|
||||
import nw
|
||||
|
||||
from time import time
|
||||
from PyQt5.QtCore import Qt, QTimer
|
||||
from PyQt5.QtGui import QIcon, QColor, QPixmap
|
||||
from time import time
|
||||
|
||||
from PyQt5.QtCore import Qt, QTimer
|
||||
from PyQt5.QtGui import QIcon, QColor, QPixmap
|
||||
from PyQt5.QtWidgets import QStatusBar, QLabel, QFrame
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -14,7 +14,9 @@ import logging
|
||||
import nw
|
||||
|
||||
from PyQt5.QtCore import Qt, QRegularExpression
|
||||
from PyQt5.QtGui import QColor, QTextCharFormat, QFont, QSyntaxHighlighter, QBrush
|
||||
from PyQt5.QtGui import (
|
||||
QColor, QTextCharFormat, QFont, QSyntaxHighlighter, QBrush
|
||||
)
|
||||
|
||||
from nw.constants import nwUnicode
|
||||
|
||||
@@ -38,18 +40,18 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
self.hRules = []
|
||||
self.hStyles = {}
|
||||
|
||||
self.colHead = QColor(0,0,0)
|
||||
self.colHeadH = QColor(0,0,0)
|
||||
self.colEmph = QColor(0,0,0)
|
||||
self.colDialN = QColor(0,0,0)
|
||||
self.colDialD = QColor(0,0,0)
|
||||
self.colDialS = QColor(0,0,0)
|
||||
self.colComm = QColor(0,0,0)
|
||||
self.colKey = QColor(0,0,0)
|
||||
self.colVal = QColor(0,0,0)
|
||||
self.colSpell = QColor(0,0,0)
|
||||
self.colTagErr = QColor(0,0,0)
|
||||
self.colRepTag = QColor(0,0,0)
|
||||
self.colHead = QColor(0,0,0)
|
||||
self.colHeadH = QColor(0,0,0)
|
||||
self.colEmph = QColor(0,0,0)
|
||||
self.colDialN = QColor(0,0,0)
|
||||
self.colDialD = QColor(0,0,0)
|
||||
self.colDialS = QColor(0,0,0)
|
||||
self.colComm = QColor(0,0,0)
|
||||
self.colKey = QColor(0,0,0)
|
||||
self.colVal = QColor(0,0,0)
|
||||
self.colSpell = QColor(0,0,0)
|
||||
self.colTagErr = QColor(0,0,0)
|
||||
self.colRepTag = QColor(0,0,0)
|
||||
|
||||
self.initHighlighter()
|
||||
|
||||
@@ -196,7 +198,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
))
|
||||
|
||||
self.hRules.append((
|
||||
"<(\S+?)>", {
|
||||
r"<(\S+?)>", {
|
||||
0 : self.hStyles["replace"],
|
||||
}
|
||||
))
|
||||
|
||||
+31
-31
@@ -16,37 +16,37 @@ import nw
|
||||
|
||||
from os import path
|
||||
|
||||
from PyQt5.QtCore import Qt, QTimer
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QColor
|
||||
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, QDialog
|
||||
)
|
||||
|
||||
from nw.gui.mainmenu import GuiMainMenu
|
||||
from nw.gui.statusbar import GuiMainStatus
|
||||
from nw.gui.elements.doctree import GuiDocTree
|
||||
from nw.gui.elements.doceditor import GuiDocEditor
|
||||
from nw.gui.elements.docviewer import GuiDocViewer
|
||||
from nw.gui.elements.docdetails import GuiDocDetails
|
||||
from nw.gui.elements.searchbar import GuiSearchBar
|
||||
from nw.gui.elements.noticebar import GuiNoticeBar
|
||||
from nw.gui.elements.viewdetails import GuiDocViewDetails
|
||||
from nw.gui.dialogs.configeditor import GuiConfigEditor
|
||||
from nw.gui.mainmenu import GuiMainMenu
|
||||
from nw.gui.statusbar import GuiMainStatus
|
||||
from nw.gui.elements.doctree import GuiDocTree
|
||||
from nw.gui.elements.doceditor import GuiDocEditor
|
||||
from nw.gui.elements.docviewer import GuiDocViewer
|
||||
from nw.gui.elements.docdetails import GuiDocDetails
|
||||
from nw.gui.elements.searchbar import GuiSearchBar
|
||||
from nw.gui.elements.noticebar import GuiNoticeBar
|
||||
from nw.gui.elements.viewdetails import GuiDocViewDetails
|
||||
from nw.gui.dialogs.configeditor import GuiConfigEditor
|
||||
from nw.gui.dialogs.projecteditor import GuiProjectEditor
|
||||
from nw.gui.dialogs.export import GuiExport
|
||||
from nw.gui.dialogs.itemeditor import GuiItemEditor
|
||||
from nw.gui.dialogs.timelineview import GuiTimeLineView
|
||||
from nw.gui.dialogs.sessionlog import GuiSessionLogView
|
||||
from nw.project.project import NWProject
|
||||
from nw.project.document import NWDoc
|
||||
from nw.project.item import NWItem
|
||||
from nw.project.index import NWIndex
|
||||
from nw.project.backup import NWBackup
|
||||
from nw.tools.wordcount import countWords
|
||||
from nw.theme import Theme
|
||||
from nw.enum import nwItemType, nwAlert
|
||||
from nw.constants import nwFiles
|
||||
from nw.gui.dialogs.export import GuiExport
|
||||
from nw.gui.dialogs.itemeditor import GuiItemEditor
|
||||
from nw.gui.dialogs.timelineview import GuiTimeLineView
|
||||
from nw.gui.dialogs.sessionlog import GuiSessionLogView
|
||||
from nw.project.project import NWProject
|
||||
from nw.project.document import NWDoc
|
||||
from nw.project.item import NWItem
|
||||
from nw.project.index import NWIndex
|
||||
from nw.project.backup import NWBackup
|
||||
from nw.tools.wordcount import countWords
|
||||
from nw.theme import Theme
|
||||
from nw.enum import nwItemType, nwAlert
|
||||
from nw.constants import nwFiles
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -168,17 +168,17 @@ class GuiMain(QMainWindow):
|
||||
QShortcut(
|
||||
Qt.Key_Return,
|
||||
self.treeView,
|
||||
context = Qt.WidgetShortcut,
|
||||
activated = self._treeKeyPressReturn
|
||||
context=Qt.WidgetShortcut,
|
||||
activated=self._treeKeyPressReturn
|
||||
)
|
||||
QShortcut(
|
||||
Qt.Key_Escape,
|
||||
self,
|
||||
activated = self._keyPressEscape
|
||||
activated=self._keyPressEscape
|
||||
)
|
||||
|
||||
# Forward Functions
|
||||
self.setStatus = self.statusBar.setStatus
|
||||
self.setStatus = self.statusBar.setStatus
|
||||
self.setProjectStatus = self.statusBar.setProjectStatus
|
||||
|
||||
if self.mainConf.showGUI:
|
||||
@@ -578,7 +578,7 @@ class GuiMain(QMainWindow):
|
||||
dlgOpt |= QFileDialog.ShowDirsOnly
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
projPath = QFileDialog.getExistingDirectory(
|
||||
self,"Save novelWriter Project","",options=dlgOpt
|
||||
self, "Save novelWriter Project", "", options=dlgOpt
|
||||
)
|
||||
if projPath:
|
||||
return projPath
|
||||
@@ -589,7 +589,7 @@ class GuiMain(QMainWindow):
|
||||
dlgOpt |= QFileDialog.ShowDirsOnly
|
||||
dlgOpt |= QFileDialog.DontUseNativeDialog
|
||||
projPath = QFileDialog.getExistingDirectory(
|
||||
self,"Select Location for New novelWriter Project","",options=dlgOpt
|
||||
self, "Select Location for New novelWriter Project", "", options=dlgOpt
|
||||
)
|
||||
if projPath:
|
||||
return projPath
|
||||
|
||||
Reference in New Issue
Block a user