RefactoringRope/FileSystemCommands.py

changeset 20
83b71483e198
parent 1
9f687137a929
child 35
79e19b499675
equal deleted inserted replaced
19:32dd7dbf3e8e 20:83b71483e198
10 import os 10 import os
11 11
12 import rope.base.fscommands 12 import rope.base.fscommands
13 13
14 from E5Gui.E5Application import e5App 14 from E5Gui.E5Application import e5App
15
15 16
16 class e5FileSystemCommands(object): 17 class e5FileSystemCommands(object):
17 """ 18 """
18 Class implementing file system commands for rope. 19 Class implementing file system commands for rope.
19 """ 20 """
34 """ 35 """
35 self.__normal_actions.create_file(path) 36 self.__normal_actions.create_file(path)
36 self.__project.appendFile(path) 37 self.__project.appendFile(path)
37 vcs = self.__project.getVcs() 38 vcs = self.__project.getVcs()
38 if vcs is not None: 39 if vcs is not None:
39 vcs.vcsAdd(path, noDialog = True) 40 vcs.vcsAdd(path, noDialog=True)
40 41
41 def create_folder(self, path): 42 def create_folder(self, path):
42 """ 43 """
43 Public method called by rope to create a new directory. 44 Public method called by rope to create a new directory.
44 45
45 @param path new directory (string) 46 @param path new directory (string)
46 """ 47 """
47 self.__normal_actions.create_folder(path) 48 self.__normal_actions.create_folder(path)
48 vcs = self.__project.getVcs() 49 vcs = self.__project.getVcs()
49 if vcs is not None: 50 if vcs is not None:
50 vcs.vcsAdd(path, noDialog = True) 51 vcs.vcsAdd(path, noDialog=True)
51 52
52 def move(self, path, new_location): 53 def move(self, path, new_location):
53 """ 54 """
54 Public method called by rope to rename a file or directory. 55 Public method called by rope to rename a file or directory.
55 56
61 if os.path.isdir(path): 62 if os.path.isdir(path):
62 self.__project.moveDirectory(path, new_location) 63 self.__project.moveDirectory(path, new_location)
63 else: 64 else:
64 self.__project.renameFile(path, new_location) 65 self.__project.renameFile(path, new_location)
65 else: 66 else:
66 vcs.vcsMove(path, self.__project, new_location, noDialog = True) 67 vcs.vcsMove(path, self.__project, new_location, noDialog=True)
67 68
68 def remove(self, path): 69 def remove(self, path):
69 """ 70 """
70 Public method called by rope to remove a file or directory. 71 Public method called by rope to remove a file or directory.
71 72
78 else: 79 else:
79 e5App().getObject("ViewManager").closeWindow(path) 80 e5App().getObject("ViewManager").closeWindow(path)
80 self.__project.removeFile(path) 81 self.__project.removeFile(path)
81 self.__normal_actions.remove(path) 82 self.__normal_actions.remove(path)
82 else: 83 else:
83 vcs.vcsRemove(path, noDialog = True) 84 vcs.vcsRemove(path, noDialog=True)
84 85
85 def write(self, path, data): 86 def write(self, path, data):
86 """ 87 """
87 Public method called by rope to write data to a file. 88 Public method called by rope to write data to a file.
88 89

eric ide

mercurial