Plugins/VcsPlugins/vcsMercurial/HgExtensionProjectHelper.py

changeset 1087
fb8cd56819a9
child 1131
7781e396c903
equal deleted inserted replaced
1086:b48ce064b224 1087:fb8cd56819a9
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2011 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the project helper base for Mercurial extension interfaces.
8 """
9
10 from PyQt4.QtCore import QObject
11
12
13 class HgExtensionProjectHelper(QObject):
14 """
15 Class implementing the project helper base for Mercurial extension interfaces.
16
17 Note: The methods initActions(), initMenu(mainMenu) and menuTitle() have to be
18 reimplemented by derived classes.
19 """
20 def __init__(self):
21 """
22 Constructor
23 """
24 QObject.__init__(self)
25
26 self.actions = []
27
28 self.initActions()
29
30 def setObjects(self, vcsObject, projectObject):
31 """
32 Public method to set references to the vcs and project objects.
33
34 @param vcsObject reference to the vcs object
35 @param projectObject reference to the project object
36 """
37 self.vcs = vcsObject
38 self.project = projectObject
39
40 def getActions(self):
41 """
42 Public method to get a list of all actions.
43
44 @return list of all actions (list of E5Action)
45 """
46 return self.actions[:]
47
48 def initActions(self):
49 """
50 Public method to generate the action objects.
51
52 Note: Derived class must implement this method.
53
54 @exception NotImplementedError raised if the class has not been reimplemente
55 """
56 raise NotImplementedError
57
58 def initMenu(self, mainMenu):
59 """
60 Public method to generate the extension menu.
61
62 Note: Derived class must implement this method.
63
64 @param mainMenu reference to the main menu (QMenu)
65 @return populated menu (QMenu)
66 @exception NotImplementedError raised if the class has not been reimplemente
67 """
68 raise NotImplementedError
69
70 def menuTitle(self):
71 """
72 Public method to get the menu title.
73
74 Note: Derived class must implement this method.
75
76 @return title of the menu (string)
77 @exception NotImplementedError raised if the class has not been reimplemente
78 """
79 raise NotImplementedError

eric ide

mercurial