7 Module implementing the shelve extension project helper. |
7 Module implementing the shelve extension project helper. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtWidgets import QMenu |
10 from PyQt6.QtWidgets import QMenu |
11 |
11 |
12 from E5Gui.E5Action import E5Action |
12 from E5Gui.EricAction import EricAction |
13 from E5Gui import E5MessageBox |
13 from E5Gui import EricMessageBox |
14 |
14 |
15 from ..HgExtensionProjectHelper import HgExtensionProjectHelper |
15 from ..HgExtensionProjectHelper import HgExtensionProjectHelper |
16 |
16 |
17 |
17 |
18 class ShelveProjectHelper(HgExtensionProjectHelper): |
18 class ShelveProjectHelper(HgExtensionProjectHelper): |
27 |
27 |
28 def initActions(self): |
28 def initActions(self): |
29 """ |
29 """ |
30 Public method to generate the action objects. |
30 Public method to generate the action objects. |
31 """ |
31 """ |
32 self.hgShelveAct = E5Action( |
32 self.hgShelveAct = EricAction( |
33 self.tr('Shelve changes'), |
33 self.tr('Shelve changes'), |
34 self.tr('Shelve changes...'), |
34 self.tr('Shelve changes...'), |
35 0, 0, self, 'mercurial_shelve') |
35 0, 0, self, 'mercurial_shelve') |
36 self.hgShelveAct.setStatusTip(self.tr( |
36 self.hgShelveAct.setStatusTip(self.tr( |
37 'Shelve all current changes of the project' |
37 'Shelve all current changes of the project' |
41 """<p>This shelves all current changes of the project.</p>""" |
41 """<p>This shelves all current changes of the project.</p>""" |
42 )) |
42 )) |
43 self.hgShelveAct.triggered.connect(self.__hgShelve) |
43 self.hgShelveAct.triggered.connect(self.__hgShelve) |
44 self.actions.append(self.hgShelveAct) |
44 self.actions.append(self.hgShelveAct) |
45 |
45 |
46 self.hgShelveBrowserAct = E5Action( |
46 self.hgShelveBrowserAct = EricAction( |
47 self.tr('Show shelve browser'), |
47 self.tr('Show shelve browser'), |
48 self.tr('Show shelve browser...'), |
48 self.tr('Show shelve browser...'), |
49 0, 0, self, 'mercurial_shelve_browser') |
49 0, 0, self, 'mercurial_shelve_browser') |
50 self.hgShelveBrowserAct.setStatusTip(self.tr( |
50 self.hgShelveBrowserAct.setStatusTip(self.tr( |
51 'Show a dialog with all shelves' |
51 'Show a dialog with all shelves' |
58 )) |
58 )) |
59 self.hgShelveBrowserAct.triggered.connect( |
59 self.hgShelveBrowserAct.triggered.connect( |
60 self.__hgShelveBrowser) |
60 self.__hgShelveBrowser) |
61 self.actions.append(self.hgShelveBrowserAct) |
61 self.actions.append(self.hgShelveBrowserAct) |
62 |
62 |
63 self.hgUnshelveAct = E5Action( |
63 self.hgUnshelveAct = EricAction( |
64 self.tr('Restore shelved change'), |
64 self.tr('Restore shelved change'), |
65 self.tr('Restore shelved change...'), |
65 self.tr('Restore shelved change...'), |
66 0, 0, self, 'mercurial_unshelve') |
66 0, 0, self, 'mercurial_unshelve') |
67 self.hgUnshelveAct.setStatusTip(self.tr( |
67 self.hgUnshelveAct.setStatusTip(self.tr( |
68 'Restore a shelved change to the project directory' |
68 'Restore a shelved change to the project directory' |
73 """</p>""" |
73 """</p>""" |
74 )) |
74 )) |
75 self.hgUnshelveAct.triggered.connect(self.__hgUnshelve) |
75 self.hgUnshelveAct.triggered.connect(self.__hgUnshelve) |
76 self.actions.append(self.hgUnshelveAct) |
76 self.actions.append(self.hgUnshelveAct) |
77 |
77 |
78 self.hgUnshelveAbortAct = E5Action( |
78 self.hgUnshelveAbortAct = EricAction( |
79 self.tr('Abort restore'), |
79 self.tr('Abort restore'), |
80 self.tr('Abort restore...'), |
80 self.tr('Abort restore...'), |
81 0, 0, self, 'mercurial_unshelve_abort') |
81 0, 0, self, 'mercurial_unshelve_abort') |
82 self.hgUnshelveAbortAct.setStatusTip(self.tr( |
82 self.hgUnshelveAbortAct.setStatusTip(self.tr( |
83 'Abort the restore operation in progress' |
83 'Abort the restore operation in progress' |
88 """ already applied changes.</p>""" |
88 """ already applied changes.</p>""" |
89 )) |
89 )) |
90 self.hgUnshelveAbortAct.triggered.connect(self.__hgUnshelveAbort) |
90 self.hgUnshelveAbortAct.triggered.connect(self.__hgUnshelveAbort) |
91 self.actions.append(self.hgUnshelveAbortAct) |
91 self.actions.append(self.hgUnshelveAbortAct) |
92 |
92 |
93 self.hgUnshelveContinueAct = E5Action( |
93 self.hgUnshelveContinueAct = EricAction( |
94 self.tr('Continue restore'), |
94 self.tr('Continue restore'), |
95 self.tr('Continue restore...'), |
95 self.tr('Continue restore...'), |
96 0, 0, self, 'mercurial_unshelve_continue') |
96 0, 0, self, 'mercurial_unshelve_continue') |
97 self.hgUnshelveContinueAct.setStatusTip(self.tr( |
97 self.hgUnshelveContinueAct.setStatusTip(self.tr( |
98 'Continue the restore operation in progress' |
98 'Continue the restore operation in progress' |
103 )) |
103 )) |
104 self.hgUnshelveContinueAct.triggered.connect( |
104 self.hgUnshelveContinueAct.triggered.connect( |
105 self.__hgUnshelveContinue) |
105 self.__hgUnshelveContinue) |
106 self.actions.append(self.hgUnshelveContinueAct) |
106 self.actions.append(self.hgUnshelveContinueAct) |
107 |
107 |
108 self.hgShelveDeleteAct = E5Action( |
108 self.hgShelveDeleteAct = EricAction( |
109 self.tr('Delete shelved changes'), |
109 self.tr('Delete shelved changes'), |
110 self.tr('Delete shelved changes...'), |
110 self.tr('Delete shelved changes...'), |
111 0, 0, self, 'mercurial_shelve_delete') |
111 0, 0, self, 'mercurial_shelve_delete') |
112 self.hgShelveDeleteAct.setWhatsThis(self.tr( |
112 self.hgShelveDeleteAct.setWhatsThis(self.tr( |
113 """<b>Delete shelved changes...</b>""" |
113 """<b>Delete shelved changes...</b>""" |
116 )) |
116 )) |
117 self.hgShelveDeleteAct.triggered.connect( |
117 self.hgShelveDeleteAct.triggered.connect( |
118 self.__hgDeleteShelves) |
118 self.__hgDeleteShelves) |
119 self.actions.append(self.hgShelveDeleteAct) |
119 self.actions.append(self.hgShelveDeleteAct) |
120 |
120 |
121 self.hgShelveCleanupAct = E5Action( |
121 self.hgShelveCleanupAct = EricAction( |
122 self.tr('Delete ALL shelved changes'), |
122 self.tr('Delete ALL shelved changes'), |
123 self.tr('Delete ALL shelved changes'), |
123 self.tr('Delete ALL shelved changes'), |
124 0, 0, self, 'mercurial_shelve_cleanup') |
124 0, 0, self, 'mercurial_shelve_cleanup') |
125 self.hgShelveCleanupAct.setWhatsThis(self.tr( |
125 self.hgShelveCleanupAct.setWhatsThis(self.tr( |
126 """<b>Delete ALL shelved changes</b>""" |
126 """<b>Delete ALL shelved changes</b>""" |
168 @param shouldReopen flag indicating that the project should |
168 @param shouldReopen flag indicating that the project should |
169 be reopened (boolean) |
169 be reopened (boolean) |
170 @param title title of the message box (string) |
170 @param title title of the message box (string) |
171 """ |
171 """ |
172 if shouldReopen: |
172 if shouldReopen: |
173 res = E5MessageBox.yesNo( |
173 res = EricMessageBox.yesNo( |
174 None, |
174 None, |
175 title, |
175 title, |
176 self.tr("""The project should be reread. Do this now?"""), |
176 self.tr("""The project should be reread. Do this now?"""), |
177 yesDefault=True) |
177 yesDefault=True) |
178 if res: |
178 if res: |