RefactoringRope/FileSystemCommands.py

branch
eric7
changeset 413
a4cba20ad7ab
parent 412
6fa5892b9097
child 426
7592a1c052e8
equal deleted inserted replaced
412:6fa5892b9097 413:a4cba20ad7ab
7 Module implementing file system commands for rope. 7 Module implementing file system commands for rope.
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 import rope.base.fscommands
13
12 14
13 class RefactoringClientFileSystemCommands: 15 class RefactoringClientFileSystemCommands:
14 """ 16 """
15 Class implementing the client side of the rope file system commands. 17 Class implementing the client side of the rope file system commands.
16 """ 18 """
20 Constructor 22 Constructor
21 23
22 @param client reference to the refactoring client 24 @param client reference to the refactoring client
23 @type RefactoringClient 25 @type RefactoringClient
24 """ 26 """
25 import rope.base.fscommands
26
27 self.__client = client 27 self.__client = client
28 self.__normal_actions = rope.base.fscommands.FileSystemCommands() 28 self.__normal_actions = rope.base.fscommands.FileSystemCommands()
29 29
30 def create_file(self, path): 30 def create_file(self, path):
31 """ 31 """
98 Public method called by rope to write data to a file. 98 Public method called by rope to write data to a file.
99 99
100 @param path filename of file to write to 100 @param path filename of file to write to
101 @type str 101 @type str
102 @param data data to be written 102 @param data data to be written
103 @type Any
103 """ 104 """
104 self.__normal_actions.write(path, data) 105 self.__normal_actions.write(path, data)
105 106
106 107
107 class EricFileSystemCommands: 108 class EricFileSystemCommands:
182 183
183 def __remove(self, path): 184 def __remove(self, path):
184 """ 185 """
185 Private method called by rope to remove a file or directory. 186 Private method called by rope to remove a file or directory.
186 187
187 @param path name of file/directory to remove (string) 188 @param path name of file/directory to remove
188 """ 189 @type str
190 """
191 from eric7.EricWidgets.EricApplication import ericApp
192
189 vcs = self.__project.getVcs() 193 vcs = self.__project.getVcs()
190 if vcs is None: 194 if vcs is None:
191 if os.path.isdir(path): 195 if os.path.isdir(path):
192 self.__project.removeDirectory(path) 196 self.__project.removeDirectory(path)
193 else: 197 else:
194 from EricWidgets.EricApplication import ericApp
195
196 ericApp().getObject("ViewManager").closeWindow(path) 198 ericApp().getObject("ViewManager").closeWindow(path)
197 self.__project.removeFile(path) 199 self.__project.removeFile(path)
198 else: 200 else:
199 vcs.vcsRemove(path, noDialog=True) 201 vcs.vcsRemove(path, noDialog=True)

eric ide

mercurial