62 def initActions(self): |
62 def initActions(self): |
63 """ |
63 """ |
64 Public method to generate the action objects. |
64 Public method to generate the action objects. |
65 """ |
65 """ |
66 self.vcsNewAct = E5Action( |
66 self.vcsNewAct = E5Action( |
67 self.trUtf8('New from repository'), |
67 self.tr('New from repository'), |
68 self.trUtf8('&New from repository...'), |
68 self.tr('&New from repository...'), |
69 0, 0, self, 'vcs_new') |
69 0, 0, self, 'vcs_new') |
70 self.vcsNewAct.setStatusTip(self.trUtf8( |
70 self.vcsNewAct.setStatusTip(self.tr( |
71 'Create a new project from the VCS repository' |
71 'Create a new project from the VCS repository' |
72 )) |
72 )) |
73 self.vcsNewAct.setWhatsThis(self.trUtf8( |
73 self.vcsNewAct.setWhatsThis(self.tr( |
74 """<b>New from repository</b>""" |
74 """<b>New from repository</b>""" |
75 """<p>This creates a new local project from the VCS""" |
75 """<p>This creates a new local project from the VCS""" |
76 """ repository.</p>""" |
76 """ repository.</p>""" |
77 )) |
77 )) |
78 self.vcsNewAct.triggered[()].connect(self._vcsCheckout) |
78 self.vcsNewAct.triggered.connect(self._vcsCheckout) |
79 self.actions.append(self.vcsNewAct) |
79 self.actions.append(self.vcsNewAct) |
80 |
80 |
81 self.vcsExportAct = E5Action( |
81 self.vcsExportAct = E5Action( |
82 self.trUtf8('Export from repository'), |
82 self.tr('Export from repository'), |
83 self.trUtf8('&Export from repository...'), |
83 self.tr('&Export from repository...'), |
84 0, 0, self, 'vcs_export') |
84 0, 0, self, 'vcs_export') |
85 self.vcsExportAct.setStatusTip(self.trUtf8( |
85 self.vcsExportAct.setStatusTip(self.tr( |
86 'Export a project from the repository' |
86 'Export a project from the repository' |
87 )) |
87 )) |
88 self.vcsExportAct.setWhatsThis(self.trUtf8( |
88 self.vcsExportAct.setWhatsThis(self.tr( |
89 """<b>Export from repository</b>""" |
89 """<b>Export from repository</b>""" |
90 """<p>This exports a project from the repository.</p>""" |
90 """<p>This exports a project from the repository.</p>""" |
91 )) |
91 )) |
92 self.vcsExportAct.triggered[()].connect(self._vcsExport) |
92 self.vcsExportAct.triggered.connect(self._vcsExport) |
93 self.actions.append(self.vcsExportAct) |
93 self.actions.append(self.vcsExportAct) |
94 |
94 |
95 self.vcsAddAct = E5Action( |
95 self.vcsAddAct = E5Action( |
96 self.trUtf8('Add to repository'), |
96 self.tr('Add to repository'), |
97 self.trUtf8('&Add to repository...'), |
97 self.tr('&Add to repository...'), |
98 0, 0, self, 'vcs_add') |
98 0, 0, self, 'vcs_add') |
99 self.vcsAddAct.setStatusTip(self.trUtf8( |
99 self.vcsAddAct.setStatusTip(self.tr( |
100 'Add the local project to the VCS repository' |
100 'Add the local project to the VCS repository' |
101 )) |
101 )) |
102 self.vcsAddAct.setWhatsThis(self.trUtf8( |
102 self.vcsAddAct.setWhatsThis(self.tr( |
103 """<b>Add to repository</b>""" |
103 """<b>Add to repository</b>""" |
104 """<p>This adds (imports) the local project to the VCS""" |
104 """<p>This adds (imports) the local project to the VCS""" |
105 """ repository.</p>""" |
105 """ repository.</p>""" |
106 )) |
106 )) |
107 self.vcsAddAct.triggered[()].connect(self._vcsImport) |
107 self.vcsAddAct.triggered.connect(self._vcsImport) |
108 self.actions.append(self.vcsAddAct) |
108 self.actions.append(self.vcsAddAct) |
109 |
109 |
110 def initMenu(self, menu): |
110 def initMenu(self, menu): |
111 """ |
111 """ |
112 Public method to generate the VCS menu. |
112 Public method to generate the VCS menu. |
170 if vcsdlg.exec_() == QDialog.Accepted: |
171 if vcsdlg.exec_() == QDialog.Accepted: |
171 projectdir, vcsDataDict = vcsdlg.getData() |
172 projectdir, vcsDataDict = vcsdlg.getData() |
172 self.project.pdata["VCS"] = [vcsSystem] |
173 self.project.pdata["VCS"] = [vcsSystem] |
173 self.project.vcs = self.project.initVCS(vcsSystem) |
174 self.project.vcs = self.project.initVCS(vcsSystem) |
174 # edit VCS command options |
175 # edit VCS command options |
175 vcores = E5MessageBox.yesNo( |
176 if self.project.vcs.vcsSupportCommandOptions(): |
176 self.parent(), |
177 vcores = E5MessageBox.yesNo( |
177 self.trUtf8("New Project"), |
178 self.parent(), |
178 self.trUtf8( |
179 self.tr("New Project"), |
179 """Would you like to edit the VCS command options?""")) |
180 self.tr( |
|
181 """Would you like to edit the VCS command""" |
|
182 """ options?""")) |
|
183 else: |
|
184 vcores = False |
180 if vcores: |
185 if vcores: |
181 from .CommandOptionsDialog import VcsCommandOptionsDialog |
186 from .CommandOptionsDialog import VcsCommandOptionsDialog |
182 codlg = VcsCommandOptionsDialog(self.project.vcs) |
187 codlg = VcsCommandOptionsDialog(self.project.vcs) |
183 if codlg.exec_() == QDialog.Accepted: |
188 if codlg.exec_() == QDialog.Accepted: |
184 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
189 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
217 self.project.newProject.emit() |
222 self.project.newProject.emit() |
218 else: |
223 else: |
219 pfilenamelist = d.entryList(filters) |
224 pfilenamelist = d.entryList(filters) |
220 pfilename, ok = QInputDialog.getItem( |
225 pfilename, ok = QInputDialog.getItem( |
221 None, |
226 None, |
222 self.trUtf8("New project from repository"), |
227 self.tr("New project from repository"), |
223 self.trUtf8("Select a project file to open."), |
228 self.tr("Select a project file to open."), |
224 pfilenamelist, 0, False) |
229 pfilenamelist, 0, False) |
225 if ok: |
230 if ok: |
226 self.project.openProject( |
231 self.project.openProject( |
227 QFileInfo(d, pfilename).absoluteFilePath()) |
232 QFileInfo(d, pfilename).absoluteFilePath()) |
228 self.project.newProject.emit() |
233 self.project.newProject.emit() |
264 self.project.saveProject() |
269 self.project.saveProject() |
265 self.project.openProject(self.project.pfile) |
270 self.project.openProject(self.project.pfile) |
266 if not export: |
271 if not export: |
267 res = E5MessageBox.yesNo( |
272 res = E5MessageBox.yesNo( |
268 self.parent(), |
273 self.parent(), |
269 self.trUtf8( |
274 self.tr( |
270 "New project from repository"), |
275 "New project from repository"), |
271 self.trUtf8( |
276 self.tr( |
272 "Shall the project file be added" |
277 "Shall the project file be added" |
273 " to the repository?"), |
278 " to the repository?"), |
274 yesDefault=True) |
279 yesDefault=True) |
275 if res: |
280 if res: |
276 self.project.vcs.vcsAdd( |
281 self.project.vcs.vcsAdd( |
277 self.project.pfile) |
282 self.project.pfile) |
278 else: |
283 else: |
279 E5MessageBox.critical( |
284 E5MessageBox.critical( |
280 self.parent(), |
285 self.parent(), |
281 self.trUtf8("New project from repository"), |
286 self.tr("New project from repository"), |
282 self.trUtf8( |
287 self.tr( |
283 """The project could not be retrieved from""" |
288 """The project could not be retrieved from""" |
284 """ the repository.""")) |
289 """ the repository.""")) |
285 self.project.pdata["VCS"] = ['None'] |
290 self.project.pdata["VCS"] = ['None'] |
286 self.project.vcs = self.project.initVCS() |
291 self.project.vcs = self.project.initVCS() |
287 else: |
292 else: |
350 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, |
355 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, |
351 self.project.name, 1) |
356 self.project.name, 1) |
352 if vcsdlg.exec_() == QDialog.Accepted: |
357 if vcsdlg.exec_() == QDialog.Accepted: |
353 vcsDataDict = vcsdlg.getData() |
358 vcsDataDict = vcsdlg.getData() |
354 # edit VCS command options |
359 # edit VCS command options |
355 vcores = E5MessageBox.yesNo( |
360 if self.project.vcs.vcsSupportCommandOptions(): |
356 self.parent(), |
361 vcores = E5MessageBox.yesNo( |
357 self.trUtf8("Import Project"), |
362 self.parent(), |
358 self.trUtf8( |
363 self.tr("Import Project"), |
359 """Would you like to edit the VCS command options?""")) |
364 self.tr( |
|
365 """Would you like to edit the VCS command""" |
|
366 """ options?""")) |
|
367 else: |
|
368 vcores = False |
360 if vcores: |
369 if vcores: |
361 from .CommandOptionsDialog import VcsCommandOptionsDialog |
370 from .CommandOptionsDialog import VcsCommandOptionsDialog |
362 codlg = VcsCommandOptionsDialog(self.project.vcs) |
371 codlg = VcsCommandOptionsDialog(self.project.vcs) |
363 if codlg.exec_() == QDialog.Accepted: |
372 if codlg.exec_() == QDialog.Accepted: |
364 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
373 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
427 |
436 |
428 def _vcsCommandOptions(self): |
437 def _vcsCommandOptions(self): |
429 """ |
438 """ |
430 Protected slot to edit the VCS command options. |
439 Protected slot to edit the VCS command options. |
431 """ |
440 """ |
432 from .CommandOptionsDialog import VcsCommandOptionsDialog |
441 if self.vcs.vcsSupportCommandOptions(): |
433 codlg = VcsCommandOptionsDialog(self.vcs) |
442 from .CommandOptionsDialog import VcsCommandOptionsDialog |
434 if codlg.exec_() == QDialog.Accepted: |
443 codlg = VcsCommandOptionsDialog(self.vcs) |
435 self.vcs.vcsSetOptions(codlg.getOptions()) |
444 if codlg.exec_() == QDialog.Accepted: |
436 self.project.setDirty(True) |
445 self.vcs.vcsSetOptions(codlg.getOptions()) |
|
446 self.project.setDirty(True) |
437 |
447 |
438 def _vcsLog(self): |
448 def _vcsLog(self): |
439 """ |
449 """ |
440 Protected slot used to show the log of the local project. |
450 Protected slot used to show the log of the local project. |
441 """ |
451 """ |
442 self.vcs.vcsLog(self.project.ppath) |
452 self.vcs.vcsLog(self.project.ppath) |
|
453 |
|
454 def _vcsLogBrowser(self): |
|
455 """ |
|
456 Protected slot used to show the log of the local project with a |
|
457 log browser dialog. |
|
458 """ |
|
459 self.vcs.vcsLogBrowser(self.project.ppath) |
443 |
460 |
444 def _vcsDiff(self): |
461 def _vcsDiff(self): |
445 """ |
462 """ |
446 Protected slot used to show the difference of the local project to |
463 Protected slot used to show the difference of the local project to |
447 the repository. |
464 the repository. |