Renamed the typewriter config settings
This commit is contained in:
+23
-18
@@ -127,8 +127,8 @@ class Config:
|
||||
self.doReplaceDash = True
|
||||
self.doReplaceDots = True
|
||||
self.scrollPastEnd = True
|
||||
self.scollWithCursor = False
|
||||
self.scollToPoint = 40
|
||||
self.autoScroll = False
|
||||
self.autoScrollPos = 30
|
||||
|
||||
self.wordCountTimer = 5.0
|
||||
self.showTabsNSpaces = False
|
||||
@@ -465,11 +465,11 @@ class Config:
|
||||
self.scrollPastEnd = self._parseLine(
|
||||
cnfParse, cnfSec, "scrollpastend", self.CNF_BOOL, self.scrollPastEnd
|
||||
)
|
||||
self.scollWithCursor = self._parseLine(
|
||||
cnfParse, cnfSec, "scollwithcursor", self.CNF_BOOL, self.scollWithCursor
|
||||
self.autoScroll = self._parseLine(
|
||||
cnfParse, cnfSec, "autoscroll", self.CNF_BOOL, self.autoScroll
|
||||
)
|
||||
self.scollToPoint = self._parseLine(
|
||||
cnfParse, cnfSec, "scolltopoint", self.CNF_INT, self.scollToPoint
|
||||
self.autoScrollPos = self._parseLine(
|
||||
cnfParse, cnfSec, "autoscrollpos", self.CNF_INT, self.autoScrollPos
|
||||
)
|
||||
self.fmtSingleQuotes = self._parseLine(
|
||||
cnfParse, cnfSec, "fmtsinglequote", self.CNF_LIST, self.fmtSingleQuotes
|
||||
@@ -616,8 +616,8 @@ class Config:
|
||||
cnfParse.set(cnfSec, "repdash", str(self.doReplaceDash))
|
||||
cnfParse.set(cnfSec, "repdots", str(self.doReplaceDots))
|
||||
cnfParse.set(cnfSec, "scrollpastend", str(self.scrollPastEnd))
|
||||
cnfParse.set(cnfSec, "scollwithcursor", str(self.scollWithCursor))
|
||||
cnfParse.set(cnfSec, "scolltopoint", str(self.scollToPoint))
|
||||
cnfParse.set(cnfSec, "autoscroll", str(self.autoScroll))
|
||||
cnfParse.set(cnfSec, "autoscrollpos", str(self.autoScrollPos))
|
||||
cnfParse.set(cnfSec, "fmtsinglequote", self._packList(self.fmtSingleQuotes))
|
||||
cnfParse.set(cnfSec, "fmtdoublequote", self._packList(self.fmtDoubleQuotes))
|
||||
cnfParse.set(cnfSec, "spelltool", str(self.spellTool))
|
||||
@@ -911,16 +911,21 @@ class Config:
|
||||
"""
|
||||
if cnfParse.has_section(cnfSec):
|
||||
if cnfParse.has_option(cnfSec, cnfName):
|
||||
if cnfType == self.CNF_STR:
|
||||
return cnfParse.get(cnfSec, cnfName)
|
||||
elif cnfType == self.CNF_INT:
|
||||
return cnfParse.getint(cnfSec, cnfName)
|
||||
elif cnfType == self.CNF_BOOL:
|
||||
return cnfParse.getboolean(cnfSec, cnfName)
|
||||
elif cnfType == self.CNF_LIST:
|
||||
return self._unpackList(
|
||||
cnfParse.get(cnfSec, cnfName), len(cnfDefault), cnfDefault
|
||||
)
|
||||
try:
|
||||
if cnfType == self.CNF_STR:
|
||||
return cnfParse.get(cnfSec, cnfName)
|
||||
elif cnfType == self.CNF_INT:
|
||||
return cnfParse.getint(cnfSec, cnfName)
|
||||
elif cnfType == self.CNF_BOOL:
|
||||
return cnfParse.getboolean(cnfSec, cnfName)
|
||||
elif cnfType == self.CNF_LIST:
|
||||
return self._unpackList(
|
||||
cnfParse.get(cnfSec, cnfName), len(cnfDefault), cnfDefault
|
||||
)
|
||||
except ValueError as e:
|
||||
logger.error("Failed to load value from config file.")
|
||||
logger.error(str(e))
|
||||
|
||||
return cnfDefault
|
||||
|
||||
def _checkNone(self, checkVal):
|
||||
|
||||
+2
-2
@@ -778,7 +778,7 @@ class GuiDocEditor(QTextEdit):
|
||||
self.docAction(nwDocAction.SEL_ALL)
|
||||
return
|
||||
|
||||
if self.mainConf.scollWithCursor:
|
||||
if self.mainConf.autoScroll:
|
||||
|
||||
cOld = self.cursorRect().center().y()
|
||||
QTextEdit.keyPressEvent(self, keyEvent)
|
||||
@@ -789,7 +789,7 @@ class GuiDocEditor(QTextEdit):
|
||||
if okMod and okKey:
|
||||
cNew = self.cursorRect().center().y()
|
||||
cMov = cNew - cOld
|
||||
mPos = self.mainConf.scollToPoint * self.viewport().height() * 0.01
|
||||
mPos = self.mainConf.autoScrollPos * self.viewport().height() * 0.01
|
||||
if abs(cMov) > 0 and cOld > mPos:
|
||||
# Move the scroll bar
|
||||
vBar = self.verticalScrollBar()
|
||||
|
||||
+14
-14
@@ -569,23 +569,23 @@ class GuiConfigEditLayoutTab(QWidget):
|
||||
)
|
||||
|
||||
## Typewriter Scrolling
|
||||
self.scollWithCursor = QSwitch()
|
||||
self.scollWithCursor.setChecked(self.mainConf.scollWithCursor)
|
||||
self.autoScroll = QSwitch()
|
||||
self.autoScroll.setChecked(self.mainConf.autoScroll)
|
||||
self.mainForm.addRow(
|
||||
"Typewriter style scrolling when you type",
|
||||
self.scollWithCursor,
|
||||
self.autoScroll,
|
||||
"Tries to keep the cursor at a fixed vertical position."
|
||||
)
|
||||
|
||||
## Font Size
|
||||
self.scollToPoint = QSpinBox(self)
|
||||
self.scollToPoint.setMinimum(10)
|
||||
self.scollToPoint.setMaximum(90)
|
||||
self.scollToPoint.setSingleStep(1)
|
||||
self.scollToPoint.setValue(self.mainConf.scollToPoint)
|
||||
self.autoScrollPos = QSpinBox(self)
|
||||
self.autoScrollPos.setMinimum(10)
|
||||
self.autoScrollPos.setMaximum(90)
|
||||
self.autoScrollPos.setSingleStep(1)
|
||||
self.autoScrollPos.setValue(int(self.mainConf.autoScrollPos))
|
||||
self.mainForm.addRow(
|
||||
"Position in the editor to keep the cursor",
|
||||
self.scollToPoint,
|
||||
"Minimum position for Typewriter scrolling",
|
||||
self.autoScrollPos,
|
||||
"In units of percentage of the editor height.",
|
||||
theUnit = "%"
|
||||
)
|
||||
@@ -608,8 +608,8 @@ class GuiConfigEditLayoutTab(QWidget):
|
||||
textMargin = self.textMargin.value()
|
||||
tabWidth = self.tabWidth.value()
|
||||
scrollPastEnd = self.scrollPastEnd.isChecked()
|
||||
scollWithCursor = self.scollWithCursor.isChecked()
|
||||
scollToPoint = self.scollToPoint.value()
|
||||
autoScroll = self.autoScroll.isChecked()
|
||||
autoScrollPos = self.autoScrollPos.value()
|
||||
|
||||
self.mainConf.textFont = textFont
|
||||
self.mainConf.textSize = textSize
|
||||
@@ -621,8 +621,8 @@ class GuiConfigEditLayoutTab(QWidget):
|
||||
self.mainConf.textMargin = textMargin
|
||||
self.mainConf.tabWidth = tabWidth
|
||||
self.mainConf.scrollPastEnd = scrollPastEnd
|
||||
self.mainConf.scollWithCursor = scollWithCursor
|
||||
self.mainConf.scollToPoint = scollToPoint
|
||||
self.mainConf.autoScroll = autoScroll
|
||||
self.mainConf.autoScrollPos = autoScrollPos
|
||||
|
||||
self.mainConf.confChanged = True
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ repdquotes = True
|
||||
repdash = True
|
||||
repdots = True
|
||||
scrollpastend = True
|
||||
scollwithcursor = False
|
||||
scolltopoint = 40
|
||||
autoscroll = False
|
||||
autoscrollpos = 30
|
||||
fmtsinglequote = ‘, ’
|
||||
fmtdoublequote = “, ”
|
||||
spelltool = internal
|
||||
|
||||
@@ -40,8 +40,8 @@ repdquotes = True
|
||||
repdash = True
|
||||
repdots = True
|
||||
scrollpastend = False
|
||||
scollwithcursor = True
|
||||
scolltopoint = 40
|
||||
autoscroll = True
|
||||
autoscrollpos = 30
|
||||
fmtsinglequote = ‘, ’
|
||||
fmtdoublequote = “, ”
|
||||
spelltool = internal
|
||||
|
||||
@@ -1127,9 +1127,9 @@ def testPreferences(qtbot, monkeypatch, yesToAll, nwMinimal, nwTemp, nwRef, tmpC
|
||||
assert not tabLayout.scrollPastEnd.isChecked()
|
||||
|
||||
qtbot.wait(keyDelay)
|
||||
assert not tabLayout.scollWithCursor.isChecked()
|
||||
qtbot.mouseClick(tabLayout.scollWithCursor, Qt.LeftButton)
|
||||
assert tabLayout.scollWithCursor.isChecked()
|
||||
assert not tabLayout.autoScroll.isChecked()
|
||||
qtbot.mouseClick(tabLayout.autoScroll, Qt.LeftButton)
|
||||
assert tabLayout.autoScroll.isChecked()
|
||||
|
||||
# Editor Settings
|
||||
qtbot.wait(keyDelay)
|
||||
|
||||
+2
-2
@@ -172,8 +172,8 @@ def testDocEditor(qtbot, yesToAll, nwFuncTemp, nwTempGUI, nwRef, nwTemp):
|
||||
nwGUI.mainConf.hideHScroll = True
|
||||
nwGUI.mainConf.hideVScroll = True
|
||||
nwGUI.mainConf.scrollPastEnd = True
|
||||
nwGUI.mainConf.scollToPoint = 80
|
||||
nwGUI.mainConf.scollWithCursor = True
|
||||
nwGUI.mainConf.autoScrollPos = 80
|
||||
nwGUI.mainConf.autoScroll = True
|
||||
|
||||
# Add a Character File
|
||||
nwGUI.setFocus(1)
|
||||
|
||||
Reference in New Issue
Block a user