RefactoringRope/RefactoringServer.py

branch
eric7
changeset 394
b34f5dd3db27
parent 392
b9b0a462123d
child 396
933b8fcd854f
equal deleted inserted replaced
393:8b554b390d6f 394:b34f5dd3db27
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 """
2319 [execPath, clientEnv["PATH"]] 2321 [execPath, clientEnv["PATH"]]
2320 ) 2322 )
2321 else: 2323 else:
2322 clientEnv["PATH"] = execPath 2324 clientEnv["PATH"] = execPath
2323 else: 2325 else:
2324 interpreter = "" 2326 interpreter = Globals.getPythonExecutable()
2325 if interpreter: 2327 if interpreter:
2326 if isRemote: 2328 if isRemote:
2327 self.__ui.appendToStderr( 2329 self.__ui.appendToStderr(
2328 self.tr( 2330 self.tr(
2329 "The project is configured for remote access." 2331 "The project is configured for remote access."

eric ide

mercurial