respect punctuation level in settings file, levels and dicts are not configurable now

This commit is contained in:
chrys 2016-10-01 01:56:09 +02:00
parent a3cb14e072
commit 4b5d12c91d
3 changed files with 7 additions and 8 deletions

View File

@ -93,7 +93,7 @@ doubleTapDelay=0.2
[general]
debugLevel=0
punctuationLevel=1
punctuationLevel=Some
numberOfClipboards=10
# define the current fenrir key
fenrirKeys=KEY_KP0,KEY_META

View File

@ -44,7 +44,7 @@ doubleTapDelay=0.2
[general]
debugLevel=0
punctuationLevel=1
punctuationLevel=Some
numberOfClipboards=10
fenrirKeys=KEY_KP0
timeFormat=%H:%M:%P

View File

@ -14,11 +14,10 @@ class punctuationManager():
self.env = environment
self.allPunctNone = dict.fromkeys(map(ord, string.punctuation), None)
self.punctuation = {
'currLevel':'Some',
'levels':{
'None': '',
'Some': '.,:-$~+*-/\\@;',
'All': string.punctuation,
'NONE': '',
'SOME': '.,:-$~+*-/\\@;',
'ALL': string.punctuation,
},
'punctuationDict':{
'&':'and',
@ -84,8 +83,8 @@ class punctuationManager():
def proceedPunctuation(self, text, ignorePunctuation=False):
resultText = self.useCustomDict(text, self.punctuation['customDict'])
currPunctLevel = ''
if not ignorePunctuation and self.punctuation['currLevel'] in self.punctuation['levels']:
currPunctLevel = self.punctuation['levels'][self.punctuation['currLevel']]
if not ignorePunctuation and self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').upper() in self.punctuation['levels']:
currPunctLevel = self.punctuation['levels'][self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').upper()]
else:
currPunctLevel = string.punctuation
resultText = self.usePunctuationDict(resultText, self.punctuation['punctuationDict'], currPunctLevel)