Change a few checks to use built-in features
This commit is contained in:
+4
-4
@@ -203,12 +203,12 @@ def transferCase(theSource, theTarget):
|
|||||||
if len(theTarget) < 1 or len(theSource) < 1:
|
if len(theTarget) < 1 or len(theSource) < 1:
|
||||||
return theResult
|
return theResult
|
||||||
|
|
||||||
if theSource[0] == theSource[0].upper():
|
if theSource.istitle():
|
||||||
theResult = theTarget[0].upper() + theTarget[1:]
|
theResult = theTarget.title()
|
||||||
|
|
||||||
if theSource == theSource.upper():
|
if theSource.isupper():
|
||||||
theResult = theTarget.upper()
|
theResult = theTarget.upper()
|
||||||
elif theSource == theSource.lower():
|
elif theSource.islower():
|
||||||
theResult = theTarget.lower()
|
theResult = theTarget.lower()
|
||||||
|
|
||||||
return theResult
|
return theResult
|
||||||
|
|||||||
@@ -291,15 +291,12 @@ class NWSpellSimple(NWSpellCheck):
|
|||||||
if len(theWord) == 0:
|
if len(theWord) == 0:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
firstUp = theWord[0] == theWord[0].upper()
|
theMatches = get_close_matches(theWord.lower(), self.WORDS, n=10, cutoff=0.75)
|
||||||
theWord = theWord.lower()
|
|
||||||
|
|
||||||
theMatches = get_close_matches(theWord, self.WORDS, n=10, cutoff=0.75)
|
|
||||||
theOptions = []
|
theOptions = []
|
||||||
for aWord in theMatches:
|
for aWord in theMatches:
|
||||||
if len(aWord) == 0:
|
if len(aWord) == 0:
|
||||||
continue
|
continue
|
||||||
if firstUp:
|
if theWord[0].isupper():
|
||||||
aWord = aWord[0].upper() + aWord[1:]
|
aWord = aWord[0].upper() + aWord[1:]
|
||||||
aWord = aWord.replace("'", self.mainConf.fmtApostrophe)
|
aWord = aWord.replace("'", self.mainConf.fmtApostrophe)
|
||||||
theOptions.append(aWord)
|
theOptions.append(aWord)
|
||||||
|
|||||||
+1
-1
@@ -509,7 +509,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
|
|
||||||
aLang, aName = self.theDict.describeDict()
|
aLang, aName = self.theDict.describeDict()
|
||||||
self.theParent.statusBar.setLanguage(
|
self.theParent.statusBar.setLanguage(
|
||||||
aLang, "%s/%s" % (self.mainConf.spellTool, aName)
|
aLang, "%s [%s]" % (self.mainConf.spellTool.title(), aName.title())
|
||||||
)
|
)
|
||||||
|
|
||||||
if not self.bigDoc:
|
if not self.bigDoc:
|
||||||
|
|||||||
Reference in New Issue
Block a user