13 |
13 |
14 class HgExtensionProjectHelper(QObject): |
14 class HgExtensionProjectHelper(QObject): |
15 """ |
15 """ |
16 Class implementing the project helper base for Mercurial extension |
16 Class implementing the project helper base for Mercurial extension |
17 interfaces. |
17 interfaces. |
18 |
18 |
19 Note: The methods initActions(), initMenu(mainMenu) and menuTitle() have |
19 Note: The methods initActions(), initMenu(mainMenu) and menuTitle() have |
20 to be reimplemented by derived classes. |
20 to be reimplemented by derived classes. |
21 """ |
21 """ |
|
22 |
22 def __init__(self): |
23 def __init__(self): |
23 """ |
24 """ |
24 Constructor |
25 Constructor |
25 """ |
26 """ |
26 super().__init__() |
27 super().__init__() |
27 |
28 |
28 self.actions = [] |
29 self.actions = [] |
29 |
30 |
30 self.initActions() |
31 self.initActions() |
31 |
32 |
32 def setObjects(self, vcsObject, projectObject): |
33 def setObjects(self, vcsObject, projectObject): |
33 """ |
34 """ |
34 Public method to set references to the vcs and project objects. |
35 Public method to set references to the vcs and project objects. |
35 |
36 |
36 @param vcsObject reference to the vcs object |
37 @param vcsObject reference to the vcs object |
37 @param projectObject reference to the project object |
38 @param projectObject reference to the project object |
38 """ |
39 """ |
39 self.vcs = vcsObject |
40 self.vcs = vcsObject |
40 self.project = projectObject |
41 self.project = projectObject |
41 |
42 |
42 def getActions(self): |
43 def getActions(self): |
43 """ |
44 """ |
44 Public method to get a list of all actions. |
45 Public method to get a list of all actions. |
45 |
46 |
46 @return list of all actions (list of EricAction) |
47 @return list of all actions (list of EricAction) |
47 """ |
48 """ |
48 return self.actions[:] |
49 return self.actions[:] |
49 |
50 |
50 def initActions(self): |
51 def initActions(self): |
51 """ |
52 """ |
52 Public method to generate the action objects. |
53 Public method to generate the action objects. |
53 |
54 |
54 Note: Derived class must implement this method. |
55 Note: Derived class must implement this method. |
55 |
56 |
56 @exception NotImplementedError raised if the class has not been |
57 @exception NotImplementedError raised if the class has not been |
57 reimplemented |
58 reimplemented |
58 """ |
59 """ |
59 raise NotImplementedError |
60 raise NotImplementedError |
60 |
61 |
61 def initMenu(self, mainMenu): |
62 def initMenu(self, mainMenu): |
62 """ |
63 """ |
63 Public method to generate the extension menu. |
64 Public method to generate the extension menu. |
64 |
65 |
65 Note: Derived class must implement this method. |
66 Note: Derived class must implement this method. |
66 |
67 |
67 @param mainMenu reference to the main menu (QMenu) |
68 @param mainMenu reference to the main menu (QMenu) |
68 @return populated menu (QMenu) |
69 @return populated menu (QMenu) |
69 @exception NotImplementedError raised if the class has not been |
70 @exception NotImplementedError raised if the class has not been |
70 reimplemented |
71 reimplemented |
71 """ |
72 """ |
72 raise NotImplementedError |
73 raise NotImplementedError |
73 |
74 |
74 return QMenu() |
75 return QMenu() |
75 |
76 |
76 def menuTitle(self): |
77 def menuTitle(self): |
77 """ |
78 """ |
78 Public method to get the menu title. |
79 Public method to get the menu title. |
79 |
80 |
80 Note: Derived class must implement this method. |
81 Note: Derived class must implement this method. |
81 |
82 |
82 @return title of the menu (string) |
83 @return title of the menu (string) |
83 @exception NotImplementedError raised if the class has not been |
84 @exception NotImplementedError raised if the class has not been |
84 reimplemented |
85 reimplemented |
85 """ |
86 """ |
86 raise NotImplementedError |
87 raise NotImplementedError |
87 |
88 |
88 return "" |
89 return "" |
89 |
90 |
90 def shutdown(self): |
91 def shutdown(self): |
91 """ |
92 """ |
92 Public method to perform shutdown actions. |
93 Public method to perform shutdown actions. |
93 |
94 |
94 Note: Derived class may implement this method if needed. |
95 Note: Derived class may implement this method if needed. |
95 """ |
96 """ |
96 pass |
97 pass |