--- a/Preferences/__init__.py Tue Jun 06 19:52:41 2017 +0200 +++ b/Preferences/__init__.py Wed Jun 28 19:14:32 2017 +0200 @@ -125,7 +125,8 @@ # defaults for the UI settings uiDefaults = { - "KeyboardInputInterval": 0, # 0 = use system default + "KeyboardInputInterval": 0, # 0 = use system default + "BackgroundServiceProcesses": 0, # 0 = max. CPUs minus one "Language": "System", "Style": "System", "StyleSheet": "", @@ -1245,6 +1246,7 @@ "MailServerEncryption": "No", # valid values: No, SSL, TLS "MailServerPort": 25, "UseSystemEmailClient": False, + "UseGoogleMailOAuth2": False, "MasterPassword": "", # stores the password hash "UseMasterPassword": False, "SavePasswords": False, @@ -1414,6 +1416,17 @@ hexEditorDefaults["Font"] = "Courier,10,-1,5,50,0,0,0,0,0" else: hexEditorDefaults["Font"] = "Monospace,10,-1,5,50,0,0,0,0,0" + + # defaults for Diff colors + diffColourDefaults = { + "TextColor": QColor(0, 0, 0), + "AddedColor": QColor(190, 237, 190), + "RemovedColor": QColor(237, 190, 190), + "ReplacedColor": QColor(190, 190, 237), + "ContextColor": QColor(255, 220, 168), + "HeaderColor": QColor(237, 237, 190), + "BadWhitespaceColor": QColor(255, 0, 0, 192), + } def readToolGroups(prefClass=Prefs): @@ -1859,7 +1872,8 @@ "ProxyPort/Http", "ProxyPort/Https", "ProxyPort/Ftp", "ProxyType/Ftp", "OpenOnStartup", "PerformVersionCheck", "RecentNumber", "NotificationTimeout", - "SidebarDelay", "KeyboardInputInterval"]: + "SidebarDelay", "KeyboardInputInterval", + "BackgroundServiceProcesses"]: return int(prefClass.settings.value( "UI/" + key, prefClass.uiDefaults[key])) elif key in ["ProxyPassword/Http", "ProxyPassword/Https", @@ -3087,7 +3101,7 @@ return int(prefClass.settings.value( "User/" + key, prefClass.userDefaults[key])) elif key in ["MailServerAuthentication", "UseSystemEmailClient", - "UseMasterPassword", "SavePasswords"]: + "UseMasterPassword", "SavePasswords", "UseGoogleMailOAuth2"]: return toBool(prefClass.settings.value( "User/" + key, prefClass.userDefaults[key])) elif key == "MailServerEncryption": @@ -3450,6 +3464,40 @@ prefClass.settings.setValue("HexEditor/" + key, value.toString()) else: prefClass.settings.setValue("HexEditor/" + key, value) + + +def getDiffColour(key, prefClass=Prefs): + """ + Module function to retrieve the colours for the diff highlighter. + + @param key the key of the value to get + @param prefClass preferences class used as the storage area + @return the requested editor colour + """ + col = prefClass.settings.value("Diff/" + key) + if col is not None: + if len(col) == 9: + # color string with alpha + return QColor.fromRgba(int(col[1:], 16)) + else: + return QColor(col) + else: + return prefClass.diffColourDefaults[key] + + +def setDiffColour(key, value, prefClass=Prefs): + """ + Module function to store the diff highlighter colours. + + @param key the key of the colour to be set + @param value the colour to be set + @param prefClass preferences class used as the storage area + """ + if value.alpha() < 255: + val = "#{0:8x}".format(value.rgba()) + else: + val = value.name() + prefClass.settings.setValue("Diff/" + key, val) def getGeometry(key, prefClass=Prefs):