diff --git a/docs/source/interface.txt b/docs/source/interface.txt index 4bfe2d4d..5818b65b 100644 --- a/docs/source/interface.txt +++ b/docs/source/interface.txt @@ -68,9 +68,10 @@ These are as following: ":kbd:`Ctrl-B`", "Format selected text, or word under cursor, as bold." ":kbd:`Ctrl-C`", "Copy selected text to clipboard." ":kbd:`Ctrl-D`", "Wrap selected text, or word under cursor, in double quotes." - ":kbd:`Ctrl-E`", "If in tree view, edit a document or folder settings." + ":kbd:`Ctrl-E`", "If in tree view, edit a document or folder settings. (Same as :kbd:`F2`)" ":kbd:`Ctrl-F`", "Open the search bar and search for selected word, if any is selected." - ":kbd:`Ctrl-H`", "Open the search and replace bar and search for selected word, if any is selected." + ":kbd:`Ctrl-G`", "Find next occurrence of word in current document. (Same as :kbd:`F3`)" + ":kbd:`Ctrl-H`", "Open the search and replace bar and search for selected word, if any is selected. (On Mac, this is :kbd:`Cmd+=`)" ":kbd:`Ctrl-I`", "Format selected text, or word under cursor, as italic." ":kbd:`Ctrl-N`", "Create new document." ":kbd:`Ctrl-O`", "Open selected document." @@ -91,6 +92,7 @@ These are as following: ":kbd:`Ctrl-Shift-1`", "Replace occurrence of word in current document, and search for next occurrence." ":kbd:`Ctrl-Shift-A`", "Select all text in current paragraph." ":kbd:`Ctrl-Shift-D`", "Wrap selected text, or word under cursor, in single quotes." + ":kbd:`Ctrl-Shift+G`", "Find previous occurrence of word in current document. (Same as :kbd:`Shift-F3`" ":kbd:`Ctrl-Shift-I`", "Import text to the current document from a text file." ":kbd:`Ctrl-Shift-N`", "Create new folder." ":kbd:`Ctrl-Shift-O`", "Open a project." @@ -100,12 +102,15 @@ These are as following: ":kbd:`Ctrl-Shift-Up`", "Move item one step up in the tree view." ":kbd:`Ctrl-Shift-Down`", "Move item one step down in the tree view." ":kbd:`F1`", "Open documentation." - ":kbd:`F2`", "Alternative to :kbd:`Ctrl-E`." - ":kbd:`F3`", "Find next occurrence of word in current document." + ":kbd:`F2`", "If in tree view, edit a document or folder settings. (Same as :kbd:`Ctrl-E`)" + ":kbd:`F3`", "Find next occurrence of word in current document. (Same as :kbd:`Ctrl-G`)" ":kbd:`F5`", "Export project dialog." ":kbd:`F7`", "Re-run spell checker." ":kbd:`F9`", "Re-build project indices." ":kbd:`Shift-Enter`", "Insert a hard line break at the cursor position." - ":kbd:`Shift-F3`", "Find previous occurrence of word in current document." + ":kbd:`Shift-F3`", "Find previous occurrence of word in current document. (Same as :kbd:`Ctrl-Shift-G`" ":kbd:`Shift-Space`", "Insert a non-breaking space at the cursor position." ":kbd:`Enter`", "If in tree view, open a document for editing." + +.. note:: + On macOS, replace :kbd:`Ctrl` with :kbd:`Cmd`. diff --git a/nw/__init__.py b/nw/__init__.py index 5a0a31a6..4b2b82a2 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -77,10 +77,11 @@ def main(sysArgs=None): sysArgs = sys.argv[1:] # Valid Input Options - shortOpt = "hdDqtl:v" + shortOpt = "hdiqtl:v" longOpt = [ "help", "debug", + "info", "verbose", "quiet", "time", @@ -99,6 +100,7 @@ def main(sysArgs=None): "Usage:\n" " -h, --help Print this message.\n" " -v, --version Print program version and exit.\n" + " -i, --info Print additional runtime information.\n" " -d, --debug Print debug output.\n" " --verbose Increase verbosity of debug output.\n" " -q, --quiet Disable output to command line. Does not affect log file.\n" @@ -141,6 +143,8 @@ def main(sysArgs=None): elif inOpt in ("-v", "--version"): print("%s %s Version %s" % (__package__,__status__,__version__)) sys.exit() + elif inOpt in ("-i", "--info"): + debugLevel = logging.INFO elif inOpt in ("-d", "--debug"): debugLevel = logging.DEBUG debugStr = "{name:>30}:{lineno:<4d} {levelname:8} {message:}" diff --git a/nw/gui/dialogs/export.py b/nw/gui/dialogs/export.py index 57bc06ee..56e99369 100644 --- a/nw/gui/dialogs/export.py +++ b/nw/gui/dialogs/export.py @@ -411,11 +411,13 @@ class GuiExportMain(QWidget): self.guiChapters.setLayout(self.guiChaptersForm) self.chapterFormat = QLineEdit() + self.chapterFormat.setMaxLength(200) self.chapterFormat.setText(self.optState.getSetting("chFormat")) self.chapterFormat.setToolTip("Available formats: %num%, %numword%, %title%") self.chapterFormat.setMinimumWidth(250) self.unnumFormat = QLineEdit() + self.unnumFormat.setMaxLength(200) self.unnumFormat.setText(self.optState.getSetting("unFormat")) self.unnumFormat.setToolTip("Available formats: %title%") self.unnumFormat.setMinimumWidth(250) @@ -431,11 +433,13 @@ class GuiExportMain(QWidget): self.guiScenes.setLayout(self.guiScenesForm) self.sceneFormat = QLineEdit() + self.sceneFormat.setMaxLength(200) self.sceneFormat.setText(self.optState.getSetting("scFormat")) self.sceneFormat.setToolTip("Available formats: %title%") self.sceneFormat.setMinimumWidth(100) self.sectionFormat = QLineEdit() + self.sectionFormat.setMaxLength(200) self.sectionFormat.setText(self.optState.getSetting("seFormat")) self.sectionFormat.setToolTip("Available formats: %title%") self.sectionFormat.setMinimumWidth(100) diff --git a/nw/gui/dialogs/itemeditor.py b/nw/gui/dialogs/itemeditor.py index 3e771b63..ea278bc9 100644 --- a/nw/gui/dialogs/itemeditor.py +++ b/nw/gui/dialogs/itemeditor.py @@ -55,7 +55,9 @@ class GuiItemEditor(QDialog): self.mainGroup = QGroupBox("Item Settings") self.mainForm = QFormLayout() - self.editName = QLineEdit() + self.editName = QLineEdit() + self.editName.setMaxLength(200) + self.editStatus = QComboBox() self.editLayout = QComboBox() diff --git a/nw/gui/dialogs/projecteditor.py b/nw/gui/dialogs/projecteditor.py index 21aa7e9c..d848bc9a 100644 --- a/nw/gui/dialogs/projecteditor.py +++ b/nw/gui/dialogs/projecteditor.py @@ -126,6 +126,9 @@ class GuiProjectEditMain(QWidget): self.editAuthors = QPlainTextEdit() self.doBackup = QCheckBox(self) + self.editName.setMaxLength(200) + self.editTitle.setMaxLength(200) + self.mainForm.addRow("Working Title", self.editName) self.mainForm.addRow("Book Title", self.editTitle) self.mainForm.addRow("Book Authors", self.editAuthors) @@ -176,6 +179,7 @@ class GuiProjectEditStatus(QWidget): self._addItem(iName, iCol, iName, nUse) self.editName = QLineEdit() + self.editName.setMaxLength(40) self.editName.setEnabled(False) self.newButton = QPushButton("New") self.delButton = QPushButton("Delete") @@ -351,7 +355,9 @@ class GuiProjectEditReplace(QWidget): self.delButton = QPushButton(self.theTheme.getIcon("remove"),"") self.editKey.setEnabled(False) + self.editKey.setMaxLength(40) self.editValue.setEnabled(False) + self.editValue.setMaxLength(80) self.saveButton.clicked.connect(self._saveEntry) self.addButton.clicked.connect(self._addEntry) diff --git a/nw/gui/elements/doceditor.py b/nw/gui/elements/doceditor.py index c5438048..00da2436 100644 --- a/nw/gui/elements/doceditor.py +++ b/nw/gui/elements/doceditor.py @@ -531,7 +531,7 @@ class GuiDocEditor(QTextEdit): def _addWord(self, theCursor): theWord = theCursor.selectedText().strip() - logger.info("Added '%s' to project dictionary" % theWord) + logger.debug("Added '%s' to project dictionary" % theWord) self.theDict.addWord(theWord) self.hLight.setDict(self.theDict) self.hLight.rehighlightBlock(theCursor.block()) diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index e46dfd4e..c1366662 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -475,21 +475,30 @@ class GuiMainMenu(QMenuBar): # Edit > Replace menuItem = QAction("Replace", self) menuItem.setStatusTip("Replace text in document") - menuItem.setShortcut("Ctrl+H") + if self.mainConf.osDarwin: + menuItem.setShortcut("Ctrl+=") + else: + menuItem.setShortcut("Ctrl+H") menuItem.triggered.connect(lambda: self._docAction(nwDocAction.REPLACE)) self.editMenu.addAction(menuItem) # Edit > Find Next menuItem = QAction("Find Next", self) menuItem.setStatusTip("Find next occurrence text in document") - menuItem.setShortcut("F3") + if self.mainConf.osDarwin: + menuItem.setShortcuts(["Ctrl+G","F3"]) + else: + menuItem.setShortcuts(["F3","Ctrl+G"]) menuItem.triggered.connect(lambda: self._docAction(nwDocAction.GO_NEXT)) self.editMenu.addAction(menuItem) # Edit > Find Prev menuItem = QAction("Find Previous", self) menuItem.setStatusTip("Find previous occurrence text in document") - menuItem.setShortcut("Shift+F3") + if self.mainConf.osDarwin: + menuItem.setShortcuts(["Ctrl+Shift+G","Shift+F3"]) + else: + menuItem.setShortcuts(["Shift+F3","Ctrl+Shift+G"]) menuItem.triggered.connect(lambda: self._docAction(nwDocAction.GO_PREV)) self.editMenu.addAction(menuItem) diff --git a/nw/guimain.py b/nw/guimain.py index f0919e99..6d79eb2f 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -40,7 +40,7 @@ logger = logging.getLogger(__name__) class GuiMain(QMainWindow): def __init__(self): - QWidget.__init__(self) + QMainWindow.__init__(self) logger.info("Starting %s" % nw.__package__) logger.debug("Initialising GUI ...") diff --git a/nw/project/project.py b/nw/project/project.py index b01f5bc7..9d621977 100644 --- a/nw/project/project.py +++ b/nw/project/project.py @@ -598,7 +598,7 @@ class NWProject(): if not path.isdir(thePath): try: mkdir(thePath) - logger.info("Created folder %s" % thePath) + logger.debug("Created folder %s" % thePath) except Exception as e: self.makeAlert(["Could not create folder.",str(e)], nwAlert.ERROR) return False