Preferences/__init__.py

changeset 2227
b7aceb255831
parent 2190
abd65b78425e
child 2228
5c59b9393306
--- a/Preferences/__init__.py	Wed Nov 14 18:58:51 2012 +0100
+++ b/Preferences/__init__.py	Sun Nov 25 18:40:15 2012 +0100
@@ -911,6 +911,31 @@
 
     # if true, revert layouts to factory defaults
     resetLayout = False
+    
+    # defaults for IRC
+    ircDefaults = {
+        "ShowTimestamps": True,
+        "TimestampIncludeDate": False,
+        "TimeFormat": "hh:mm",
+        "DateFormat": "yyyy-MM-dd",
+        
+        "NetworkMessageColour": "#0000FF",
+        "ServerMessageColour": "#91640A",
+        "ErrorMessageColour": "#FF0000",
+        "TimestampColour": "#709070",
+        "HyperlinkColour": "#0000FF",
+        "ChannelMessageColour": "#000000",
+        "OwnNickColour": "#000000",
+        "NickColour": "#18B33C",
+        "JoinChannelColour": "#72D672",
+        "LeaveChannelColour": "#B00000",
+        "ChannelInfoColour": "#9E54B3",
+        
+        "ShowNotifications": True,
+        "NotifyJoinPart": True,
+        "NotifyMessage": False,
+        "NotifyNick": False,
+    }
 
 
 def readToolGroups(prefClass=Prefs):
@@ -2535,6 +2560,33 @@
     prefClass.settings.setValue("TrayStarter/" + key, value)
     
 
+def getIrc(key, prefClass=Prefs):
+    """
+    Module function to retrieve the IRC related settings.
+    
+    @param key the key of the value to get
+    @param prefClass preferences class used as the storage area
+    @return the requested user setting
+    """
+    if key in ["TimestampIncludeDate", "ShowTimestamps", "ShowNotifications",
+               "NotifyJoinPart", "NotifyMessage", "NotifyNick"]:
+        return toBool(prefClass.settings.value("IRC/" + key,
+                prefClass.ircDefaults[key]))
+    else:
+        return prefClass.settings.value("IRC/" + key, prefClass.ircDefaults[key])
+
+
+def setIrc(key, value, prefClass=Prefs):
+    """
+    Module function to store the IRC related settings.
+    
+    @param key the key of the setting to be set
+    @param value the value to be set
+    @param prefClass preferences class used as the storage area
+    """
+    prefClass.settings.setValue("IRC/" + key, value)
+
+
 def getGeometry(key, prefClass=Prefs):
     """
     Module function to retrieve the display geometry.

eric ide

mercurial