本文整理汇总了Python中Tc2Config.settingsKeyJoin方法的典型用法代码示例。如果您正苦于以下问题:Python Tc2Config.settingsKeyJoin方法的具体用法?Python Tc2Config.settingsKeyJoin怎么用?Python Tc2Config.settingsKeyJoin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tc2Config
的用法示例。
在下文中一共展示了Tc2Config.settingsKeyJoin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gocrParamsFromQSettings
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import settingsKeyJoin [as 别名]
def gocrParamsFromQSettings(klass, qSettings, settingsKey=None):
"""reads gocr settings from settings
@param qSettings: (L{QSettings})
@param settingsKey: (str, list, None)
@return:(dict) gocr settings
"""
params= {}
if isinstance(settingsKey,tuple):
settingsKey = Tc2Config.settingsKeyJoin(*settingsKey)
chars = unicode(qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'Chars'), '').toString().toUtf8(), 'Utf-8')
params['chars'] = chars if chars else None
grayLevel, ok = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'GrayLevel'), gocr.GrayLevelAuto).toInt()
params['grayLevel'] = grayLevel if (ok and grayLevel >= gocr.GrayLevelMin and grayLevel <= gocr.GrayLevelMax) else None
dustSize,ok = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'DustSize'), gocr.DustSizeAuto).toInt()
params['dustSize'] = dustSize if (ok and dustSize >= gocr.DustSizeMin and dustSize <= gocr.DustSizeMax) else None
wordSpacing,ok = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'WordSpacing'), gocr.WordSpacingAuto).toInt()
params['wordSpacing'] = wordSpacing if (ok and wordSpacing >= gocr.WordSpacingMin and wordSpacing <= gocr.WordSpacingMax) else None
certainty,ok = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'Certainty'), gocr.CertaintyDefault).toInt()
params['certainty'] = certainty if (ok and certainty >= gocr.CertaintyMin and dustSize <= gocr.CertaintyMax) else None
flagLayoutAnalysis = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'FlagLayoutAnalysis'), gocr.FlagLayoutAnalysisDefault).toBool()
params['flagLayoutAnalysis'] = flagLayoutAnalysis
flagContextCorrection = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'flagContextCorrection'), gocr.FlagContextCorrectionDefault).toBool()
params['flagContextCorrection'] = flagContextCorrection
flagCompareUnrecognizedChars = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'flagCompareUnrecognizedChars'), gocr.FlagCompareUnrecognizedCharsDefault).toBool()
params['flagCompareUnrecognizedChars'] = flagCompareUnrecognizedChars
flagCompareUnrecognizedChars = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'flagCompareUnrecognizedChars'), gocr.FlagCompareUnrecognizedCharsDefault).toBool()
params['flagCompareUnrecognizedChars'] = flagCompareUnrecognizedChars
flagDivideOverlappingChars = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'flagDivideOverlappingChars'), gocr.FlagDivideOverlappingCharsDefault).toBool()
params['flagDivideOverlappingChars'] = flagDivideOverlappingChars
flagPackChars = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'flagPackChars'), gocr.FlagPackCharsDefault).toBool()
params['flagPackChars'] = flagPackChars
flagPackChars = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'flagPackChars'), gocr.FlagPackCharsDefault).toBool()
params['flagPackChars'] = flagPackChars
flagInvertImage = qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'flagInvertImage'), gocr.FlagInvertImageDefault).toBool()
params['flagInvertImage'] = flagInvertImage
outputType = unicode(qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'OutputType'), gocr.OutputTypeDefault).toString().toUtf8(), 'Utf-8')
params['outputType'] = outputType if outputType in gocr.OutputTypes else gocr.OutputTypeDefault
outputPattern = unicode(qSettings.value(Tc2Config.settingsKeyJoin(settingsKey, 'OutputPattern'), '').toString().toUtf8(), 'Utf-8')
print outputPattern
params['outputPattern'] = outputPattern
return params
示例2: gocrParamsToQSettings
# 需要导入模块: import Tc2Config [as 别名]
# 或者: from Tc2Config import settingsKeyJoin [as 别名]
def gocrParamsToQSettings(klass, params, qSettings, settingsKey=None):
if isinstance(settingsKey,tuple):
settingsKey = Tc2Config.settingsKeyJoin(*settingsKey)
for name, value in params.items():
key = Tc2Config.settingsKeyJoin(settingsKey, name[0].upper() + name[1:])
qSettings.setValue(key, QtCore.QVariant(value))