2105 """by a new default configuration?""" |
2105 """by a new default configuration?""" |
2106 ), |
2106 ), |
2107 ) |
2107 ) |
2108 if res: |
2108 if res: |
2109 src = self.__defaultConfig() |
2109 src = self.__defaultConfig() |
2110 cname = self.__ropeConfigFile() |
2110 cname = self.__ropeConfigFile(writing=True) |
2111 if src != "" and cname is not None: |
2111 if src != "" and cname is not None: |
2112 try: |
2112 try: |
2113 with open(cname, "w") as f: |
2113 with open(cname, "w") as f: |
2114 f.write(src) |
2114 f.write(src) |
2115 self.__configChanged() |
2115 self.__configChanged() |
2219 """ |
2219 """ |
2220 self.__ropeConfig = params |
2220 self.__ropeConfig = params |
2221 # keys: RopeFolderName, DefaultConfig, RopeHelpFile, |
2221 # keys: RopeFolderName, DefaultConfig, RopeHelpFile, |
2222 # RopeInfo, RopeVersion, RopeCopyright, PythonVersion |
2222 # RopeInfo, RopeVersion, RopeCopyright, PythonVersion |
2223 |
2223 |
2224 def __ropeConfigFile(self): |
2224 def __ropeConfigFile(self, writing=False): |
2225 """ |
2225 """ |
2226 Private method to get the name of the rope configuration file. |
2226 Private method to get the name of the rope configuration file. |
2227 |
2227 |
|
2228 @param writing flag indicating to get the name for writing (defaults to False) |
|
2229 @type bool (optional) |
2228 @return name of the rope configuration file |
2230 @return name of the rope configuration file |
2229 @rtype str |
2231 @rtype str |
2230 """ |
2232 """ |
2231 configfile = None |
2233 configfile = None |
2232 if self.__ropeConfig: |
2234 if self.__ropeConfig: |
2233 ropedir = self.__ropeConfig["RopeFolderName"] |
2235 ropedir = self.__ropeConfig["RopeFolderName"] |
2234 if ropedir: |
2236 if ropedir: |
2235 configfile = os.path.join(ropedir, "config.py") |
2237 configfile = os.path.join(ropedir, "config.py") |
2236 if not os.path.exists(configfile): |
2238 if not writing and not os.path.exists(configfile): |
2237 configfile = None |
2239 configfile = None |
2238 return configfile |
2240 return configfile |
2239 |
2241 |
2240 def __configChanged(self): |
2242 def __configChanged(self): |
2241 """ |
2243 """ |