VCS/ProjectHelper.py

changeset 543
a558e3cb7b5a
parent 538
7f1a56e80124
child 564
b3d966393ba9
equal deleted inserted replaced
541:00e1a5d060c5 543:a558e3cb7b5a
153 self.project.closeProject() 153 self.project.closeProject()
154 projectdir, vcsDataDict = vcsdlg.getData() 154 projectdir, vcsDataDict = vcsdlg.getData()
155 self.project.pdata["VCS"] = [vcsSystem] 155 self.project.pdata["VCS"] = [vcsSystem]
156 self.project.vcs = self.project.initVCS(vcsSystem) 156 self.project.vcs = self.project.initVCS(vcsSystem)
157 # edit VCS command options 157 # edit VCS command options
158 vcores = E5MessageBox.question(self.parent(), 158 vcores = E5MessageBox.yesNo(self.parent(),
159 self.trUtf8("New Project"), 159 self.trUtf8("New Project"),
160 self.trUtf8("""Would you like to edit the VCS command options?"""), 160 self.trUtf8("""Would you like to edit the VCS command options?"""))
161 QMessageBox.StandardButtons(\ 161 if vcores:
162 QMessageBox.No | \
163 QMessageBox.Yes),
164 QMessageBox.No)
165 if vcores == QMessageBox.Yes:
166 codlg = vcsCommandOptionsDialog(self.project.vcs) 162 codlg = vcsCommandOptionsDialog(self.project.vcs)
167 if codlg.exec_() == QDialog.Accepted: 163 if codlg.exec_() == QDialog.Accepted:
168 self.project.vcs.vcsSetOptions(codlg.getOptions()) 164 self.project.vcs.vcsSetOptions(codlg.getOptions())
169 165
170 # create the project directory if it doesn't exist already 166 # create the project directory if it doesn't exist already
210 self.project.pdata["VCS"] = ['None'] 206 self.project.pdata["VCS"] = ['None']
211 self.project.vcs = self.project.initVCS() 207 self.project.vcs = self.project.initVCS()
212 self.project.setDirty(True) 208 self.project.setDirty(True)
213 self.project.saveProject() 209 self.project.saveProject()
214 else: 210 else:
215 res = E5MessageBox.question(self.parent(), 211 res = E5MessageBox.yesNo(self.parent(),
216 self.trUtf8("New project from repository"), 212 self.trUtf8("New project from repository"),
217 self.trUtf8("The project retrieved from the repository" 213 self.trUtf8("The project retrieved from the repository"
218 " does not contain an eric project file" 214 " does not contain an eric project file"
219 " (*.e4p *.e4pz)." 215 " (*.e4p *.e4pz)."
220 " Create it?"), 216 " Create it?"),
221 QMessageBox.StandardButtons(\ 217 yesDefault = True)
222 QMessageBox.No | \ 218 if res:
223 QMessageBox.Yes),
224 QMessageBox.Yes)
225 if res == QMessageBox.Yes:
226 self.project.ppath = projectdir 219 self.project.ppath = projectdir
227 self.project.opened = True 220 self.project.opened = True
228 221
229 from Project.PropertiesDialog import PropertiesDialog 222 from Project.PropertiesDialog import PropertiesDialog
230 dlg = PropertiesDialog(self.project, False) 223 dlg = PropertiesDialog(self.project, False)
241 ms = "" 234 ms = ""
242 self.project.newProjectAddFiles(ms) 235 self.project.newProjectAddFiles(ms)
243 self.project.saveProject() 236 self.project.saveProject()
244 self.project.openProject(self.project.pfile) 237 self.project.openProject(self.project.pfile)
245 if not export: 238 if not export:
246 res = E5MessageBox.question(self.parent(), 239 res = E5MessageBox.yesNo(self.parent(),
247 self.trUtf8("New project from repository"), 240 self.trUtf8("New project from repository"),
248 self.trUtf8("Shall the project file be added to" 241 self.trUtf8("Shall the project file be added to"
249 " the repository?"), 242 " the repository?"),
250 QMessageBox.StandardButtons(\ 243 yesDefault = True)
251 QMessageBox.No | \ 244 if res:
252 QMessageBox.Yes),
253 QMessageBox.Yes)
254 if res == QMessageBox.Yes:
255 self.project.vcs.vcsAdd(self.project.pfile) 245 self.project.vcs.vcsAdd(self.project.pfile)
256 else: 246 else:
257 E5MessageBox.critical(self.parent(), 247 E5MessageBox.critical(self.parent(),
258 self.trUtf8("New project from repository"), 248 self.trUtf8("New project from repository"),
259 self.trUtf8("""The project could not be retrieved from""" 249 self.trUtf8("""The project could not be retrieved from"""
321 if self.project.vcs is not None: 311 if self.project.vcs is not None:
322 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, self.project.name, 1) 312 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, self.project.name, 1)
323 if vcsdlg.exec_() == QDialog.Accepted: 313 if vcsdlg.exec_() == QDialog.Accepted:
324 vcsDataDict = vcsdlg.getData() 314 vcsDataDict = vcsdlg.getData()
325 # edit VCS command options 315 # edit VCS command options
326 vcores = E5MessageBox.question(self.parent(), 316 vcores = E5MessageBox.yesNo(self.parent(),
327 self.trUtf8("Import Project"), 317 self.trUtf8("Import Project"),
328 self.trUtf8("""Would you like to edit the VCS command options?"""), 318 self.trUtf8("""Would you like to edit the VCS command options?"""))
329 QMessageBox.StandardButtons(\ 319 if vcores:
330 QMessageBox.No | \
331 QMessageBox.Yes),
332 QMessageBox.No)
333 if vcores == QMessageBox.Yes:
334 codlg = vcsCommandOptionsDialog(self.project.vcs) 320 codlg = vcsCommandOptionsDialog(self.project.vcs)
335 if codlg.exec_() == QDialog.Accepted: 321 if codlg.exec_() == QDialog.Accepted:
336 self.project.vcs.vcsSetOptions(codlg.getOptions()) 322 self.project.vcs.vcsSetOptions(codlg.getOptions())
337 self.project.setDirty(True) 323 self.project.setDirty(True)
338 self.project.vcs.vcsSetDataFromDict(vcsDataDict) 324 self.project.vcs.vcsSetDataFromDict(vcsDataDict)
354 """ 340 """
355 Protected slot used to update the local project from the repository. 341 Protected slot used to update the local project from the repository.
356 """ 342 """
357 shouldReopen = self.vcs.vcsUpdate(self.project.ppath) 343 shouldReopen = self.vcs.vcsUpdate(self.project.ppath)
358 if shouldReopen: 344 if shouldReopen:
359 res = E5MessageBox.question(self.parent(), 345 res = E5MessageBox.yesNo(self.parent(),
360 self.trUtf8("Update"), 346 self.trUtf8("Update"),
361 self.trUtf8("""The project should be reread. Do this now?"""), 347 self.trUtf8("""The project should be reread. Do this now?"""),
362 QMessageBox.StandardButtons(\ 348 yesDefault = True)
363 QMessageBox.No | \ 349 if res:
364 QMessageBox.Yes),
365 QMessageBox.Yes)
366 if res == QMessageBox.Yes:
367 self.project.reopenProject() 350 self.project.reopenProject()
368 351
369 def _vcsCommit(self): 352 def _vcsCommit(self):
370 """ 353 """
371 Protected slot used to commit changes to the local project to the repository. 354 Protected slot used to commit changes to the local project to the repository.
381 Protected slot used to remove the local project from the repository. 364 Protected slot used to remove the local project from the repository.
382 365
383 Depending on the parameters set in the vcs object the project 366 Depending on the parameters set in the vcs object the project
384 may be removed from the local disk as well. 367 may be removed from the local disk as well.
385 """ 368 """
386 res = E5MessageBox.question(self.parent(), 369 res = E5MessageBox.yesNo(self.parent(),
387 self.trUtf8("Remove project from repository"), 370 self.trUtf8("Remove project from repository"),
388 self.trUtf8("Dou you really want to remove this project from" 371 self.trUtf8("Dou you really want to remove this project from"
389 " the repository (and disk)?"), 372 " the repository (and disk)?"))
390 QMessageBox.StandardButtons(\ 373 if res:
391 QMessageBox.No | \
392 QMessageBox.Yes),
393 QMessageBox.No)
394 if res == QMessageBox.Yes:
395 self.vcs.vcsRemove(self.project.ppath, True) 374 self.vcs.vcsRemove(self.project.ppath, True)
396 self._vcsCommit() 375 self._vcsCommit()
397 if not os.path.exists(self.project.pfile): 376 if not os.path.exists(self.project.pfile):
398 ppath = self.project.ppath 377 ppath = self.project.ppath
399 self.setDirty(False) 378 self.setDirty(False)

eric ide

mercurial