Connected the new settings to the Preferences dialog
This commit is contained in:
@@ -452,10 +452,16 @@ class GuiBuildNovel(QDialog):
|
||||
self.toolsArea.setMinimumWidth(self.mainConf.pxInt(250))
|
||||
self.toolsArea.setWidgetResizable(True)
|
||||
self.toolsArea.setWidget(self.toolsWidget)
|
||||
|
||||
if self.mainConf.hideVScroll:
|
||||
self.toolsArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.toolsArea.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
if self.mainConf.hideHScroll:
|
||||
self.toolsArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.toolsArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
# Tools and Buttons Layout
|
||||
self.innerBox = QVBoxLayout()
|
||||
@@ -1121,8 +1127,13 @@ class GuiBuildNovelDocView(QTextBrowser):
|
||||
# Scroll bars
|
||||
if self.mainConf.hideVScroll:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
if self.mainConf.hideHScroll:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
docPalette = self.palette()
|
||||
docPalette.setColor(QPalette.Base, QColor(255, 255, 255))
|
||||
|
||||
+9
-1
@@ -47,7 +47,7 @@ from PyQt5.QtGui import (
|
||||
from PyQt5.QtWidgets import (
|
||||
qApp, QTextEdit, QAction, QMenu, QShortcut, QMessageBox, QWidget, QLabel,
|
||||
QToolBar, QToolButton, QHBoxLayout, QGridLayout, QLineEdit, QPushButton,
|
||||
QFrame, QAbstractSlider
|
||||
QFrame
|
||||
)
|
||||
|
||||
from nw.core import NWDoc, NWSpellCheck, NWSpellSimple, countWords
|
||||
@@ -231,8 +231,13 @@ class GuiDocEditor(QTextEdit):
|
||||
# Scroll bars
|
||||
if self.mainConf.hideVScroll:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
if self.mainConf.hideHScroll:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
# Refresh the tab stops
|
||||
if self.mainConf.verQtValue >= 51000:
|
||||
@@ -479,11 +484,14 @@ class GuiDocEditor(QTextEdit):
|
||||
"""
|
||||
if not isinstance(thePosition, int):
|
||||
return False
|
||||
|
||||
if thePosition >= 0:
|
||||
theCursor = self.textCursor()
|
||||
theCursor.setPosition(thePosition)
|
||||
self.setTextCursor(theCursor)
|
||||
self.docFooter.updateLineCount()
|
||||
self.cursorLast = self.cursorRect().center().y()
|
||||
|
||||
return True
|
||||
|
||||
def getCursorPosition(self):
|
||||
|
||||
@@ -127,8 +127,13 @@ class GuiDocViewer(QTextBrowser):
|
||||
# Scroll bars
|
||||
if self.mainConf.hideVScroll:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
if self.mainConf.hideHScroll:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
# Refresh the tab stops
|
||||
if self.mainConf.verQtValue >= 51000:
|
||||
|
||||
@@ -132,8 +132,13 @@ class GuiOutline(QTreeWidget):
|
||||
# Scroll bars
|
||||
if self.mainConf.hideVScroll:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
if self.mainConf.hideHScroll:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -236,8 +236,13 @@ class GuiOutlineDetails(QScrollArea):
|
||||
# Scroll bars
|
||||
if self.mainConf.hideVScroll:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
if self.mainConf.hideHScroll:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
return
|
||||
|
||||
|
||||
+44
-1
@@ -225,7 +225,24 @@ class GuiConfigEditGeneralTab(QWidget):
|
||||
self.showFullPath.setChecked(self.mainConf.showFullPath)
|
||||
self.mainForm.addRow(
|
||||
"Show full path in document header",
|
||||
self.showFullPath
|
||||
self.showFullPath,
|
||||
"Shows the document title and parent folder names."
|
||||
)
|
||||
|
||||
self.hideVScroll = QSwitch()
|
||||
self.hideVScroll.setChecked(self.mainConf.hideVScroll)
|
||||
self.mainForm.addRow(
|
||||
"Hide vertical scroll bars in main windows",
|
||||
self.hideVScroll,
|
||||
"Scrolling with mouse wheel and keys only."
|
||||
)
|
||||
|
||||
self.hideHScroll = QSwitch()
|
||||
self.hideHScroll.setChecked(self.mainConf.hideHScroll)
|
||||
self.mainForm.addRow(
|
||||
"Hide horizontal scroll bars in main windows",
|
||||
self.hideHScroll,
|
||||
"Scrolling with mouse wheel and keys only."
|
||||
)
|
||||
|
||||
return
|
||||
@@ -242,6 +259,8 @@ class GuiConfigEditGeneralTab(QWidget):
|
||||
guiFont = self.guiFont.text()
|
||||
guiFontSize = self.guiFontSize.value()
|
||||
showFullPath = self.showFullPath.isChecked()
|
||||
hideVScroll = self.hideVScroll.isChecked()
|
||||
hideHScroll = self.hideHScroll.isChecked()
|
||||
|
||||
# Check if restart is needed
|
||||
needsRestart |= self.mainConf.guiTheme != guiTheme
|
||||
@@ -255,6 +274,8 @@ class GuiConfigEditGeneralTab(QWidget):
|
||||
self.mainConf.guiFont = guiFont
|
||||
self.mainConf.guiFontSize = guiFontSize
|
||||
self.mainConf.showFullPath = showFullPath
|
||||
self.mainConf.hideVScroll = hideVScroll
|
||||
self.mainConf.hideHScroll = hideHScroll
|
||||
|
||||
self.mainConf.confChanged = True
|
||||
|
||||
@@ -534,6 +555,24 @@ class GuiConfigEditLayoutTab(QWidget):
|
||||
theUnit="px"
|
||||
)
|
||||
|
||||
## Scroll Past End
|
||||
self.scrollPastEnd = QSwitch()
|
||||
self.scrollPastEnd.setChecked(self.mainConf.scrollPastEnd)
|
||||
self.mainForm.addRow(
|
||||
"Scroll past end of the document",
|
||||
self.scrollPastEnd,
|
||||
"Allows scrolling until last line is at the top."
|
||||
)
|
||||
|
||||
## Typewriter Scrolling
|
||||
self.scollWithCursor = QSwitch()
|
||||
self.scollWithCursor.setChecked(self.mainConf.scollWithCursor)
|
||||
self.mainForm.addRow(
|
||||
"Typewriter style scrolling",
|
||||
self.scollWithCursor,
|
||||
"Scrolls up when the cursor moves to a new line."
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
def saveValues(self):
|
||||
@@ -551,6 +590,8 @@ class GuiConfigEditLayoutTab(QWidget):
|
||||
doJustify = self.textJustify.isChecked()
|
||||
textMargin = self.textMargin.value()
|
||||
tabWidth = self.tabWidth.value()
|
||||
scrollPastEnd = self.scrollPastEnd.isChecked()
|
||||
scollWithCursor = self.scollWithCursor.isChecked()
|
||||
|
||||
self.mainConf.textFont = textFont
|
||||
self.mainConf.textSize = textSize
|
||||
@@ -561,6 +602,8 @@ class GuiConfigEditLayoutTab(QWidget):
|
||||
self.mainConf.doJustify = doJustify
|
||||
self.mainConf.textMargin = textMargin
|
||||
self.mainConf.tabWidth = tabWidth
|
||||
self.mainConf.scrollPastEnd = scrollPastEnd
|
||||
self.mainConf.scollWithCursor = scollWithCursor
|
||||
|
||||
self.mainConf.confChanged = True
|
||||
|
||||
|
||||
@@ -131,8 +131,13 @@ class GuiProjectTree(QTreeWidget):
|
||||
# Scroll bars
|
||||
if self.mainConf.hideVScroll:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
if self.mainConf.hideHScroll:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
|
||||
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user