|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2025 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the fastexport extension project helper. |
|
8 """ |
|
9 |
|
10 from PyQt6.QtCore import pyqtSlot |
|
11 from PyQt6.QtWidgets import QMenu |
|
12 |
|
13 from eric7.EricGui.EricAction import EricAction |
|
14 |
|
15 from ..HgExtensionProjectHelper import HgExtensionProjectHelper |
|
16 |
|
17 |
|
18 class FastexportProjectHelper(HgExtensionProjectHelper): |
|
19 """ |
|
20 Class implementing the fastexport extension project helper. |
|
21 """ |
|
22 |
|
23 def __init__(self): |
|
24 """ |
|
25 Constructor |
|
26 """ |
|
27 super().__init__() |
|
28 |
|
29 def initActions(self): |
|
30 """ |
|
31 Public method to generate the action objects. |
|
32 """ |
|
33 self.hgFastexportAct = EricAction( |
|
34 self.tr("Export to git"), |
|
35 self.tr("Export to git"), |
|
36 0, |
|
37 0, |
|
38 self, |
|
39 "mercurial_fastexport", |
|
40 ) |
|
41 self.hgFastexportAct.setStatusTip( |
|
42 self.tr("Export the repository as git fast-import stream.") |
|
43 ) |
|
44 self.hgFastexportAct.setWhatsThis( |
|
45 self.tr( |
|
46 """<b>Export to git</b>""" |
|
47 """<p>This exports the repository as a git fast-import stream.</p>""" |
|
48 ) |
|
49 ) |
|
50 self.hgFastexportAct.triggered.connect(self.__hgFastexport) |
|
51 self.actions.append(self.hgFastexportAct) |
|
52 |
|
53 def initMenu(self, mainMenu): |
|
54 """ |
|
55 Public method to generate the extension menu. |
|
56 |
|
57 @param mainMenu reference to the main menu |
|
58 @type QMenu |
|
59 @return populated menu |
|
60 @rtype QMenu |
|
61 """ |
|
62 menu = QMenu(self.menuTitle(), mainMenu) |
|
63 menu.setTearOffEnabled(True) |
|
64 |
|
65 menu.addAction(self.hgFastexportAct) |
|
66 |
|
67 return menu |
|
68 |
|
69 def menuTitle(self): |
|
70 """ |
|
71 Public method to get the menu title. |
|
72 |
|
73 @return title of the menu |
|
74 @rtype str |
|
75 """ |
|
76 return self.tr("Fastexport") |
|
77 |
|
78 @pyqtSlot() |
|
79 def __hgFastexport(self): |
|
80 """ |
|
81 Private slot used to generate a git fast-import file. |
|
82 """ |
|
83 self.vcs.getExtensionObject("fastexport").hgFastexport() |