18 |
18 |
19 from .CommandOptionsDialog import vcsCommandOptionsDialog |
19 from .CommandOptionsDialog import vcsCommandOptionsDialog |
20 from .RepositoryInfoDialog import VcsRepositoryInfoDialog |
20 from .RepositoryInfoDialog import VcsRepositoryInfoDialog |
21 |
21 |
22 from E5Gui.E5Action import E5Action |
22 from E5Gui.E5Action import E5Action |
|
23 from E5Gui import E5MessageBox |
23 |
24 |
24 import Preferences |
25 import Preferences |
25 |
26 |
26 class VcsProjectHelper(QObject): |
27 class VcsProjectHelper(QObject): |
27 """ |
28 """ |
153 self.project.closeProject() |
154 self.project.closeProject() |
154 projectdir, vcsDataDict = vcsdlg.getData() |
155 projectdir, vcsDataDict = vcsdlg.getData() |
155 self.project.pdata["VCS"] = [vcsSystem] |
156 self.project.pdata["VCS"] = [vcsSystem] |
156 self.project.vcs = self.project.initVCS(vcsSystem) |
157 self.project.vcs = self.project.initVCS(vcsSystem) |
157 # edit VCS command options |
158 # edit VCS command options |
158 vcores = QMessageBox.question(None, |
159 vcores = QMessageBox.question(self.parent(), |
159 self.trUtf8("New Project"), |
160 self.trUtf8("New Project"), |
160 self.trUtf8("""Would you like to edit the VCS command options?"""), |
161 self.trUtf8("""Would you like to edit the VCS command options?"""), |
161 QMessageBox.StandardButtons(\ |
162 QMessageBox.StandardButtons(\ |
162 QMessageBox.No | \ |
163 QMessageBox.No | \ |
163 QMessageBox.Yes), |
164 QMessageBox.Yes), |
170 # create the project directory if it doesn't exist already |
171 # create the project directory if it doesn't exist already |
171 if not os.path.isdir(projectdir): |
172 if not os.path.isdir(projectdir): |
172 try: |
173 try: |
173 os.makedirs(projectdir) |
174 os.makedirs(projectdir) |
174 except EnvironmentError: |
175 except EnvironmentError: |
175 QMessageBox.critical(None, |
176 QMessageBox.critical(self.parent(), |
176 self.trUtf8("Create project directory"), |
177 self.trUtf8("Create project directory"), |
177 self.trUtf8("<p>The project directory <b>{0}</b> could not" |
178 self.trUtf8("<p>The project directory <b>{0}</b> could not" |
178 " be created.</p>").format(projectdir)) |
179 " be created.</p>").format(projectdir)) |
179 self.project.pdata["VCS"] = ['None'] |
180 self.project.pdata["VCS"] = ['None'] |
180 self.project.vcs = self.project.initVCS() |
181 self.project.vcs = self.project.initVCS() |
210 self.project.pdata["VCS"] = ['None'] |
211 self.project.pdata["VCS"] = ['None'] |
211 self.project.vcs = self.project.initVCS() |
212 self.project.vcs = self.project.initVCS() |
212 self.project.setDirty(True) |
213 self.project.setDirty(True) |
213 self.project.saveProject() |
214 self.project.saveProject() |
214 else: |
215 else: |
215 res = QMessageBox.question(None, |
216 res = QMessageBox.question(self.parent(), |
216 self.trUtf8("New project from repository"), |
217 self.trUtf8("New project from repository"), |
217 self.trUtf8("The project retrieved from the repository" |
218 self.trUtf8("The project retrieved from the repository" |
218 " does not contain an eric project file" |
219 " does not contain an eric project file" |
219 " (*.e4p *.e4pz)." |
220 " (*.e4p *.e4pz)." |
220 " Create it?"), |
221 " Create it?"), |
241 ms = "" |
242 ms = "" |
242 self.project.newProjectAddFiles(ms) |
243 self.project.newProjectAddFiles(ms) |
243 self.project.saveProject() |
244 self.project.saveProject() |
244 self.project.openProject(self.project.pfile) |
245 self.project.openProject(self.project.pfile) |
245 if not export: |
246 if not export: |
246 res = QMessageBox.question(None, |
247 res = QMessageBox.question(self.parent(), |
247 self.trUtf8("New project from repository"), |
248 self.trUtf8("New project from repository"), |
248 self.trUtf8("Shall the project file be added to" |
249 self.trUtf8("Shall the project file be added to" |
249 " the repository?"), |
250 " the repository?"), |
250 QMessageBox.StandardButtons(\ |
251 QMessageBox.StandardButtons(\ |
251 QMessageBox.No | \ |
252 QMessageBox.No | \ |
252 QMessageBox.Yes), |
253 QMessageBox.Yes), |
253 QMessageBox.Yes) |
254 QMessageBox.Yes) |
254 if res == QMessageBox.Yes: |
255 if res == QMessageBox.Yes: |
255 self.project.vcs.vcsAdd(self.project.pfile) |
256 self.project.vcs.vcsAdd(self.project.pfile) |
256 else: |
257 else: |
257 QMessageBox.critical(None, |
258 QMessageBox.critical(self.parent(), |
258 self.trUtf8("New project from repository"), |
259 self.trUtf8("New project from repository"), |
259 self.trUtf8("""The project could not be retrieved from""" |
260 self.trUtf8("""The project could not be retrieved from""" |
260 """ the repository.""")) |
261 """ the repository.""")) |
261 self.project.pdata["VCS"] = ['None'] |
262 self.project.pdata["VCS"] = ['None'] |
262 self.project.vcs = self.project.initVCS() |
263 self.project.vcs = self.project.initVCS() |
321 if self.project.vcs is not None: |
322 if self.project.vcs is not None: |
322 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, self.project.name, 1) |
323 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, self.project.name, 1) |
323 if vcsdlg.exec_() == QDialog.Accepted: |
324 if vcsdlg.exec_() == QDialog.Accepted: |
324 vcsDataDict = vcsdlg.getData() |
325 vcsDataDict = vcsdlg.getData() |
325 # edit VCS command options |
326 # edit VCS command options |
326 vcores = QMessageBox.question(None, |
327 vcores = QMessageBox.question(self.parent(), |
327 self.trUtf8("Import Project"), |
328 self.trUtf8("Import Project"), |
328 self.trUtf8("""Would you like to edit the VCS command options?"""), |
329 self.trUtf8("""Would you like to edit the VCS command options?"""), |
329 QMessageBox.StandardButtons(\ |
330 QMessageBox.StandardButtons(\ |
330 QMessageBox.No | \ |
331 QMessageBox.No | \ |
331 QMessageBox.Yes), |
332 QMessageBox.Yes), |
354 """ |
355 """ |
355 Protected slot used to update the local project from the repository. |
356 Protected slot used to update the local project from the repository. |
356 """ |
357 """ |
357 shouldReopen = self.vcs.vcsUpdate(self.project.ppath) |
358 shouldReopen = self.vcs.vcsUpdate(self.project.ppath) |
358 if shouldReopen: |
359 if shouldReopen: |
359 res = QMessageBox.information(None, |
360 res = QMessageBox.question(self.parent(), |
360 self.trUtf8("Update"), |
361 self.trUtf8("Update"), |
361 self.trUtf8("""The project should be reread. Do this now?"""), |
362 self.trUtf8("""The project should be reread. Do this now?"""), |
362 QMessageBox.StandardButtons(\ |
363 QMessageBox.StandardButtons(\ |
363 QMessageBox.No | \ |
364 QMessageBox.No | \ |
364 QMessageBox.Yes), |
365 QMessageBox.Yes), |
381 Protected slot used to remove the local project from the repository. |
382 Protected slot used to remove the local project from the repository. |
382 |
383 |
383 Depending on the parameters set in the vcs object the project |
384 Depending on the parameters set in the vcs object the project |
384 may be removed from the local disk as well. |
385 may be removed from the local disk as well. |
385 """ |
386 """ |
386 res = QMessageBox.warning(None, |
387 res = QMessageBox.question(self.parent(), |
387 self.trUtf8("Remove project from repository"), |
388 self.trUtf8("Remove project from repository"), |
388 self.trUtf8("Dou you really want to remove this project from" |
389 self.trUtf8("Dou you really want to remove this project from" |
389 " the repository (and disk)?"), |
390 " the repository (and disk)?"), |
390 QMessageBox.StandardButtons(\ |
391 QMessageBox.StandardButtons(\ |
391 QMessageBox.No | \ |
392 QMessageBox.No | \ |