Preferences/__init__.py

branch
5_3_x
changeset 2475
c74e1cff7f3f
parent 2413
9665ab434ab1
child 2504
19e46c77e006
equal deleted inserted replaced
2473:c9f484ea061b 2475:c74e1cff7f3f
32 from E5Network.E5Ftp import E5FtpProxyType 32 from E5Network.E5Ftp import E5FtpProxyType
33 33
34 import QScintilla.Lexers 34 import QScintilla.Lexers
35 35
36 from Globals import settingsNameOrganization, settingsNameGlobal, settingsNameRecent, \ 36 from Globals import settingsNameOrganization, settingsNameGlobal, settingsNameRecent, \
37 isWindowsPlatform, isLinuxPlatform, findPython2Interpreters 37 isWindowsPlatform, findPython2Interpreters
38 38
39 from Project.ProjectBrowserFlags import SourcesBrowserFlag, FormsBrowserFlag, \ 39 from Project.ProjectBrowserFlags import SourcesBrowserFlag, FormsBrowserFlag, \
40 ResourcesBrowserFlag, TranslationsBrowserFlag, InterfacesBrowserFlag, \ 40 ResourcesBrowserFlag, TranslationsBrowserFlag, InterfacesBrowserFlag, \
41 OthersBrowserFlag, AllBrowsersFlag 41 OthersBrowserFlag, AllBrowsersFlag
42 42
811 "UseMonospacedFont": False, 811 "UseMonospacedFont": False,
812 "MonospacedFont": "Courier,10,-1,5,50,0,0,0,0,0", 812 "MonospacedFont": "Courier,10,-1,5,50,0,0,0,0,0",
813 "MarginsFont": "Sans Serif,10,-1,5,50,0,0,0,0,0", 813 "MarginsFont": "Sans Serif,10,-1,5,50,0,0,0,0,0",
814 } 814 }
815 815
816 # defaults for the terminal settings
817 terminalDefaults = {
818 "LinenoWidth": 4,
819 "LinenoMargin": True,
820 "MaxHistoryEntries": 100,
821 "SyntaxHighlightingEnabled": True,
822 "Shell": "",
823 "ShellInteractive": True,
824 "UseMonospacedFont": False,
825 "MonospacedFont": "Courier,10,-1,5,50,0,0,0,0,0",
826 "MarginsFont": "Sans Serif,10,-1,5,50,0,0,0,0,0",
827 }
828 if isLinuxPlatform():
829 terminalDefaults["Shell"] = "bash"
830
831 # defaults for Qt related stuff 816 # defaults for Qt related stuff
832 qtDefaults = { 817 qtDefaults = {
833 "Qt4TranslationsDir": "", 818 "Qt4TranslationsDir": "",
834 "QtToolsPrefix4": "", 819 "QtToolsPrefix4": "",
835 "QtToolsPostfix4": "", 820 "QtToolsPostfix4": "",
1902 """ 1887 """
1903 if key in ["MonospacedFont", "MarginsFont"]: 1888 if key in ["MonospacedFont", "MarginsFont"]:
1904 prefClass.settings.setValue("Shell/" + key, value.toString()) 1889 prefClass.settings.setValue("Shell/" + key, value.toString())
1905 else: 1890 else:
1906 prefClass.settings.setValue("Shell/" + key, value) 1891 prefClass.settings.setValue("Shell/" + key, value)
1907
1908
1909 def getTerminal(key, prefClass=Prefs):
1910 """
1911 Module function to retrieve the various terminal settings.
1912
1913 @param key the key of the value to get
1914 @param prefClass preferences class used as the storage area
1915 @return the requested shell setting
1916 """
1917 if key in ["Shell"]:
1918 return prefClass.settings.value("Terminal/" + key,
1919 prefClass.terminalDefaults[key])
1920 elif key in ["MonospacedFont", "MarginsFont"]:
1921 f = QFont()
1922 f.fromString(prefClass.settings.value("Terminal/" + key,
1923 prefClass.terminalDefaults[key]))
1924 return f
1925 elif key in ["LinenoWidth", "MaxHistoryEntries"]:
1926 return int(prefClass.settings.value("Terminal/" + key,
1927 prefClass.terminalDefaults[key]))
1928 else:
1929 return toBool(prefClass.settings.value("Terminal/" + key,
1930 prefClass.terminalDefaults[key]))
1931
1932
1933 def setTerminal(key, value, prefClass=Prefs):
1934 """
1935 Module function to store the various terminal settings.
1936
1937 @param key the key of the setting to be set
1938 @param value the value to be set
1939 @param prefClass preferences class used as the storage area
1940 """
1941 if key in ["MonospacedFont", "MarginsFont"]:
1942 prefClass.settings.setValue("Terminal/" + key, value.toString())
1943 else:
1944 prefClass.settings.setValue("Terminal/" + key, value)
1945 1892
1946 1893
1947 def getProject(key, prefClass=Prefs): 1894 def getProject(key, prefClass=Prefs):
1948 """ 1895 """
1949 Module function to retrieve the various project handling settings. 1896 Module function to retrieve the various project handling settings.

eric ide

mercurial