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.vcsMercurial.HgUtilities import getConfigPath, getHgExecutable |
20 from VcsPlugins.vcsMercurial.HgUtilities import getConfigPath, getHgExecutable |
130 |
130 |
131 def prepareUninstall(): |
131 def prepareUninstall(): |
132 """ |
132 """ |
133 Module function to prepare for an uninstallation. |
133 Module function to prepare for an uninstallation. |
134 """ |
134 """ |
135 if not e5App().getObject("PluginManager").isPluginLoaded( |
135 if not ericApp().getObject("PluginManager").isPluginLoaded( |
136 "PluginVcsMercurial"): |
136 "PluginVcsMercurial"): |
137 Preferences.Prefs.settings.remove("Mercurial") |
137 Preferences.Prefs.settings.remove("Mercurial") |
138 |
138 |
139 |
139 |
140 def clearPrivateData(): |
140 def clearPrivateData(): |
189 self.__ui = ui |
189 self.__ui = ui |
190 |
190 |
191 from VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper |
191 from VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper |
192 self.__projectHelperObject = HgProjectHelper(None, None) |
192 self.__projectHelperObject = HgProjectHelper(None, None) |
193 with contextlib.suppress(KeyError): |
193 with contextlib.suppress(KeyError): |
194 e5App().registerPluginObject( |
194 ericApp().registerPluginObject( |
195 pluginTypename, self.__projectHelperObject, pluginType) |
195 pluginTypename, self.__projectHelperObject, pluginType) |
196 readShortcuts(pluginName=pluginTypename) |
196 readShortcuts(pluginName=pluginTypename) |
197 |
197 |
198 def getProjectHelper(self): |
198 def getProjectHelper(self): |
199 """ |
199 """ |
207 """ |
207 """ |
208 Public slot to initialize the VCS toolbar. |
208 Public slot to initialize the VCS toolbar. |
209 |
209 |
210 @param ui reference to the main window (UserInterface) |
210 @param ui reference to the main window (UserInterface) |
211 @param toolbarManager reference to a toolbar manager object |
211 @param toolbarManager reference to a toolbar manager object |
212 (E5ToolBarManager) |
212 (EricToolBarManager) |
213 """ |
213 """ |
214 if self.__projectHelperObject: |
214 if self.__projectHelperObject: |
215 self.__projectHelperObject.initToolbar(ui, toolbarManager) |
215 self.__projectHelperObject.initToolbar(ui, toolbarManager) |
216 |
216 |
217 def activate(self): |
217 def activate(self): |
331 |
331 |
332 def prepareUninstall(self): |
332 def prepareUninstall(self): |
333 """ |
333 """ |
334 Public method to prepare for an uninstallation. |
334 Public method to prepare for an uninstallation. |
335 """ |
335 """ |
336 e5App().unregisterPluginObject(pluginTypename) |
336 ericApp().unregisterPluginObject(pluginTypename) |
337 |
337 |
338 def prepareUnload(self): |
338 def prepareUnload(self): |
339 """ |
339 """ |
340 Public method to prepare for an unload. |
340 Public method to prepare for an unload. |
341 """ |
341 """ |
342 if self.__projectHelperObject: |
342 if self.__projectHelperObject: |
343 self.__projectHelperObject.removeToolbar( |
343 self.__projectHelperObject.removeToolbar( |
344 self.__ui, e5App().getObject("ToolbarManager")) |
344 self.__ui, ericApp().getObject("ToolbarManager")) |
345 e5App().unregisterPluginObject(pluginTypename) |
345 ericApp().unregisterPluginObject(pluginTypename) |