Merge pull request #363 from vkbo/fixes

Minor Fixes
This commit is contained in:
Veronica K. Berglyd Olsen
2020-07-06 08:20:33 +02:00
committed by GitHub
3 changed files with 10 additions and 8 deletions
+8 -6
View File
@@ -91,23 +91,25 @@ def countWords(theText):
def numberToRoman(numVal, isLower=False): def numberToRoman(numVal, isLower=False):
"""Convert an integer to a roman number. """Convert an integer to a roman number.
""" """
if numVal < 1 or numVal > 4999: if not isinstance(numVal, int):
return "NAN" return "NAN"
if numVal < 1 or numVal > 4999:
return "OOR"
theValues = [ theValues = [
(1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (100, "C"), (90, "XC"), (1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (100, "C"), (90, "XC"),
(50, "L"), (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I"), (50, "L"), (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I"),
] ]
romNum = "" romNum = ""
for theDiv, theSym in theValues: for theDiv, theSym in theValues:
for _ in range(numVal//theDiv): n = numVal//theDiv
romNum += theSym romNum += n*theSym
numVal -= theDiv numVal -= n*theDiv
if numVal <= 0: if numVal <= 0:
break break
return romNum.lower if isLower else romNum return romNum.lower() if isLower else romNum
# =============================================================================================== # # =============================================================================================== #
# Convert an Integer to a Word Number # Convert an Integer to a Word Number
+1 -1
View File
@@ -46,7 +46,7 @@ from PyQt5.QtWidgets import (
from nw.common import fuzzyTime from nw.common import fuzzyTime
from nw.gui.custom import QSwitch from nw.gui.custom import QSwitch
from nw.core import ToHtml, numberToRoman from nw.core import ToHtml
from nw.constants import ( from nw.constants import (
nwAlert, nwFiles, nwItemType, nwItemLayout, nwItemClass nwAlert, nwFiles, nwItemType, nwItemLayout, nwItemClass
) )
+1 -1
View File
@@ -595,7 +595,7 @@ class GuiDocViewFooter(QWidget):
self.showHide.setIconSize(QSize(fPx, fPx)) self.showHide.setIconSize(QSize(fPx, fPx))
self.showHide.setFixedSize(QSize(fPx, fPx)) self.showHide.setFixedSize(QSize(fPx, fPx))
self.showHide.clicked.connect(self._doShowHide) self.showHide.clicked.connect(self._doShowHide)
self.showHide.setToolTip("Show/hide the reference panel") self.showHide.setToolTip("Show/hide the references panel")
# Sticky Button # Sticky Button
stickyOn = self.theTheme.getPixmap("sticky-on", (fPx, fPx)) stickyOn = self.theTheme.getPixmap("sticky-on", (fPx, fPx))