VCS/ProjectHelper.py

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

eric ide

mercurial