201 break |
201 break |
202 |
202 |
203 if not self.project.closeProject(): |
203 if not self.project.closeProject(): |
204 return |
204 return |
205 |
205 |
206 self.project.pdata["VCS"] = [vcsSystem] |
206 self.project.pdata["VCS"] = vcsSystem |
207 self.project.vcs = self.project.initVCS(vcsSystem) |
207 self.project.vcs = self.project.initVCS(vcsSystem) |
208 if self.project.vcs is not None: |
208 if self.project.vcs is not None: |
209 vcsdlg = self.project.vcs.vcsNewProjectOptionsDialog() |
209 vcsdlg = self.project.vcs.vcsNewProjectOptionsDialog() |
210 if vcsdlg.exec_() == QDialog.Accepted: |
210 if vcsdlg.exec_() == QDialog.Accepted: |
211 projectdir, vcsDataDict = vcsdlg.getData() |
211 projectdir, vcsDataDict = vcsdlg.getData() |
212 self.project.pdata["VCS"] = [vcsSystem] |
212 self.project.pdata["VCS"] = vcsSystem |
213 self.project.vcs = self.project.initVCS(vcsSystem) |
213 self.project.vcs = self.project.initVCS(vcsSystem) |
214 # edit VCS command options |
214 # edit VCS command options |
215 if self.project.vcs.vcsSupportCommandOptions(): |
215 if self.project.vcs.vcsSupportCommandOptions(): |
216 vcores = E5MessageBox.yesNo( |
216 vcores = E5MessageBox.yesNo( |
217 self.parent(), |
217 self.parent(), |
236 self.parent(), |
236 self.parent(), |
237 self.tr("Create project directory"), |
237 self.tr("Create project directory"), |
238 self.tr( |
238 self.tr( |
239 "<p>The project directory <b>{0}</b> could not" |
239 "<p>The project directory <b>{0}</b> could not" |
240 " be created.</p>").format(projectdir)) |
240 " be created.</p>").format(projectdir)) |
241 self.project.pdata["VCS"] = ['None'] |
241 self.project.pdata["VCS"] = 'None' |
242 self.project.vcs = self.project.initVCS() |
242 self.project.vcs = self.project.initVCS() |
243 return |
243 return |
244 |
244 |
245 # create the project from the VCS |
245 # create the project from the VCS |
246 self.project.vcs.vcsSetDataFromDict(vcsDataDict) |
246 self.project.vcs.vcsSetDataFromDict(vcsDataDict) |
269 if ok: |
269 if ok: |
270 self.project.openProject( |
270 self.project.openProject( |
271 QFileInfo(d, pfilename).absoluteFilePath()) |
271 QFileInfo(d, pfilename).absoluteFilePath()) |
272 self.project.newProject.emit() |
272 self.project.newProject.emit() |
273 if export: |
273 if export: |
274 self.project.pdata["VCS"] = ['None'] |
274 self.project.pdata["VCS"] = 'None' |
275 self.project.vcs = self.project.initVCS() |
275 self.project.vcs = self.project.initVCS() |
276 self.project.setDirty(True) |
276 self.project.setDirty(True) |
277 self.project.saveProject() |
277 self.project.saveProject() |
278 else: |
278 else: |
279 res = E5MessageBox.yesNo( |
279 res = E5MessageBox.yesNo( |
296 self.project.initFileTypes() |
296 self.project.initFileTypes() |
297 self.project.setDirty(True) |
297 self.project.setDirty(True) |
298 try: |
298 try: |
299 ms = os.path.join( |
299 ms = os.path.join( |
300 self.project.ppath, |
300 self.project.ppath, |
301 self.project.pdata["MAINSCRIPT"][0]) |
301 self.project.pdata["MAINSCRIPT"]) |
302 if os.path.exists(ms): |
302 if os.path.exists(ms): |
303 self.project.appendFile(ms) |
303 self.project.appendFile(ms) |
304 except IndexError: |
304 except IndexError: |
305 ms = "" |
305 ms = "" |
306 self.project.newProjectAddFiles(ms) |
306 self.project.newProjectAddFiles(ms) |
324 self.parent(), |
324 self.parent(), |
325 self.tr("New project from repository"), |
325 self.tr("New project from repository"), |
326 self.tr( |
326 self.tr( |
327 """The project could not be retrieved from""" |
327 """The project could not be retrieved from""" |
328 """ the repository.""")) |
328 """ the repository.""")) |
329 self.project.pdata["VCS"] = ['None'] |
329 self.project.pdata["VCS"] = 'None' |
330 self.project.vcs = self.project.initVCS() |
330 self.project.vcs = self.project.initVCS() |
331 else: |
331 else: |
332 self.project.pdata["VCS"] = ['None'] |
332 self.project.pdata["VCS"] = 'None' |
333 self.project.vcs = self.project.initVCS() |
333 self.project.vcs = self.project.initVCS() |
334 |
334 |
335 def _vcsExport(self): |
335 def _vcsExport(self): |
336 """ |
336 """ |
337 Protected slot used to export a project from the repository. |
337 Protected slot used to export a project from the repository. |
349 """ |
349 """ |
350 def revertChanges(): |
350 def revertChanges(): |
351 """ |
351 """ |
352 Local function to revert the changes made to the project object. |
352 Local function to revert the changes made to the project object. |
353 """ |
353 """ |
354 self.project.pdata["VCS"] = pdata_vcs[:] |
354 self.project.pdata["VCS"] = pdata_vcs |
355 self.project.pdata["VCSOPTIONS"] = copy.deepcopy(pdata_vcsoptions) |
355 self.project.pdata["VCSOPTIONS"] = copy.deepcopy(pdata_vcsoptions) |
356 self.project.pdata["VCSOTHERDATA"] = copy.deepcopy(pdata_vcsother) |
356 self.project.pdata["VCSOTHERDATA"] = copy.deepcopy(pdata_vcsother) |
357 self.project.vcs = vcs |
357 self.project.vcs = vcs |
358 self.project.vcsProjectHelper = vcsHelper |
358 self.project.vcsProjectHelper = vcsHelper |
359 self.project.vcsBasicHelper = vcs is None |
359 self.project.vcsBasicHelper = vcs is None |
360 self.initMenu(self.project.vcsMenu) |
360 self.initMenu(self.project.vcsMenu) |
361 self.project.setDirty(True) |
361 self.project.setDirty(True) |
362 self.project.saveProject() |
362 self.project.saveProject() |
363 |
363 |
364 pdata_vcs = self.project.pdata["VCS"][:] |
364 pdata_vcs = self.project.pdata["VCS"] |
365 pdata_vcsoptions = copy.deepcopy(self.project.pdata["VCSOPTIONS"]) |
365 pdata_vcsoptions = copy.deepcopy(self.project.pdata["VCSOPTIONS"]) |
366 pdata_vcsother = copy.deepcopy(self.project.pdata["VCSOTHERDATA"]) |
366 pdata_vcsother = copy.deepcopy(self.project.pdata["VCSOTHERDATA"]) |
367 vcs = self.project.vcs |
367 vcs = self.project.vcs |
368 vcsHelper = self.project.vcsProjectHelper |
368 vcsHelper = self.project.vcsProjectHelper |
369 vcsSystemsDict = e5App().getObject("PluginManager")\ |
369 vcsSystemsDict = e5App().getObject("PluginManager")\ |
386 return |
386 return |
387 for vcsSystem, vcsSystemDisplay in list(vcsSystemsDict.items()): |
387 for vcsSystem, vcsSystemDisplay in list(vcsSystemsDict.items()): |
388 if vcsSystemDisplay == vcsSelected: |
388 if vcsSystemDisplay == vcsSelected: |
389 break |
389 break |
390 |
390 |
391 self.project.pdata["VCS"] = [vcsSystem] |
391 self.project.pdata["VCS"] = vcsSystem |
392 self.project.vcs = self.project.initVCS(vcsSystem) |
392 self.project.vcs = self.project.initVCS(vcsSystem) |
393 if self.project.vcs is not None: |
393 if self.project.vcs is not None: |
394 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, |
394 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, |
395 self.project.name, 1) |
395 self.project.name, 1) |
396 if vcsdlg.exec_() == QDialog.Accepted: |
396 if vcsdlg.exec_() == QDialog.Accepted: |