VCS/ProjectHelper.py

changeset 4079
a3319822d303
parent 4021
195a471c327b
child 4631
5c1a96925da4
equal deleted inserted replaced
4078:0e14bef0b47b 4079:a3319822d303
12 import os 12 import os
13 import shutil 13 import shutil
14 import copy 14 import copy
15 15
16 from PyQt5.QtCore import pyqtSlot, QDir, QFileInfo, QObject 16 from PyQt5.QtCore import pyqtSlot, QDir, QFileInfo, QObject
17 from PyQt5.QtWidgets import QDialog, QInputDialog 17 from PyQt5.QtWidgets import QDialog, QInputDialog, QToolBar
18 18
19 from E5Gui.E5Action import E5Action 19 from E5Gui.E5Action import E5Action
20 from E5Gui import E5MessageBox 20 from E5Gui import E5MessageBox
21 from E5Gui.E5Application import e5App 21 from E5Gui.E5Application import e5App
22 22
23 import Preferences 23 import Preferences
24 import UI.PixmapCache
25 import UI.Config
24 26
25 27
26 class VcsProjectHelper(QObject): 28 class VcsProjectHelper(QObject):
27 """ 29 """
28 Class implementing the base class of the VCS project helper. 30 Class implementing the base class of the VCS project helper.
63 """ 65 """
64 Public method to generate the action objects. 66 Public method to generate the action objects.
65 """ 67 """
66 self.vcsNewAct = E5Action( 68 self.vcsNewAct = E5Action(
67 self.tr('New from repository'), 69 self.tr('New from repository'),
70 UI.PixmapCache.getIcon("vcsCheckout.png"),
68 self.tr('&New from repository...'), 71 self.tr('&New from repository...'),
69 0, 0, self, 'vcs_new') 72 0, 0, self, 'vcs_new')
70 self.vcsNewAct.setStatusTip(self.tr( 73 self.vcsNewAct.setStatusTip(self.tr(
71 'Create a new project from the VCS repository' 74 'Create a new project from the VCS repository'
72 )) 75 ))
78 self.vcsNewAct.triggered.connect(self._vcsCheckout) 81 self.vcsNewAct.triggered.connect(self._vcsCheckout)
79 self.actions.append(self.vcsNewAct) 82 self.actions.append(self.vcsNewAct)
80 83
81 self.vcsExportAct = E5Action( 84 self.vcsExportAct = E5Action(
82 self.tr('Export from repository'), 85 self.tr('Export from repository'),
86 UI.PixmapCache.getIcon("vcsExport.png"),
83 self.tr('&Export from repository...'), 87 self.tr('&Export from repository...'),
84 0, 0, self, 'vcs_export') 88 0, 0, self, 'vcs_export')
85 self.vcsExportAct.setStatusTip(self.tr( 89 self.vcsExportAct.setStatusTip(self.tr(
86 'Export a project from the repository' 90 'Export a project from the repository'
87 )) 91 ))
92 self.vcsExportAct.triggered.connect(self._vcsExport) 96 self.vcsExportAct.triggered.connect(self._vcsExport)
93 self.actions.append(self.vcsExportAct) 97 self.actions.append(self.vcsExportAct)
94 98
95 self.vcsAddAct = E5Action( 99 self.vcsAddAct = E5Action(
96 self.tr('Add to repository'), 100 self.tr('Add to repository'),
101 UI.PixmapCache.getIcon("vcsCommit.png"),
97 self.tr('&Add to repository...'), 102 self.tr('&Add to repository...'),
98 0, 0, self, 'vcs_add') 103 0, 0, self, 'vcs_add')
99 self.vcsAddAct.setStatusTip(self.tr( 104 self.vcsAddAct.setStatusTip(self.tr(
100 'Add the local project to the VCS repository' 105 'Add the local project to the VCS repository'
101 )) 106 ))
119 menu.addAction(self.vcsExportAct) 124 menu.addAction(self.vcsExportAct)
120 menu.addSeparator() 125 menu.addSeparator()
121 menu.addAction(self.vcsAddAct) 126 menu.addAction(self.vcsAddAct)
122 menu.addSeparator() 127 menu.addSeparator()
123 128
129 def initToolbar(self, ui, toolbarManager):
130 """
131 Public slot to initialize the VCS toolbar.
132
133 @param ui reference to the main window (UserInterface)
134 @param toolbarManager reference to a toolbar manager object
135 (E5ToolBarManager)
136 @return the toolbar generated (QToolBar)
137 """
138 return None
139
140 def initBasicToolbar(self, ui, toolbarManager):
141 """
142 Public slot to initialize the basic VCS toolbar.
143
144 @param ui reference to the main window (UserInterface)
145 @param toolbarManager reference to a toolbar manager object
146 (E5ToolBarManager)
147 @return the toolbar generated (QToolBar)
148 """
149 tb = QToolBar(self.tr("VCS"), ui)
150 tb.setIconSize(UI.Config.ToolBarIconSize)
151 tb.setObjectName("VersionControlToolbar")
152 tb.setToolTip(self.tr('VCS'))
153
154 tb.addAction(self.vcsNewAct)
155 tb.addAction(self.vcsExportAct)
156 tb.addSeparator()
157 tb.addAction(self.vcsAddAct)
158
159 toolbarManager.addToolBar(tb, tb.windowTitle())
160
161 return tb
162
124 def showMenu(self): 163 def showMenu(self):
125 """ 164 """
126 Public slot called before the vcs menu is shown. 165 Public slot called before the vcs menu is shown.
127 """ 166 """
128 if self.vcsAddAct: 167 if self.vcsAddAct:

eric ide

mercurial