|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the project browser helper base for Mercurial extension |
|
8 interfaces. |
|
9 """ |
|
10 |
|
11 from PyQt4.QtCore import QObject |
|
12 |
|
13 |
|
14 class HgExtensionProjectBrowserHelper(QObject): |
|
15 """ |
|
16 Class implementing the project browser helper base for Mercurial extension |
|
17 interfaces. |
|
18 |
|
19 Note: The methods initMenus() and menuTitle() have to be reimplemented by |
|
20 derived classes. |
|
21 """ |
|
22 def __init__(self, vcsObject, browserObject, projectObject): |
|
23 """ |
|
24 Constructor |
|
25 |
|
26 @param vcsObject reference to the vcs object |
|
27 @param browserObject reference to the project browser object |
|
28 @param projectObject reference to the project object |
|
29 """ |
|
30 super().__init__() |
|
31 |
|
32 self.vcs = vcsObject |
|
33 self.browser = browserObject |
|
34 self.project = projectObject |
|
35 |
|
36 def initMenus(self): |
|
37 """ |
|
38 Public method to generate the extension menus. |
|
39 |
|
40 Note: Derived class must implement this method. |
|
41 |
|
42 @ireturn dictionary of populated menu (dict of QMenu). The dict |
|
43 must have the keys 'mainMenu', 'multiMenu', 'backMenu', 'dirMenu' |
|
44 and 'dirMultiMenu'. |
|
45 @exception NotImplementedError raised if the class has not been |
|
46 reimplemented |
|
47 """ |
|
48 raise NotImplementedError |
|
49 |
|
50 def menuTitle(self): |
|
51 """ |
|
52 Public method to get the menu title. |
|
53 |
|
54 Note: Derived class must implement this method. |
|
55 |
|
56 @ireturn title of the menu (string) |
|
57 @exception NotImplementedError raised if the class has not been |
|
58 reimplemented |
|
59 """ |
|
60 raise NotImplementedError |