VCS/ProjectHelper.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3020
542e97d4ecb3
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
166 if vcsdlg.exec_() == QDialog.Accepted: 166 if vcsdlg.exec_() == QDialog.Accepted:
167 projectdir, vcsDataDict = vcsdlg.getData() 167 projectdir, vcsDataDict = vcsdlg.getData()
168 self.project.pdata["VCS"] = [vcsSystem] 168 self.project.pdata["VCS"] = [vcsSystem]
169 self.project.vcs = self.project.initVCS(vcsSystem) 169 self.project.vcs = self.project.initVCS(vcsSystem)
170 # edit VCS command options 170 # edit VCS command options
171 vcores = E5MessageBox.yesNo(self.parent(), 171 vcores = E5MessageBox.yesNo(
172 self.parent(),
172 self.trUtf8("New Project"), 173 self.trUtf8("New Project"),
173 self.trUtf8( 174 self.trUtf8(
174 """Would you like to edit the VCS command options?""")) 175 """Would you like to edit the VCS command options?"""))
175 if vcores: 176 if vcores:
176 from .CommandOptionsDialog import vcsCommandOptionsDialog 177 from .CommandOptionsDialog import vcsCommandOptionsDialog
181 # create the project directory if it doesn't exist already 182 # create the project directory if it doesn't exist already
182 if not os.path.isdir(projectdir): 183 if not os.path.isdir(projectdir):
183 try: 184 try:
184 os.makedirs(projectdir) 185 os.makedirs(projectdir)
185 except EnvironmentError: 186 except EnvironmentError:
186 E5MessageBox.critical(self.parent(), 187 E5MessageBox.critical(
188 self.parent(),
187 self.trUtf8("Create project directory"), 189 self.trUtf8("Create project directory"),
188 self.trUtf8( 190 self.trUtf8(
189 "<p>The project directory <b>{0}</b> could not" 191 "<p>The project directory <b>{0}</b> could not"
190 " be created.</p>").format(projectdir)) 192 " be created.</p>").format(projectdir))
191 self.project.pdata["VCS"] = ['None'] 193 self.project.pdata["VCS"] = ['None']
224 self.project.pdata["VCS"] = ['None'] 226 self.project.pdata["VCS"] = ['None']
225 self.project.vcs = self.project.initVCS() 227 self.project.vcs = self.project.initVCS()
226 self.project.setDirty(True) 228 self.project.setDirty(True)
227 self.project.saveProject() 229 self.project.saveProject()
228 else: 230 else:
229 res = E5MessageBox.yesNo(self.parent(), 231 res = E5MessageBox.yesNo(
232 self.parent(),
230 self.trUtf8("New project from repository"), 233 self.trUtf8("New project from repository"),
231 self.trUtf8( 234 self.trUtf8(
232 "The project retrieved from the repository" 235 "The project retrieved from the repository"
233 " does not contain an eric project file" 236 " does not contain an eric project file"
234 " (*.e4p). Create it?"), 237 " (*.e4p). Create it?"),
342 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, 345 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project,
343 self.project.name, 1) 346 self.project.name, 1)
344 if vcsdlg.exec_() == QDialog.Accepted: 347 if vcsdlg.exec_() == QDialog.Accepted:
345 vcsDataDict = vcsdlg.getData() 348 vcsDataDict = vcsdlg.getData()
346 # edit VCS command options 349 # edit VCS command options
347 vcores = E5MessageBox.yesNo(self.parent(), 350 vcores = E5MessageBox.yesNo(
351 self.parent(),
348 self.trUtf8("Import Project"), 352 self.trUtf8("Import Project"),
349 self.trUtf8( 353 self.trUtf8(
350 """Would you like to edit the VCS command options?""")) 354 """Would you like to edit the VCS command options?"""))
351 if vcores: 355 if vcores:
352 from .CommandOptionsDialog import vcsCommandOptionsDialog 356 from .CommandOptionsDialog import vcsCommandOptionsDialog
373 """ 377 """
374 Protected slot used to update the local project from the repository. 378 Protected slot used to update the local project from the repository.
375 """ 379 """
376 shouldReopen = self.vcs.vcsUpdate(self.project.ppath) 380 shouldReopen = self.vcs.vcsUpdate(self.project.ppath)
377 if shouldReopen: 381 if shouldReopen:
378 res = E5MessageBox.yesNo(self.parent(), 382 res = E5MessageBox.yesNo(
383 self.parent(),
379 self.trUtf8("Update"), 384 self.trUtf8("Update"),
380 self.trUtf8("""The project should be reread. Do this now?"""), 385 self.trUtf8("""The project should be reread. Do this now?"""),
381 yesDefault=True) 386 yesDefault=True)
382 if res: 387 if res:
383 self.project.reopenProject() 388 self.project.reopenProject()
398 Protected slot used to remove the local project from the repository. 403 Protected slot used to remove the local project from the repository.
399 404
400 Depending on the parameters set in the vcs object the project 405 Depending on the parameters set in the vcs object the project
401 may be removed from the local disk as well. 406 may be removed from the local disk as well.
402 """ 407 """
403 res = E5MessageBox.yesNo(self.parent(), 408 res = E5MessageBox.yesNo(
409 self.parent(),
404 self.trUtf8("Remove project from repository"), 410 self.trUtf8("Remove project from repository"),
405 self.trUtf8("Dou you really want to remove this project from" 411 self.trUtf8("Dou you really want to remove this project from"
406 " the repository (and disk)?")) 412 " the repository (and disk)?"))
407 if res: 413 if res:
408 self.vcs.vcsRemove(self.project.ppath, True) 414 self.vcs.vcsRemove(self.project.ppath, True)
458 """ 464 """
459 Protected slot used to switch the local project to another tag/branch. 465 Protected slot used to switch the local project to another tag/branch.
460 """ 466 """
461 shouldReopen = self.vcs.vcsSwitch(self.project.ppath) 467 shouldReopen = self.vcs.vcsSwitch(self.project.ppath)
462 if shouldReopen: 468 if shouldReopen:
463 res = E5MessageBox.yesNo(self.parent(), 469 res = E5MessageBox.yesNo(
470 self.parent(),
464 self.trUtf8("Switch"), 471 self.trUtf8("Switch"),
465 self.trUtf8("""The project should be reread. Do this now?"""), 472 self.trUtf8("""The project should be reread. Do this now?"""),
466 yesDefault=True) 473 yesDefault=True)
467 if res: 474 if res:
468 self.project.reopenProject() 475 self.project.reopenProject()

eric ide

mercurial