Preferences/__init__.py

changeset 149
a134031209be
parent 140
64f805e1f105
child 162
28f235c426c4
--- a/Preferences/__init__.py	Sat Mar 20 13:14:56 2010 +0000
+++ b/Preferences/__init__.py	Sun Mar 21 19:34:15 2010 +0000
@@ -85,6 +85,7 @@
     }
     debuggerDefaults["AllowedHosts"] = ["127.0.0.1", "::1%0"]
     
+    # defaults for the UI settings
     uiDefaults = {
         "Language" : "System",
         "Style" : "System",
@@ -113,15 +114,15 @@
         "TabViewManagerFilenameOnly" : True, 
         # the order in ViewProfiles is Project-Viewer, File-Browser,
         # Debug-Viewer, Python-Shell, Log-Viewer, Task-Viewer,
-        # Templates-Viewer, Multiproject-Viewer, Terminal
+        # Templates-Viewer, Multiproject-Viewer, Terminal, Chat
         "ViewProfiles" : {
             "edit"  : [
                     # visibility (0)
-                    [ True,  False,  False,  True,  True,  True,  True,  True, True],
+                    [ True, False, False, True, True, True, True,  True,  True, True],
                     # saved state main window with dock windows (1)
                     b"",
                     # saved states floating windows (2)
-                    [b"", b"", b"", b"", b"", b"", b"", b"", b""],
+                    [b"", b"", b"", b"", b"", b"", b"", b"", b"", b""],
                     # saved state main window with floating windows (3)
                     b"", 
                     # saved state main window with toolbox windows (4)
@@ -134,11 +135,11 @@
                 ],
             "debug" : [
                     # visibility (0)
-                    [ False,  False,  True,  True,  True,  True,  False,  False, True], 
+                    [ False, False, True, True, True, True, False, False, True, True], 
                     # saved state main window with dock windows (1)
                     b"",
                     # saved states floating windows (2)
-                    [b"", b"", b"", b"", b"", b"", b"", b"", b""],
+                    [b"", b"", b"", b"", b"", b"", b"", b"", b"", b""],
                     # saved state main window with floating windows (3)
                     b"", 
                     # saved state main window with toolbox windows (4)
@@ -193,6 +194,14 @@
         "Path" : [],
     }
     
+    # defaults for the cooperation settings
+    cooperationDefaults = {
+        "ServerPort" : 42000, 
+        "AutoStartServer" : False,
+        "TryOtherPorts" : True, 
+        "MaxPortsToTry" : 100, 
+    }
+    
     # defaults for the editor settings
     editorDefaults = {
         "AutosaveInterval" : 0,
@@ -1151,6 +1160,34 @@
     """
     prefClass.settings.setValue("UI/Icons/" + key, value)
     
+def getCooperation(key, prefClass = Prefs):
+    """
+    Module function to retrieve the various Cooperation settings.
+    
+    @param key the key of the value to get
+    @param prefClass preferences class used as the storage area
+    @return the requested UI setting
+    """
+    if key in ["AutoStartServer", "TryOtherPorts"]:
+        return toBool(prefClass.settings.value("Cooperation/" + key,
+            prefClass.cooperationDefaults[key]))
+    elif key in ["ServerPort", "MaxPortsToTry"]:
+        return int(prefClass.settings.value("Cooperation/" + key,
+            prefClass.cooperationDefaults[key]))
+    else:
+        return prefClass.settings.value("Cooperation/" + key, 
+            prefClass.cooperationDefaults[key])
+    
+def setCooperation(key, value, prefClass = Prefs):
+    """
+    Module function to store the various Cooperation 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("Cooperation/" + key, value)
+
 def getEditor(key, prefClass = Prefs):
     """
     Module function to retrieve the various editor settings.

eric ide

mercurial