src/eric7/Plugins/PluginVcsMercurial.py

branch
eric7
changeset 10437
2f70ca07f0af
parent 10215
d476667171a1
child 10439
21c28b0f9e41
equal deleted inserted replaced
10436:f6881d10e995 10437:2f70ca07f0af
48 """ 48 """
49 Public method to support the display of some executable info. 49 Public method to support the display of some executable info.
50 50
51 @return dictionary containing the data to query the presence of 51 @return dictionary containing the data to query the presence of
52 the executable 52 the executable
53 @rtype dict
53 """ 54 """
54 data = { 55 data = {
55 "programEntry": True, 56 "programEntry": True,
56 "header": QCoreApplication.translate( 57 "header": QCoreApplication.translate(
57 "VcsMercurialPlugin", "Version Control - Mercurial" 58 "VcsMercurialPlugin", "Version Control - Mercurial"
70 def getVcsSystemIndicator(): 71 def getVcsSystemIndicator():
71 """ 72 """
72 Public function to get the indicators for this version control system. 73 Public function to get the indicators for this version control system.
73 74
74 @return dictionary with indicator as key and a tuple with the vcs name 75 @return dictionary with indicator as key and a tuple with the vcs name
75 (string) and vcs display string (string) 76 and vcs display string
76 """ 77 @rtype dict
77 ##global __header__ 78 """
78 data = {} 79 data = {}
79 exe = getHgExecutable() 80 exe = getHgExecutable()
80 if FileSystemUtilities.isinpath(exe): 81 if FileSystemUtilities.isinpath(exe):
81 data[".hg"] = (__header__["pluginTypename"], displayString()) 82 data[".hg"] = (__header__["pluginTypename"], displayString())
82 data["_hg"] = (__header__["pluginTypename"], displayString()) 83 data["_hg"] = (__header__["pluginTypename"], displayString())
85 86
86 def displayString(): 87 def displayString():
87 """ 88 """
88 Public function to get the display string. 89 Public function to get the display string.
89 90
90 @return display string (string) 91 @return display string
92 @rtype str
91 """ 93 """
92 exe = getHgExecutable() 94 exe = getHgExecutable()
93 if FileSystemUtilities.isinpath(exe): 95 if FileSystemUtilities.isinpath(exe):
94 return QCoreApplication.translate("VcsMercurialPlugin", "Mercurial") 96 return QCoreApplication.translate("VcsMercurialPlugin", "Mercurial")
95 else: 97 else:
101 103
102 def createConfigurationPage(configDlg): # noqa: U100 104 def createConfigurationPage(configDlg): # noqa: U100
103 """ 105 """
104 Module function to create the configuration page. 106 Module function to create the configuration page.
105 107
106 @param configDlg reference to the configuration dialog (QDialog) 108 @param configDlg reference to the configuration dialog
109 @type QDialog
107 @return reference to the configuration page 110 @return reference to the configuration page
111 @rtype MercurialPage
108 """ 112 """
109 from eric7.Plugins.VcsPlugins.vcsMercurial.ConfigurationPage.MercurialPage import ( 113 from eric7.Plugins.VcsPlugins.vcsMercurial.ConfigurationPage.MercurialPage import (
110 MercurialPage, 114 MercurialPage,
111 ) 115 )
112 116
120 124
121 def getConfigData(): 125 def getConfigData():
122 """ 126 """
123 Module function returning data as required by the configuration dialog. 127 Module function returning data as required by the configuration dialog.
124 128
125 @return dictionary with key "zzz_mercurialPage" containing the relevant 129 @return dictionary with key "zzz_mercurialPage" containing the relevant data
126 data 130 @rtype dict
127 """ 131 """
128 return { 132 return {
129 "zzz_mercurialPage": [ 133 "zzz_mercurialPage": [
130 QCoreApplication.translate("VcsMercurialPlugin", "Mercurial"), 134 QCoreApplication.translate("VcsMercurialPlugin", "Mercurial"),
131 os.path.join( 135 os.path.join(
190 194
191 def __init__(self, ui): 195 def __init__(self, ui):
192 """ 196 """
193 Constructor 197 Constructor
194 198
195 @param ui reference to the user interface object (UI.UserInterface) 199 @param ui reference to the user interface object
200 @type UserInterface
196 """ 201 """
197 from eric7.Plugins.VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper 202 from eric7.Plugins.VcsPlugins.vcsMercurial.ProjectHelper import HgProjectHelper
198 203
199 super().__init__(ui) 204 super().__init__(ui)
200 self.__ui = ui 205 self.__ui = ui
211 def getProjectHelper(self): 216 def getProjectHelper(self):
212 """ 217 """
213 Public method to get a reference to the project helper object. 218 Public method to get a reference to the project helper object.
214 219
215 @return reference to the project helper object 220 @return reference to the project helper object
221 @rtype HgProjectHelper
216 """ 222 """
217 return self.__projectHelperObject 223 return self.__projectHelperObject
218 224
219 def initToolbar(self, ui, toolbarManager): 225 def initToolbar(self, ui, toolbarManager):
220 """ 226 """
221 Public slot to initialize the VCS toolbar. 227 Public slot to initialize the VCS toolbar.
222 228
223 @param ui reference to the main window (UserInterface) 229 @param ui reference to the main window
230 @type UserInterface
224 @param toolbarManager reference to a toolbar manager object 231 @param toolbarManager reference to a toolbar manager object
225 (EricToolBarManager) 232 @type EricToolBarManager
226 """ 233 """
227 if self.__projectHelperObject: 234 if self.__projectHelperObject:
228 self.__projectHelperObject.initToolbar(ui, toolbarManager) 235 self.__projectHelperObject.initToolbar(ui, toolbarManager)
229 236
230 def activate(self): 237 def activate(self):
231 """ 238 """
232 Public method to activate this plugin. 239 Public method to activate this plugin.
233 240
234 @return tuple of reference to instantiated viewmanager and 241 @return tuple of reference to instantiated viewmanager and
235 activation status (boolean) 242 activation status
243 @rtype tuple of (Hg, bool)
236 """ 244 """
237 from eric7.Plugins.VcsPlugins.vcsMercurial.hg import Hg 245 from eric7.Plugins.VcsPlugins.vcsMercurial.hg import Hg
238 246
239 self.__object = Hg(self, self.__ui) 247 self.__object = Hg(self, self.__ui)
240 248
266 def getPreferences(cls, key): 274 def getPreferences(cls, key):
267 """ 275 """
268 Class method to retrieve the various settings. 276 Class method to retrieve the various settings.
269 277
270 @param key the key of the value to get 278 @param key the key of the value to get
279 @type str
271 @return the requested setting 280 @return the requested setting
281 @rtype Any
272 """ 282 """
273 if key in ( 283 if key in (
274 "StopLogOnCopy", 284 "StopLogOnCopy",
275 "PullUpdate", 285 "PullUpdate",
276 "PreferUnbundle", 286 "PreferUnbundle",
330 def setPreferences(cls, key, value): 340 def setPreferences(cls, key, value):
331 """ 341 """
332 Class method to store the various settings. 342 Class method to store the various settings.
333 343
334 @param key the key of the setting to be set 344 @param key the key of the setting to be set
345 @type str
335 @param value the value to be set 346 @param value the value to be set
347 @type Any
336 """ 348 """
337 Preferences.getSettings().setValue("Mercurial/" + key, value) 349 Preferences.getSettings().setValue("Mercurial/" + key, value)
338 350
339 def getGlobalOptions(self): 351 def getGlobalOptions(self):
340 """ 352 """
341 Public method to build a list of global options. 353 Public method to build a list of global options.
342 354
343 @return list of global options (list of string) 355 @return list of global options
356 @rtype list of str
344 """ 357 """
345 args = [] 358 args = []
346 if self.getPreferences("Encoding") != self.MercurialDefaults["Encoding"]: 359 if self.getPreferences("Encoding") != self.MercurialDefaults["Encoding"]:
347 args.append("--encoding") 360 args.append("--encoding")
348 args.append(self.getPreferences("Encoding")) 361 args.append(self.getPreferences("Encoding"))
358 371
359 def getConfigPath(self): 372 def getConfigPath(self):
360 """ 373 """
361 Public method to get the filename of the config file. 374 Public method to get the filename of the config file.
362 375
363 @return filename of the config file (string) 376 @return filename of the config file
377 @rtype str
364 """ 378 """
365 return getConfigPath() 379 return getConfigPath()
366 380
367 def prepareUninstall(self): 381 def prepareUninstall(self):
368 """ 382 """

eric ide

mercurial