18 |
18 |
19 class CloseheadProjectHelper(HgExtensionProjectHelper): |
19 class CloseheadProjectHelper(HgExtensionProjectHelper): |
20 """ |
20 """ |
21 Class implementing the closehead extension project helper. |
21 Class implementing the closehead extension project helper. |
22 """ |
22 """ |
|
23 |
23 def __init__(self): |
24 def __init__(self): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 """ |
27 """ |
27 super().__init__() |
28 super().__init__() |
28 |
29 |
29 def initActions(self): |
30 def initActions(self): |
30 """ |
31 """ |
31 Public method to generate the action objects. |
32 Public method to generate the action objects. |
32 """ |
33 """ |
33 self.hgCloseheadAct = EricAction( |
34 self.hgCloseheadAct = EricAction( |
34 self.tr('Close Heads'), |
35 self.tr("Close Heads"), |
35 UI.PixmapCache.getIcon("closehead"), |
36 UI.PixmapCache.getIcon("closehead"), |
36 self.tr('Close Heads'), |
37 self.tr("Close Heads"), |
37 0, 0, self, 'mercurial_closehead') |
38 0, |
38 self.hgCloseheadAct.setStatusTip(self.tr( |
39 0, |
39 'Close arbitrary heads without checking them out first' |
40 self, |
40 )) |
41 "mercurial_closehead", |
41 self.hgCloseheadAct.setWhatsThis(self.tr( |
42 ) |
42 """<b>Close Heads</b>""" |
43 self.hgCloseheadAct.setStatusTip( |
43 """<p>This closes arbitrary heads without the need to check them""" |
44 self.tr("Close arbitrary heads without checking them out first") |
44 """ out first.</p>""" |
45 ) |
45 )) |
46 self.hgCloseheadAct.setWhatsThis( |
|
47 self.tr( |
|
48 """<b>Close Heads</b>""" |
|
49 """<p>This closes arbitrary heads without the need to check them""" |
|
50 """ out first.</p>""" |
|
51 ) |
|
52 ) |
46 self.hgCloseheadAct.triggered.connect(self.__hgClosehead) |
53 self.hgCloseheadAct.triggered.connect(self.__hgClosehead) |
47 self.actions.append(self.hgCloseheadAct) |
54 self.actions.append(self.hgCloseheadAct) |
48 |
55 |
49 def initMenu(self, mainMenu): |
56 def initMenu(self, mainMenu): |
50 """ |
57 """ |
51 Public method to generate the extension menu. |
58 Public method to generate the extension menu. |
52 |
59 |
53 @param mainMenu reference to the main menu |
60 @param mainMenu reference to the main menu |
54 @type QMenu |
61 @type QMenu |
55 @return populated menu (QMenu) |
62 @return populated menu (QMenu) |
56 """ |
63 """ |
57 menu = QMenu(self.menuTitle(), mainMenu) |
64 menu = QMenu(self.menuTitle(), mainMenu) |
58 menu.setIcon(UI.PixmapCache.getIcon("closehead")) |
65 menu.setIcon(UI.PixmapCache.getIcon("closehead")) |
59 menu.setTearOffEnabled(True) |
66 menu.setTearOffEnabled(True) |
60 |
67 |
61 menu.addAction(self.hgCloseheadAct) |
68 menu.addAction(self.hgCloseheadAct) |
62 |
69 |
63 return menu |
70 return menu |
64 |
71 |
65 def menuTitle(self): |
72 def menuTitle(self): |
66 """ |
73 """ |
67 Public method to get the menu title. |
74 Public method to get the menu title. |
68 |
75 |
69 @return title of the menu |
76 @return title of the menu |
70 @rtype str |
77 @rtype str |
71 """ |
78 """ |
72 return self.tr("Close Heads") |
79 return self.tr("Close Heads") |
73 |
80 |
74 def __hgClosehead(self): |
81 def __hgClosehead(self): |
75 """ |
82 """ |
76 Private slot used to close arbitrary heads. |
83 Private slot used to close arbitrary heads. |
77 """ |
84 """ |
78 self.vcs.getExtensionObject("closehead").hgCloseheads() |
85 self.vcs.getExtensionObject("closehead").hgCloseheads() |