2118 @param prefClass preferences class used as the storage area |
2118 @param prefClass preferences class used as the storage area |
2119 """ |
2119 """ |
2120 prefClass.settings.setValue("Editor/Other Fonts/" + key, font.toString()) |
2120 prefClass.settings.setValue("Editor/Other Fonts/" + key, font.toString()) |
2121 |
2121 |
2122 |
2122 |
2123 def getEditorAPI(key, prefClass=Prefs): |
2123 def getEditorAPI(language, projectType="", prefClass=Prefs): |
2124 """ |
2124 """ |
2125 Module function to retrieve the various lists of api files. |
2125 Module function to retrieve the various lists of API files. |
2126 |
2126 |
2127 @param key the key of the value to get |
2127 @param language language of the API list |
2128 @param prefClass preferences class used as the storage area |
2128 @type str |
2129 @return the requested list of api files (list of strings) |
2129 @param projectType project type of the API list |
2130 """ |
2130 @type str |
|
2131 @param prefClass preferences class used as the storage area |
|
2132 @type Prefs |
|
2133 @return requested list of API files |
|
2134 @rtype list of str |
|
2135 """ |
|
2136 if projectType: |
|
2137 key = "{0}_{1}".format(language, projectType) |
|
2138 else: |
|
2139 key = language |
2131 apis = prefClass.settings.value("Editor/APIs/" + key) |
2140 apis = prefClass.settings.value("Editor/APIs/" + key) |
2132 if apis is not None: |
2141 if apis is not None: |
2133 if len(apis) and apis[0] == "": |
2142 if len(apis) and apis[0] == "": |
2134 return [] |
2143 return [] |
2135 else: |
2144 else: |
2136 return apis |
2145 return apis |
2137 else: |
2146 else: |
|
2147 if projectType: |
|
2148 # try again without project type |
|
2149 return getEditorAPI(language, prefClass=prefClass) |
|
2150 |
2138 return [] |
2151 return [] |
2139 |
2152 |
2140 |
2153 |
2141 def setEditorAPI(key, apilist, prefClass=Prefs): |
2154 def setEditorAPI(language, projectType, apilist, prefClass=Prefs): |
2142 """ |
2155 """ |
2143 Module function to store the various lists of api files. |
2156 Module function to store the various lists of API files. |
2144 |
2157 |
2145 @param key the key of the api to be set |
2158 @param language language of the API list |
2146 @param apilist the list of api files (list of strings) |
2159 @type str |
2147 @param prefClass preferences class used as the storage area |
2160 @param projectType project type of the API list |
2148 """ |
2161 @type str |
|
2162 @param apilist list of API files |
|
2163 @type list of str |
|
2164 @param prefClass preferences class used as the storage area |
|
2165 @type Prefs |
|
2166 """ |
|
2167 if projectType: |
|
2168 key = "{0}_{1}".format(language, projectType) |
|
2169 else: |
|
2170 key = language |
2149 prefClass.settings.setValue("Editor/APIs/" + key, apilist) |
2171 prefClass.settings.setValue("Editor/APIs/" + key, apilist) |
2150 |
2172 |
2151 |
2173 |
2152 def getEditorKeywords(key, prefClass=Prefs): |
2174 def getEditorKeywords(key, prefClass=Prefs): |
2153 """ |
2175 """ |