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