13 import pathlib |
13 import pathlib |
14 |
14 |
15 from PyQt6.QtCore import pyqtSlot, QObject, QCoreApplication |
15 from PyQt6.QtCore import pyqtSlot, QObject, QCoreApplication |
16 from PyQt6.QtWidgets import QDialog, QInputDialog, QToolBar |
16 from PyQt6.QtWidgets import QDialog, QInputDialog, QToolBar |
17 |
17 |
18 from EricGui.EricAction import EricAction |
18 from eric7.EricGui.EricAction import EricAction |
19 from EricWidgets import EricMessageBox |
19 from eric7.EricWidgets import EricMessageBox |
20 from EricWidgets.EricApplication import ericApp |
20 from eric7.EricWidgets.EricApplication import ericApp |
21 |
21 |
22 import Preferences |
22 from eric7 import Preferences |
23 import UI.PixmapCache |
23 from eric7.EricGui import EricPixmapCache |
24 import UI.Config |
24 from eric7.UI import Config |
25 |
25 |
26 |
26 |
27 class VcsProjectHelper(QObject): |
27 class VcsProjectHelper(QObject): |
28 """ |
28 """ |
29 Class implementing the base class of the VCS project helper. |
29 Class implementing the base class of the VCS project helper. |
65 """ |
65 """ |
66 Public method to generate the action objects. |
66 Public method to generate the action objects. |
67 """ |
67 """ |
68 self.vcsNewAct = EricAction( |
68 self.vcsNewAct = EricAction( |
69 QCoreApplication.translate("VcsProjectHelper", "New from repository"), |
69 QCoreApplication.translate("VcsProjectHelper", "New from repository"), |
70 UI.PixmapCache.getIcon("vcsCheckout"), |
70 EricPixmapCache.getIcon("vcsCheckout"), |
71 QCoreApplication.translate("VcsProjectHelper", "&New from repository..."), |
71 QCoreApplication.translate("VcsProjectHelper", "&New from repository..."), |
72 0, |
72 0, |
73 0, |
73 0, |
74 self, |
74 self, |
75 "vcs_new", |
75 "vcs_new", |
90 self.vcsNewAct.triggered.connect(self._vcsCheckout) |
90 self.vcsNewAct.triggered.connect(self._vcsCheckout) |
91 self.actions.append(self.vcsNewAct) |
91 self.actions.append(self.vcsNewAct) |
92 |
92 |
93 self.vcsExportAct = EricAction( |
93 self.vcsExportAct = EricAction( |
94 QCoreApplication.translate("VcsProjectHelper", "Export from repository"), |
94 QCoreApplication.translate("VcsProjectHelper", "Export from repository"), |
95 UI.PixmapCache.getIcon("vcsExport"), |
95 EricPixmapCache.getIcon("vcsExport"), |
96 QCoreApplication.translate( |
96 QCoreApplication.translate( |
97 "VcsProjectHelper", "&Export from repository..." |
97 "VcsProjectHelper", "&Export from repository..." |
98 ), |
98 ), |
99 0, |
99 0, |
100 0, |
100 0, |
116 self.vcsExportAct.triggered.connect(self._vcsExport) |
116 self.vcsExportAct.triggered.connect(self._vcsExport) |
117 self.actions.append(self.vcsExportAct) |
117 self.actions.append(self.vcsExportAct) |
118 |
118 |
119 self.vcsAddAct = EricAction( |
119 self.vcsAddAct = EricAction( |
120 QCoreApplication.translate("VcsProjectHelper", "Add to repository"), |
120 QCoreApplication.translate("VcsProjectHelper", "Add to repository"), |
121 UI.PixmapCache.getIcon("vcsCommit"), |
121 EricPixmapCache.getIcon("vcsCommit"), |
122 QCoreApplication.translate("VcsProjectHelper", "&Add to repository..."), |
122 QCoreApplication.translate("VcsProjectHelper", "&Add to repository..."), |
123 0, |
123 0, |
124 0, |
124 0, |
125 self, |
125 self, |
126 "vcs_add", |
126 "vcs_add", |
174 @param toolbarManager reference to a toolbar manager object |
174 @param toolbarManager reference to a toolbar manager object |
175 (EricToolBarManager) |
175 (EricToolBarManager) |
176 @return the toolbar generated (QToolBar) |
176 @return the toolbar generated (QToolBar) |
177 """ |
177 """ |
178 tb = QToolBar(QCoreApplication.translate("VcsProjectHelper", "VCS"), ui) |
178 tb = QToolBar(QCoreApplication.translate("VcsProjectHelper", "VCS"), ui) |
179 tb.setIconSize(UI.Config.ToolBarIconSize) |
179 tb.setIconSize(Config.ToolBarIconSize) |
180 tb.setObjectName("VersionControlToolbar") |
180 tb.setObjectName("VersionControlToolbar") |
181 tb.setToolTip(QCoreApplication.translate("VcsProjectHelper", "VCS")) |
181 tb.setToolTip(QCoreApplication.translate("VcsProjectHelper", "VCS")) |
182 |
182 |
183 tb.addAction(self.vcsNewAct) |
183 tb.addAction(self.vcsNewAct) |
184 tb.addAction(self.vcsExportAct) |
184 tb.addAction(self.vcsExportAct) |
340 ) |
340 ) |
341 if res: |
341 if res: |
342 self.project.ppath = projectdir |
342 self.project.ppath = projectdir |
343 self.project.opened = True |
343 self.project.opened = True |
344 |
344 |
345 from Project.PropertiesDialog import PropertiesDialog |
345 from eric7.Project.PropertiesDialog import PropertiesDialog |
346 |
346 |
347 dlg = PropertiesDialog(self.project, False) |
347 dlg = PropertiesDialog(self.project, False) |
348 if dlg.exec() == QDialog.DialogCode.Accepted: |
348 if dlg.exec() == QDialog.DialogCode.Accepted: |
349 dlg.storeData() |
349 dlg.storeData() |
350 self.project.initFileTypes() |
350 self.project.initFileTypes() |