10 import os |
10 import os |
11 import contextlib |
11 import contextlib |
12 |
12 |
13 from PyQt6.QtCore import QObject, QCoreApplication, QByteArray |
13 from PyQt6.QtCore import QObject, QCoreApplication, QByteArray |
14 |
14 |
15 from E5Gui.E5Application import e5App |
15 from E5Gui.EricApplication import ericApp |
16 |
16 |
17 import Preferences |
17 import Preferences |
18 from Preferences.Shortcuts import readShortcuts |
18 from Preferences.Shortcuts import readShortcuts |
19 |
19 |
20 from VcsPlugins.vcsGit.GitUtilities import getConfigPath |
20 from VcsPlugins.vcsGit.GitUtilities import getConfigPath |
139 |
139 |
140 def prepareUninstall(): |
140 def prepareUninstall(): |
141 """ |
141 """ |
142 Module function to prepare for an uninstallation. |
142 Module function to prepare for an uninstallation. |
143 """ |
143 """ |
144 if not e5App().getObject("PluginManager").isPluginLoaded( |
144 if not ericApp().getObject("PluginManager").isPluginLoaded( |
145 "PluginVcsGit"): |
145 "PluginVcsGit"): |
146 Preferences.Prefs.settings.remove("Git") |
146 Preferences.Prefs.settings.remove("Git") |
147 |
147 |
148 |
148 |
149 def clearPrivateData(): |
149 def clearPrivateData(): |
193 self.__ui = ui |
193 self.__ui = ui |
194 |
194 |
195 from VcsPlugins.vcsGit.ProjectHelper import GitProjectHelper |
195 from VcsPlugins.vcsGit.ProjectHelper import GitProjectHelper |
196 self.__projectHelperObject = GitProjectHelper(None, None) |
196 self.__projectHelperObject = GitProjectHelper(None, None) |
197 with contextlib.suppress(KeyError): |
197 with contextlib.suppress(KeyError): |
198 e5App().registerPluginObject( |
198 ericApp().registerPluginObject( |
199 pluginTypename, self.__projectHelperObject, pluginType) |
199 pluginTypename, self.__projectHelperObject, pluginType) |
200 |
200 |
201 readShortcuts(pluginName=pluginTypename) |
201 readShortcuts(pluginName=pluginTypename) |
202 |
202 |
203 def getProjectHelper(self): |
203 def getProjectHelper(self): |
212 """ |
212 """ |
213 Public slot to initialize the VCS toolbar. |
213 Public slot to initialize the VCS toolbar. |
214 |
214 |
215 @param ui reference to the main window (UserInterface) |
215 @param ui reference to the main window (UserInterface) |
216 @param toolbarManager reference to a toolbar manager object |
216 @param toolbarManager reference to a toolbar manager object |
217 (E5ToolBarManager) |
217 (EricToolBarManager) |
218 """ |
218 """ |
219 if self.__projectHelperObject: |
219 if self.__projectHelperObject: |
220 self.__projectHelperObject.initToolbar(ui, toolbarManager) |
220 self.__projectHelperObject.initToolbar(ui, toolbarManager) |
221 |
221 |
222 def activate(self): |
222 def activate(self): |
310 |
310 |
311 def prepareUninstall(self): |
311 def prepareUninstall(self): |
312 """ |
312 """ |
313 Public method to prepare for an uninstallation. |
313 Public method to prepare for an uninstallation. |
314 """ |
314 """ |
315 e5App().unregisterPluginObject(pluginTypename) |
315 ericApp().unregisterPluginObject(pluginTypename) |
316 |
316 |
317 def prepareUnload(self): |
317 def prepareUnload(self): |
318 """ |
318 """ |
319 Public method to prepare for an unload. |
319 Public method to prepare for an unload. |
320 """ |
320 """ |
321 if self.__projectHelperObject: |
321 if self.__projectHelperObject: |
322 self.__projectHelperObject.removeToolbar( |
322 self.__projectHelperObject.removeToolbar( |
323 self.__ui, e5App().getObject("ToolbarManager")) |
323 self.__ui, ericApp().getObject("ToolbarManager")) |
324 e5App().unregisterPluginObject(pluginTypename) |
324 ericApp().unregisterPluginObject(pluginTypename) |
325 |
325 |
326 # |
326 # |
327 # eflag: noqa = M801 |
327 # eflag: noqa = M801 |