68 self.vcsNewAct.setStatusTip(self.trUtf8( |
68 self.vcsNewAct.setStatusTip(self.trUtf8( |
69 'Create a new project from the VCS repository' |
69 'Create a new project from the VCS repository' |
70 )) |
70 )) |
71 self.vcsNewAct.setWhatsThis(self.trUtf8( |
71 self.vcsNewAct.setWhatsThis(self.trUtf8( |
72 """<b>New from repository</b>""" |
72 """<b>New from repository</b>""" |
73 """<p>This creates a new local project from the VCS repository.</p>""" |
73 """<p>This creates a new local project from the VCS""" |
|
74 """ repository.</p>""" |
74 )) |
75 )) |
75 self.vcsNewAct.triggered[()].connect(self._vcsCheckout) |
76 self.vcsNewAct.triggered[()].connect(self._vcsCheckout) |
76 self.actions.append(self.vcsNewAct) |
77 self.actions.append(self.vcsNewAct) |
77 |
78 |
78 self.vcsExportAct = E5Action(self.trUtf8('Export from repository'), |
79 self.vcsExportAct = E5Action( |
79 self.trUtf8('&Export from repository...'), 0, 0, self, 'vcs_export') |
80 self.trUtf8('Export from repository'), |
|
81 self.trUtf8('&Export from repository...'), |
|
82 0, 0, self, 'vcs_export') |
80 self.vcsExportAct.setStatusTip(self.trUtf8( |
83 self.vcsExportAct.setStatusTip(self.trUtf8( |
81 'Export a project from the repository' |
84 'Export a project from the repository' |
82 )) |
85 )) |
83 self.vcsExportAct.setWhatsThis(self.trUtf8( |
86 self.vcsExportAct.setWhatsThis(self.trUtf8( |
84 """<b>Export from repository</b>""" |
87 """<b>Export from repository</b>""" |
92 self.vcsAddAct.setStatusTip(self.trUtf8( |
95 self.vcsAddAct.setStatusTip(self.trUtf8( |
93 'Add the local project to the VCS repository' |
96 'Add the local project to the VCS repository' |
94 )) |
97 )) |
95 self.vcsAddAct.setWhatsThis(self.trUtf8( |
98 self.vcsAddAct.setWhatsThis(self.trUtf8( |
96 """<b>Add to repository</b>""" |
99 """<b>Add to repository</b>""" |
97 """<p>This adds (imports) the local project to the VCS repository.</p>""" |
100 """<p>This adds (imports) the local project to the VCS""" |
|
101 """ repository.</p>""" |
98 )) |
102 )) |
99 self.vcsAddAct.triggered[()].connect(self._vcsImport) |
103 self.vcsAddAct.triggered[()].connect(self._vcsImport) |
100 self.actions.append(self.vcsAddAct) |
104 self.actions.append(self.vcsAddAct) |
101 |
105 |
102 def initMenu(self, menu): |
106 def initMenu(self, menu): |
164 self.project.pdata["VCS"] = [vcsSystem] |
168 self.project.pdata["VCS"] = [vcsSystem] |
165 self.project.vcs = self.project.initVCS(vcsSystem) |
169 self.project.vcs = self.project.initVCS(vcsSystem) |
166 # edit VCS command options |
170 # edit VCS command options |
167 vcores = E5MessageBox.yesNo(self.parent(), |
171 vcores = E5MessageBox.yesNo(self.parent(), |
168 self.trUtf8("New Project"), |
172 self.trUtf8("New Project"), |
169 self.trUtf8("""Would you like to edit the VCS command options?""")) |
173 self.trUtf8( |
|
174 """Would you like to edit the VCS command options?""")) |
170 if vcores: |
175 if vcores: |
171 from .CommandOptionsDialog import vcsCommandOptionsDialog |
176 from .CommandOptionsDialog import vcsCommandOptionsDialog |
172 codlg = vcsCommandOptionsDialog(self.project.vcs) |
177 codlg = vcsCommandOptionsDialog(self.project.vcs) |
173 if codlg.exec_() == QDialog.Accepted: |
178 if codlg.exec_() == QDialog.Accepted: |
174 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
179 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
178 try: |
183 try: |
179 os.makedirs(projectdir) |
184 os.makedirs(projectdir) |
180 except EnvironmentError: |
185 except EnvironmentError: |
181 E5MessageBox.critical(self.parent(), |
186 E5MessageBox.critical(self.parent(), |
182 self.trUtf8("Create project directory"), |
187 self.trUtf8("Create project directory"), |
183 self.trUtf8("<p>The project directory <b>{0}</b> could not" |
188 self.trUtf8( |
|
189 "<p>The project directory <b>{0}</b> could not" |
184 " be created.</p>").format(projectdir)) |
190 " be created.</p>").format(projectdir)) |
185 self.project.pdata["VCS"] = ['None'] |
191 self.project.pdata["VCS"] = ['None'] |
186 self.project.vcs = self.project.initVCS() |
192 self.project.vcs = self.project.initVCS() |
187 return |
193 return |
188 |
194 |
189 # create the project from the VCS |
195 # create the project from the VCS |
190 self.project.vcs.vcsSetDataFromDict(vcsDataDict) |
196 self.project.vcs.vcsSetDataFromDict(vcsDataDict) |
191 if export: |
197 if export: |
192 ok = self.project.vcs.vcsExport(vcsDataDict, projectdir) |
198 ok = self.project.vcs.vcsExport(vcsDataDict, projectdir) |
193 else: |
199 else: |
194 ok = self.project.vcs.vcsCheckout(vcsDataDict, projectdir, False) |
200 ok = self.project.vcs.vcsCheckout(vcsDataDict, projectdir, |
|
201 False) |
195 if ok: |
202 if ok: |
196 projectdir = os.path.normpath(projectdir) |
203 projectdir = os.path.normpath(projectdir) |
197 filters = ["*.e4p"] |
204 filters = ["*.e4p"] |
198 d = QDir(projectdir) |
205 d = QDir(projectdir) |
199 plist = d.entryInfoList(filters) |
206 plist = d.entryInfoList(filters) |
200 if len(plist): |
207 if len(plist): |
201 if len(plist) == 1: |
208 if len(plist) == 1: |
202 self.project.openProject(plist[0].absoluteFilePath()) |
209 self.project.openProject( |
|
210 plist[0].absoluteFilePath()) |
203 self.project.newProject.emit() |
211 self.project.newProject.emit() |
204 else: |
212 else: |
205 pfilenamelist = d.entryList(filters) |
213 pfilenamelist = d.entryList(filters) |
206 pfilename, ok = QInputDialog.getItem( |
214 pfilename, ok = QInputDialog.getItem( |
207 None, |
215 None, |
218 self.project.setDirty(True) |
226 self.project.setDirty(True) |
219 self.project.saveProject() |
227 self.project.saveProject() |
220 else: |
228 else: |
221 res = E5MessageBox.yesNo(self.parent(), |
229 res = E5MessageBox.yesNo(self.parent(), |
222 self.trUtf8("New project from repository"), |
230 self.trUtf8("New project from repository"), |
223 self.trUtf8("The project retrieved from the repository" |
231 self.trUtf8( |
|
232 "The project retrieved from the repository" |
224 " does not contain an eric project file" |
233 " does not contain an eric project file" |
225 " (*.e4p). Create it?"), |
234 " (*.e4p). Create it?"), |
226 yesDefault=True) |
235 yesDefault=True) |
227 if res: |
236 if res: |
228 self.project.ppath = projectdir |
237 self.project.ppath = projectdir |
229 self.project.opened = True |
238 self.project.opened = True |
230 |
239 |
231 from Project.PropertiesDialog import PropertiesDialog |
240 from Project.PropertiesDialog import \ |
|
241 PropertiesDialog |
232 dlg = PropertiesDialog(self.project, False) |
242 dlg = PropertiesDialog(self.project, False) |
233 if dlg.exec_() == QDialog.Accepted: |
243 if dlg.exec_() == QDialog.Accepted: |
234 dlg.storeData() |
244 dlg.storeData() |
235 self.project.initFileTypes() |
245 self.project.initFileTypes() |
236 self.project.setDirty(True) |
246 self.project.setDirty(True) |
237 try: |
247 try: |
238 ms = os.path.join(self.project.ppath, |
248 ms = os.path.join( |
239 self.project.pdata["MAINSCRIPT"][0]) |
249 self.project.ppath, |
|
250 self.project.pdata["MAINSCRIPT"][0]) |
240 if os.path.exists(ms): |
251 if os.path.exists(ms): |
241 self.project.appendFile(ms) |
252 self.project.appendFile(ms) |
242 except IndexError: |
253 except IndexError: |
243 ms = "" |
254 ms = "" |
244 self.project.newProjectAddFiles(ms) |
255 self.project.newProjectAddFiles(ms) |
245 self.project.saveProject() |
256 self.project.saveProject() |
246 self.project.openProject(self.project.pfile) |
257 self.project.openProject(self.project.pfile) |
247 if not export: |
258 if not export: |
248 res = E5MessageBox.yesNo(self.parent(), |
259 res = E5MessageBox.yesNo( |
249 self.trUtf8("New project from repository"), |
260 self.parent(), |
250 self.trUtf8("Shall the project file be added to" |
261 self.trUtf8( |
251 " the repository?"), |
262 "New project from repository"), |
|
263 self.trUtf8( |
|
264 "Shall the project file be added" |
|
265 " to the repository?"), |
252 yesDefault=True) |
266 yesDefault=True) |
253 if res: |
267 if res: |
254 self.project.vcs.vcsAdd(self.project.pfile) |
268 self.project.vcs.vcsAdd( |
|
269 self.project.pfile) |
255 else: |
270 else: |
256 E5MessageBox.critical(self.parent(), |
271 E5MessageBox.critical( |
|
272 self.parent(), |
257 self.trUtf8("New project from repository"), |
273 self.trUtf8("New project from repository"), |
258 self.trUtf8("""The project could not be retrieved from""" |
274 self.trUtf8( |
|
275 """The project could not be retrieved from""" |
259 """ the repository.""")) |
276 """ the repository.""")) |
260 self.project.pdata["VCS"] = ['None'] |
277 self.project.pdata["VCS"] = ['None'] |
261 self.project.vcs = self.project.initVCS() |
278 self.project.vcs = self.project.initVCS() |
262 else: |
279 else: |
263 self.project.pdata["VCS"] = ['None'] |
280 self.project.pdata["VCS"] = ['None'] |
320 break |
337 break |
321 |
338 |
322 self.project.pdata["VCS"] = [vcsSystem] |
339 self.project.pdata["VCS"] = [vcsSystem] |
323 self.project.vcs = self.project.initVCS(vcsSystem) |
340 self.project.vcs = self.project.initVCS(vcsSystem) |
324 if self.project.vcs is not None: |
341 if self.project.vcs is not None: |
325 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, self.project.name, 1) |
342 vcsdlg = self.project.vcs.vcsOptionsDialog(self.project, |
|
343 self.project.name, 1) |
326 if vcsdlg.exec_() == QDialog.Accepted: |
344 if vcsdlg.exec_() == QDialog.Accepted: |
327 vcsDataDict = vcsdlg.getData() |
345 vcsDataDict = vcsdlg.getData() |
328 # edit VCS command options |
346 # edit VCS command options |
329 vcores = E5MessageBox.yesNo(self.parent(), |
347 vcores = E5MessageBox.yesNo(self.parent(), |
330 self.trUtf8("Import Project"), |
348 self.trUtf8("Import Project"), |
331 self.trUtf8("""Would you like to edit the VCS command options?""")) |
349 self.trUtf8( |
|
350 """Would you like to edit the VCS command options?""")) |
332 if vcores: |
351 if vcores: |
333 from .CommandOptionsDialog import vcsCommandOptionsDialog |
352 from .CommandOptionsDialog import vcsCommandOptionsDialog |
334 codlg = vcsCommandOptionsDialog(self.project.vcs) |
353 codlg = vcsCommandOptionsDialog(self.project.vcs) |
335 if codlg.exec_() == QDialog.Accepted: |
354 if codlg.exec_() == QDialog.Accepted: |
336 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
355 self.project.vcs.vcsSetOptions(codlg.getOptions()) |
337 self.project.setDirty(True) |
356 self.project.setDirty(True) |
338 self.project.vcs.vcsSetDataFromDict(vcsDataDict) |
357 self.project.vcs.vcsSetDataFromDict(vcsDataDict) |
339 self.project.saveProject() |
358 self.project.saveProject() |
340 isVcsControlled = \ |
359 isVcsControlled = self.project.vcs.vcsImport( |
341 self.project.vcs.vcsImport(vcsDataDict, self.project.ppath)[0] |
360 vcsDataDict, self.project.ppath)[0] |
342 if isVcsControlled: |
361 if isVcsControlled: |
343 # reopen the project |
362 # reopen the project |
344 self.project.openProject(self.project.pfile) |
363 self.project.openProject(self.project.pfile) |
345 else: |
364 else: |
346 # revert the changes to the local project |
365 # revert the changes to the local project |