Reorder menu items and rename some features
This commit is contained in:
+10
-10
@@ -111,8 +111,8 @@ class Config:
|
||||
self.textWidth = 600
|
||||
self.textMargin = 40
|
||||
self.tabWidth = 40
|
||||
self.zenWidth = 800
|
||||
self.hideZenFooter = False
|
||||
self.focusWidth = 800
|
||||
self.hideFocusFooter = False
|
||||
self.doJustify = False
|
||||
self.autoSelect = True
|
||||
self.doReplace = True
|
||||
@@ -416,11 +416,11 @@ class Config:
|
||||
self.tabWidth = self._parseLine(
|
||||
cnfParse, cnfSec, "tabwidth", self.CNF_INT, self.tabWidth
|
||||
)
|
||||
self.zenWidth = self._parseLine(
|
||||
cnfParse, cnfSec, "zenwidth", self.CNF_INT, self.zenWidth
|
||||
self.focusWidth = self._parseLine(
|
||||
cnfParse, cnfSec, "focuswidth", self.CNF_INT, self.focusWidth
|
||||
)
|
||||
self.hideZenFooter = self._parseLine(
|
||||
cnfParse, cnfSec, "hidezenfooter", self.CNF_BOOL, self.hideZenFooter
|
||||
self.hideFocusFooter = self._parseLine(
|
||||
cnfParse, cnfSec, "hidefocusfooter", self.CNF_BOOL, self.hideFocusFooter
|
||||
)
|
||||
self.doJustify = self._parseLine(
|
||||
cnfParse, cnfSec, "justify", self.CNF_BOOL, self.doJustify
|
||||
@@ -576,8 +576,8 @@ class Config:
|
||||
cnfParse.set(cnfSec,"width", str(self.textWidth))
|
||||
cnfParse.set(cnfSec,"margin", str(self.textMargin))
|
||||
cnfParse.set(cnfSec,"tabwidth", str(self.tabWidth))
|
||||
cnfParse.set(cnfSec,"zenwidth", str(self.zenWidth))
|
||||
cnfParse.set(cnfSec,"hidezenfooter", str(self.hideZenFooter))
|
||||
cnfParse.set(cnfSec,"focuswidth", str(self.focusWidth))
|
||||
cnfParse.set(cnfSec,"hidefocusfooter", str(self.hideFocusFooter))
|
||||
cnfParse.set(cnfSec,"justify", str(self.doJustify))
|
||||
cnfParse.set(cnfSec,"autoselect", str(self.autoSelect))
|
||||
cnfParse.set(cnfSec,"autoreplace", str(self.doReplace))
|
||||
@@ -839,8 +839,8 @@ class Config:
|
||||
def getTabWidth(self):
|
||||
return self.pxInt(self.tabWidth)
|
||||
|
||||
def getZenWidth(self):
|
||||
return self.pxInt(self.zenWidth)
|
||||
def getFocusWidth(self):
|
||||
return self.pxInt(self.focusWidth)
|
||||
|
||||
##
|
||||
# Internal Functions
|
||||
|
||||
+7
-7
@@ -322,7 +322,7 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
def updateDocMargins(self):
|
||||
"""Automatically adjust the margins so the text is centred if
|
||||
Config.textFixedW is enabled or we're in Zen mode. Otherwise,
|
||||
Config.textFixedW is enabled or we're in Focus Mode. Otherwise,
|
||||
just ensure the margins are set correctly.
|
||||
"""
|
||||
wW = self.width()
|
||||
@@ -334,9 +334,9 @@ class GuiDocEditor(QTextEdit):
|
||||
else:
|
||||
sW = 0
|
||||
|
||||
if self.mainConf.textFixedW or self.theParent.isZenMode:
|
||||
if self.theParent.isZenMode:
|
||||
tW = self.mainConf.getZenWidth()
|
||||
if self.mainConf.textFixedW or self.theParent.isFocusMode:
|
||||
if self.theParent.isFocusMode:
|
||||
tW = self.mainConf.getFocusWidth()
|
||||
else:
|
||||
tW = self.mainConf.getTextWidth()
|
||||
tM = (wW - sW - tW)//2
|
||||
@@ -1772,10 +1772,10 @@ class GuiDocEditHeader(QWidget):
|
||||
return
|
||||
|
||||
def _minmaxDocument(self):
|
||||
"""Switch on or off zen mode.
|
||||
"""Switch on or off Focus Mode.
|
||||
"""
|
||||
self.theParent.toggleZenMode()
|
||||
if self.theParent.isZenMode:
|
||||
self.theParent.toggleFocusMode()
|
||||
if self.theParent.isFocusMode:
|
||||
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
|
||||
self.setContentsMargins(self.buttonSize, 0, 0, 0)
|
||||
self.closeButton.setVisible(False)
|
||||
|
||||
+1
-1
@@ -229,7 +229,7 @@ class GuiDocViewer(QTextBrowser):
|
||||
|
||||
def updateDocMargins(self):
|
||||
"""Automatically adjust the margins so the text is centred if
|
||||
Config.textFixedW is enabled or we're in Zen mode. Otherwise,
|
||||
Config.textFixedW is enabled or we're in Focus Mode. Otherwise,
|
||||
just ensure the margins are set correctly.
|
||||
"""
|
||||
vBar = self.verticalScrollBar()
|
||||
|
||||
+109
-104
@@ -50,9 +50,10 @@ class GuiMainMenu(QMenuBar):
|
||||
self._buildProjectMenu()
|
||||
self._buildDocumentMenu()
|
||||
self._buildEditMenu()
|
||||
self._buildViewMenu()
|
||||
self._buildInsertMenu()
|
||||
self._buildFormatMenu()
|
||||
self._buildViewMenu()
|
||||
self._buildSearchMenu()
|
||||
self._buildToolsMenu()
|
||||
self._buildHelpMenu()
|
||||
|
||||
@@ -200,13 +201,6 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aProjectSettings.triggered.connect(self.theParent.editProjectDialog)
|
||||
self.projMenu.addAction(self.aProjectSettings)
|
||||
|
||||
# Project > Export Project
|
||||
self.aBuildProject = QAction("Build Project", self)
|
||||
self.aBuildProject.setStatusTip("Build project")
|
||||
self.aBuildProject.setShortcut("F5")
|
||||
self.aBuildProject.triggered.connect(self.theParent.buildProjectDialog)
|
||||
self.projMenu.addAction(self.aBuildProject)
|
||||
|
||||
# Project > Separator
|
||||
self.projMenu.addSeparator()
|
||||
|
||||
@@ -399,53 +393,6 @@ class GuiMainMenu(QMenuBar):
|
||||
# Edit > Separator
|
||||
self.editMenu.addSeparator()
|
||||
|
||||
# Edit > Find
|
||||
self.aEditFind = QAction("Find", self)
|
||||
self.aEditFind.setStatusTip("Find text in document")
|
||||
self.aEditFind.setShortcut("Ctrl+F")
|
||||
self.aEditFind.triggered.connect(lambda: self._docAction(nwDocAction.FIND))
|
||||
self.editMenu.addAction(self.aEditFind)
|
||||
|
||||
# Edit > Replace
|
||||
self.aEditReplace = QAction("Replace", self)
|
||||
self.aEditReplace.setStatusTip("Replace text in document")
|
||||
if self.mainConf.osDarwin:
|
||||
self.aEditReplace.setShortcut("Ctrl+=")
|
||||
else:
|
||||
self.aEditReplace.setShortcut("Ctrl+H")
|
||||
self.aEditReplace.triggered.connect(lambda: self._docAction(nwDocAction.REPLACE))
|
||||
self.editMenu.addAction(self.aEditReplace)
|
||||
|
||||
# Edit > Find Next
|
||||
self.aFindNext = QAction("Find Next", self)
|
||||
self.aFindNext.setStatusTip("Find next occurrence text in document")
|
||||
if self.mainConf.osDarwin:
|
||||
self.aFindNext.setShortcuts(["Ctrl+G","F3"])
|
||||
else:
|
||||
self.aFindNext.setShortcuts(["F3","Ctrl+G"])
|
||||
self.aFindNext.triggered.connect(lambda: self._docAction(nwDocAction.GO_NEXT))
|
||||
self.editMenu.addAction(self.aFindNext)
|
||||
|
||||
# Edit > Find Prev
|
||||
self.aFindPrev = QAction("Find Previous", self)
|
||||
self.aFindPrev.setStatusTip("Find previous occurrence text in document")
|
||||
if self.mainConf.osDarwin:
|
||||
self.aFindPrev.setShortcuts(["Ctrl+Shift+G","Shift+F3"])
|
||||
else:
|
||||
self.aFindPrev.setShortcuts(["Shift+F3","Ctrl+Shift+G"])
|
||||
self.aFindPrev.triggered.connect(lambda: self._docAction(nwDocAction.GO_PREV))
|
||||
self.editMenu.addAction(self.aFindPrev)
|
||||
|
||||
# Edit > Replace Next
|
||||
self.aReplaceNext = QAction("Replace Next", self)
|
||||
self.aReplaceNext.setStatusTip("Find and replace next occurrence text in document")
|
||||
self.aReplaceNext.setShortcut("Ctrl+Shift+1")
|
||||
self.aReplaceNext.triggered.connect(lambda: self._docAction(nwDocAction.REPL_NEXT))
|
||||
self.editMenu.addAction(self.aReplaceNext)
|
||||
|
||||
# Edit > Separator
|
||||
self.editMenu.addSeparator()
|
||||
|
||||
# Edit > Select All
|
||||
self.aSelectAll = QAction("Select All", self)
|
||||
self.aSelectAll.setStatusTip("Select all text in document")
|
||||
@@ -462,6 +409,53 @@ class GuiMainMenu(QMenuBar):
|
||||
|
||||
return
|
||||
|
||||
def _buildViewMenu(self):
|
||||
|
||||
# View
|
||||
self.viewMenu = self.addMenu("&View")
|
||||
|
||||
# View > TreeView
|
||||
self.aFocusTree = QAction("Focus Project Tree", self)
|
||||
self.aFocusTree.setStatusTip("Move focus to project tree")
|
||||
self.aFocusTree.setShortcut("Alt+1")
|
||||
self.aFocusTree.triggered.connect(lambda : self.theParent.setFocus(1))
|
||||
self.viewMenu.addAction(self.aFocusTree)
|
||||
|
||||
# View > Document Pane 1
|
||||
self.aFocusEditor = QAction("Focus Document Editor", self)
|
||||
self.aFocusEditor.setStatusTip("Move focus to left document pane")
|
||||
self.aFocusEditor.setShortcut("Alt+2")
|
||||
self.aFocusEditor.triggered.connect(lambda : self.theParent.setFocus(2))
|
||||
self.viewMenu.addAction(self.aFocusEditor)
|
||||
|
||||
# View > Document Pane 2
|
||||
self.aFocusView = QAction("Focus Document Viewer", self)
|
||||
self.aFocusView.setStatusTip("Move focus to right document pane")
|
||||
self.aFocusView.setShortcut("Alt+3")
|
||||
self.aFocusView.triggered.connect(lambda : self.theParent.setFocus(3))
|
||||
self.viewMenu.addAction(self.aFocusView)
|
||||
|
||||
# View > Separator
|
||||
self.viewMenu.addSeparator()
|
||||
|
||||
# View > Toggle Distraction Free Mode
|
||||
self.aFocusMode = QAction("Distraction Free Mode", self)
|
||||
self.aFocusMode.setStatusTip("Toggles distraction free mode, only showing text editor")
|
||||
self.aFocusMode.setShortcut("F8")
|
||||
self.aFocusMode.setCheckable(True)
|
||||
self.aFocusMode.setChecked(self.theParent.isFocusMode)
|
||||
self.aFocusMode.toggled.connect(self.theParent.toggleFocusMode)
|
||||
self.viewMenu.addAction(self.aFocusMode)
|
||||
|
||||
# View > Toggle Full Screen
|
||||
self.aFullScreen = QAction("Full Screen Mode", self)
|
||||
self.aFullScreen.setStatusTip("Maximises the main window")
|
||||
self.aFullScreen.setShortcut("F11")
|
||||
self.aFullScreen.triggered.connect(self.theParent.toggleFullScreenMode)
|
||||
self.viewMenu.addAction(self.aFullScreen)
|
||||
|
||||
return
|
||||
|
||||
def _buildInsertMenu(self):
|
||||
|
||||
# Insert
|
||||
@@ -521,6 +515,57 @@ class GuiMainMenu(QMenuBar):
|
||||
|
||||
return
|
||||
|
||||
def _buildSearchMenu(self):
|
||||
|
||||
# Search
|
||||
self.srcMenu = self.addMenu("&Search")
|
||||
|
||||
# Search > Find
|
||||
self.aFind = QAction("Find", self)
|
||||
self.aFind.setStatusTip("Find text in document")
|
||||
self.aFind.setShortcut("Ctrl+F")
|
||||
self.aFind.triggered.connect(lambda: self._docAction(nwDocAction.FIND))
|
||||
self.srcMenu.addAction(self.aFind)
|
||||
|
||||
# Search > Replace
|
||||
self.aReplace = QAction("Replace", self)
|
||||
self.aReplace.setStatusTip("Replace text in document")
|
||||
if self.mainConf.osDarwin:
|
||||
self.aReplace.setShortcut("Ctrl+=")
|
||||
else:
|
||||
self.aReplace.setShortcut("Ctrl+H")
|
||||
self.aReplace.triggered.connect(lambda: self._docAction(nwDocAction.REPLACE))
|
||||
self.srcMenu.addAction(self.aReplace)
|
||||
|
||||
# Search > Find Next
|
||||
self.aFindNext = QAction("Find Next", self)
|
||||
self.aFindNext.setStatusTip("Find next occurrence text in document")
|
||||
if self.mainConf.osDarwin:
|
||||
self.aFindNext.setShortcuts(["Ctrl+G","F3"])
|
||||
else:
|
||||
self.aFindNext.setShortcuts(["F3","Ctrl+G"])
|
||||
self.aFindNext.triggered.connect(lambda: self._docAction(nwDocAction.GO_NEXT))
|
||||
self.srcMenu.addAction(self.aFindNext)
|
||||
|
||||
# Search > Find Prev
|
||||
self.aFindPrev = QAction("Find Previous", self)
|
||||
self.aFindPrev.setStatusTip("Find previous occurrence text in document")
|
||||
if self.mainConf.osDarwin:
|
||||
self.aFindPrev.setShortcuts(["Ctrl+Shift+G","Shift+F3"])
|
||||
else:
|
||||
self.aFindPrev.setShortcuts(["Shift+F3","Ctrl+Shift+G"])
|
||||
self.aFindPrev.triggered.connect(lambda: self._docAction(nwDocAction.GO_PREV))
|
||||
self.srcMenu.addAction(self.aFindPrev)
|
||||
|
||||
# Search > Replace Next
|
||||
self.aReplaceNext = QAction("Replace Next", self)
|
||||
self.aReplaceNext.setStatusTip("Find and replace next occurrence text in document")
|
||||
self.aReplaceNext.setShortcut("Ctrl+Shift+1")
|
||||
self.aReplaceNext.triggered.connect(lambda: self._docAction(nwDocAction.REPL_NEXT))
|
||||
self.srcMenu.addAction(self.aReplaceNext)
|
||||
|
||||
return
|
||||
|
||||
def _buildFormatMenu(self):
|
||||
|
||||
# Format
|
||||
@@ -626,53 +671,6 @@ class GuiMainMenu(QMenuBar):
|
||||
|
||||
return
|
||||
|
||||
def _buildViewMenu(self):
|
||||
|
||||
# View
|
||||
self.viewMenu = self.addMenu("&View")
|
||||
|
||||
# View > TreeView
|
||||
self.aFocusTree = QAction("Focus Project Tree", self)
|
||||
self.aFocusTree.setStatusTip("Move focus to project tree")
|
||||
self.aFocusTree.setShortcut("Alt+1")
|
||||
self.aFocusTree.triggered.connect(lambda : self.theParent.setFocus(1))
|
||||
self.viewMenu.addAction(self.aFocusTree)
|
||||
|
||||
# View > Document Pane 1
|
||||
self.aFocusEditor = QAction("Focus Document Editor", self)
|
||||
self.aFocusEditor.setStatusTip("Move focus to left document pane")
|
||||
self.aFocusEditor.setShortcut("Alt+2")
|
||||
self.aFocusEditor.triggered.connect(lambda : self.theParent.setFocus(2))
|
||||
self.viewMenu.addAction(self.aFocusEditor)
|
||||
|
||||
# View > Document Pane 2
|
||||
self.aFocusView = QAction("Focus Document Viewer", self)
|
||||
self.aFocusView.setStatusTip("Move focus to right document pane")
|
||||
self.aFocusView.setShortcut("Alt+3")
|
||||
self.aFocusView.triggered.connect(lambda : self.theParent.setFocus(3))
|
||||
self.viewMenu.addAction(self.aFocusView)
|
||||
|
||||
# View > Separator
|
||||
self.viewMenu.addSeparator()
|
||||
|
||||
# View > Toggle Distraction Free Mode
|
||||
self.aZenMode = QAction("Zen Mode", self)
|
||||
self.aZenMode.setStatusTip("Toggles distraction free mode, only showing text editor")
|
||||
self.aZenMode.setShortcut("F8")
|
||||
self.aZenMode.setCheckable(True)
|
||||
self.aZenMode.setChecked(self.theParent.isZenMode)
|
||||
self.aZenMode.toggled.connect(self.theParent.toggleZenMode)
|
||||
self.viewMenu.addAction(self.aZenMode)
|
||||
|
||||
# View > Toggle Full Screen
|
||||
self.aFullScreen = QAction("Full Screen Mode", self)
|
||||
self.aFullScreen.setStatusTip("Maximises the main window")
|
||||
self.aFullScreen.setShortcut("F11")
|
||||
self.aFullScreen.triggered.connect(self.theParent.toggleFullScreenMode)
|
||||
self.viewMenu.addAction(self.aFullScreen)
|
||||
|
||||
return
|
||||
|
||||
def _buildToolsMenu(self):
|
||||
|
||||
# Tools
|
||||
@@ -741,13 +739,20 @@ class GuiMainMenu(QMenuBar):
|
||||
self.toolsMenu.addSeparator()
|
||||
|
||||
# Tools > Backup
|
||||
self.aBackupProject = QAction("Backup Project", self)
|
||||
self.aBackupProject = QAction("Backup Project Folder", self)
|
||||
self.aBackupProject.setStatusTip("Backup Project")
|
||||
self.aBackupProject.triggered.connect(self._doBackup)
|
||||
self.toolsMenu.addAction(self.aBackupProject)
|
||||
|
||||
# Tools > Export Project
|
||||
self.aBuildProject = QAction("Build Novel Project", self)
|
||||
self.aBuildProject.setStatusTip("Launch the Build novel project tool")
|
||||
self.aBuildProject.setShortcut("F5")
|
||||
self.aBuildProject.triggered.connect(self.theParent.buildProjectDialog)
|
||||
self.toolsMenu.addAction(self.aBuildProject)
|
||||
|
||||
# Tools > Writing Stats
|
||||
self.aWritingStats = QAction("Show Writing Statistics", self)
|
||||
self.aWritingStats = QAction("Writing Statistics", self)
|
||||
self.aWritingStats.setStatusTip("Show the writing statistics dialog")
|
||||
self.aWritingStats.setShortcut("F6")
|
||||
self.aWritingStats.triggered.connect(self.theParent.showWritingStatsDialog)
|
||||
|
||||
+35
-35
@@ -431,15 +431,15 @@ class GuiConfigEditLayoutTab(QWidget):
|
||||
theUnit="px"
|
||||
)
|
||||
|
||||
## Max Text Width in Zen Mode
|
||||
self.zenDocWidth = QSpinBox(self)
|
||||
self.zenDocWidth.setMinimum(300)
|
||||
self.zenDocWidth.setMaximum(10000)
|
||||
self.zenDocWidth.setSingleStep(10)
|
||||
self.zenDocWidth.setValue(self.mainConf.zenWidth)
|
||||
## Max Text Width in Focus Mode
|
||||
self.focusDocWidth = QSpinBox(self)
|
||||
self.focusDocWidth.setMinimum(300)
|
||||
self.focusDocWidth.setMaximum(10000)
|
||||
self.focusDocWidth.setSingleStep(10)
|
||||
self.focusDocWidth.setValue(self.mainConf.focusWidth)
|
||||
self.mainForm.addRow(
|
||||
"Maximum text width in \"Zen Mode\"",
|
||||
self.zenDocWidth,
|
||||
"Maximum text width in \"Focus Mode\"",
|
||||
self.focusDocWidth,
|
||||
theUnit="px"
|
||||
)
|
||||
|
||||
@@ -452,12 +452,12 @@ class GuiConfigEditLayoutTab(QWidget):
|
||||
"If disabled, minimum text width is defined by the margin setting."
|
||||
)
|
||||
|
||||
## Zen Mode Footer
|
||||
self.hideZenFooter = QSwitch()
|
||||
self.hideZenFooter.setChecked(self.mainConf.hideZenFooter)
|
||||
## Focus Mode Footer
|
||||
self.hideFocusFooter = QSwitch()
|
||||
self.hideFocusFooter.setChecked(self.mainConf.hideFocusFooter)
|
||||
self.mainForm.addRow(
|
||||
"Hide document footer in \"Zen Mode\"",
|
||||
self.hideZenFooter
|
||||
"Hide document footer in \"Focus Mode\"",
|
||||
self.hideFocusFooter
|
||||
)
|
||||
|
||||
## Justify Text
|
||||
@@ -521,29 +521,29 @@ class GuiConfigEditLayoutTab(QWidget):
|
||||
validEntries = True
|
||||
needsRestart = False
|
||||
|
||||
textFont = self.textStyleFont.text()
|
||||
textSize = self.textStyleSize.value()
|
||||
textWidth = self.textFlowMax.value()
|
||||
zenWidth = self.zenDocWidth.value()
|
||||
textFixedW = not self.textFlowFixed.isChecked()
|
||||
hideZenFooter = self.hideZenFooter.isChecked()
|
||||
doJustify = self.textJustify.isChecked()
|
||||
textMargin = self.textMargin.value()
|
||||
tabWidth = self.tabWidth.value()
|
||||
viewComments = self.viewComments.isChecked()
|
||||
viewSynopsis = self.viewSynopsis.isChecked()
|
||||
textFont = self.textStyleFont.text()
|
||||
textSize = self.textStyleSize.value()
|
||||
textWidth = self.textFlowMax.value()
|
||||
focusWidth = self.focusDocWidth.value()
|
||||
textFixedW = not self.textFlowFixed.isChecked()
|
||||
hideFocusFooter = self.hideFocusFooter.isChecked()
|
||||
doJustify = self.textJustify.isChecked()
|
||||
textMargin = self.textMargin.value()
|
||||
tabWidth = self.tabWidth.value()
|
||||
viewComments = self.viewComments.isChecked()
|
||||
viewSynopsis = self.viewSynopsis.isChecked()
|
||||
|
||||
self.mainConf.textFont = textFont
|
||||
self.mainConf.textSize = textSize
|
||||
self.mainConf.textWidth = textWidth
|
||||
self.mainConf.zenWidth = zenWidth
|
||||
self.mainConf.textFixedW = textFixedW
|
||||
self.mainConf.hideZenFooter = hideZenFooter
|
||||
self.mainConf.doJustify = doJustify
|
||||
self.mainConf.textMargin = textMargin
|
||||
self.mainConf.tabWidth = tabWidth
|
||||
self.mainConf.viewComments = viewComments
|
||||
self.mainConf.viewSynopsis = viewSynopsis
|
||||
self.mainConf.textFont = textFont
|
||||
self.mainConf.textSize = textSize
|
||||
self.mainConf.textWidth = textWidth
|
||||
self.mainConf.focusWidth = focusWidth
|
||||
self.mainConf.textFixedW = textFixedW
|
||||
self.mainConf.hideFocusFooter = hideFocusFooter
|
||||
self.mainConf.doJustify = doJustify
|
||||
self.mainConf.textMargin = textMargin
|
||||
self.mainConf.tabWidth = tabWidth
|
||||
self.mainConf.viewComments = viewComments
|
||||
self.mainConf.viewSynopsis = viewSynopsis
|
||||
|
||||
self.mainConf.confChanged = True
|
||||
|
||||
|
||||
+21
-21
@@ -73,11 +73,11 @@ class GuiMain(QMainWindow):
|
||||
)
|
||||
|
||||
# Core Classes and settings
|
||||
self.theTheme = GuiTheme(self)
|
||||
self.theProject = NWProject(self)
|
||||
self.theIndex = NWIndex(self.theProject, self)
|
||||
self.hasProject = False
|
||||
self.isZenMode = False
|
||||
self.theTheme = GuiTheme(self)
|
||||
self.theProject = NWProject(self)
|
||||
self.theIndex = NWIndex(self.theProject, self)
|
||||
self.hasProject = False
|
||||
self.isFocusMode = False
|
||||
|
||||
# Prepare main window
|
||||
self.resize(*self.mainConf.getWinSize())
|
||||
@@ -874,7 +874,7 @@ class GuiMain(QMainWindow):
|
||||
|
||||
logger.info("Exiting %s" % nw.__package__)
|
||||
|
||||
if not self.isZenMode:
|
||||
if not self.isFocusMode:
|
||||
self.mainConf.setMainPanePos(self.splitMain.sizes())
|
||||
self.mainConf.setDocPanePos(self.splitDocs.sizes())
|
||||
self.mainConf.setOutlinePanePos(self.splitOutline.sizes())
|
||||
@@ -921,28 +921,28 @@ class GuiMain(QMainWindow):
|
||||
self.splitDocs.setSizes(vPos)
|
||||
return not self.splitView.isVisible()
|
||||
|
||||
def toggleZenMode(self):
|
||||
"""Main GUI Zen Mode hides tree, view pane and optionally also
|
||||
def toggleFocusMode(self):
|
||||
"""Main GUI Focus Mode hides tree, view pane and optionally also
|
||||
statusbar and menu.
|
||||
"""
|
||||
if self.docEditor.theHandle is None:
|
||||
logger.error("No document open, so not activating Zen Mode")
|
||||
logger.error("No document open, so not activating Focus Mode")
|
||||
return False
|
||||
|
||||
self.isZenMode = not self.isZenMode
|
||||
if self.isZenMode:
|
||||
logger.debug("Activating Zen mode")
|
||||
self.isFocusMode = not self.isFocusMode
|
||||
if self.isFocusMode:
|
||||
logger.debug("Activating Focus mode")
|
||||
self.tabWidget.setCurrentWidget(self.splitDocs)
|
||||
else:
|
||||
logger.debug("Deactivating Zen mode")
|
||||
logger.debug("Deactivating Focus mode")
|
||||
|
||||
isVisible = not self.isZenMode
|
||||
isVisible = not self.isFocusMode
|
||||
self.treePane.setVisible(isVisible)
|
||||
self.statusBar.setVisible(isVisible)
|
||||
self.mainMenu.setVisible(isVisible)
|
||||
self.tabWidget.tabBar().setVisible(isVisible)
|
||||
|
||||
hideDocFooter = self.isZenMode and self.mainConf.hideZenFooter
|
||||
hideDocFooter = self.isFocusMode and self.mainConf.hideFocusFooter
|
||||
self.docEditor.docFooter.setVisible(not hideDocFooter)
|
||||
|
||||
if self.splitView.isVisible():
|
||||
@@ -996,6 +996,10 @@ class GuiMain(QMainWindow):
|
||||
self.addAction(self.mainMenu.aSelectAll)
|
||||
self.addAction(self.mainMenu.aSelectPar)
|
||||
|
||||
# View
|
||||
self.addAction(self.mainMenu.aFocusMode)
|
||||
self.addAction(self.mainMenu.aFullScreen)
|
||||
|
||||
# Insert
|
||||
self.addAction(self.mainMenu.aInsENDash)
|
||||
self.addAction(self.mainMenu.aInsEMDash)
|
||||
@@ -1018,10 +1022,6 @@ class GuiMain(QMainWindow):
|
||||
self.addAction(self.mainMenu.aFmtComment)
|
||||
self.addAction(self.mainMenu.aFmtNoFormat)
|
||||
|
||||
# View
|
||||
self.addAction(self.mainMenu.aZenMode)
|
||||
self.addAction(self.mainMenu.aFullScreen)
|
||||
|
||||
# Tools
|
||||
self.addAction(self.mainMenu.aSpellCheck)
|
||||
self.addAction(self.mainMenu.aReRunSpell)
|
||||
@@ -1132,8 +1132,8 @@ class GuiMain(QMainWindow):
|
||||
if self.docEditor.docSearch.isVisible():
|
||||
self.docEditor.closeSearch()
|
||||
return
|
||||
elif self.isZenMode:
|
||||
self.toggleZenMode()
|
||||
elif self.isFocusMode:
|
||||
self.toggleFocusMode()
|
||||
return
|
||||
|
||||
def _mainTabChanged(self, tabIndex):
|
||||
|
||||
Reference in New Issue
Block a user