19 |
19 |
20 class HisteditProjectHelper(HgExtensionProjectHelper): |
20 class HisteditProjectHelper(HgExtensionProjectHelper): |
21 """ |
21 """ |
22 Class implementing the histedit extension project helper. |
22 Class implementing the histedit extension project helper. |
23 """ |
23 """ |
|
24 |
24 def __init__(self): |
25 def __init__(self): |
25 """ |
26 """ |
26 Constructor |
27 Constructor |
27 """ |
28 """ |
28 super().__init__() |
29 super().__init__() |
29 |
30 |
30 def initActions(self): |
31 def initActions(self): |
31 """ |
32 """ |
32 Public method to generate the action objects. |
33 Public method to generate the action objects. |
33 """ |
34 """ |
34 self.hgHisteditStartAct = EricAction( |
35 self.hgHisteditStartAct = EricAction( |
35 self.tr('Start'), |
36 self.tr("Start"), |
36 UI.PixmapCache.getIcon("vcsEditHistory"), |
37 UI.PixmapCache.getIcon("vcsEditHistory"), |
37 self.tr('Start'), |
38 self.tr("Start"), |
38 0, 0, self, 'mercurial_histedit_start') |
39 0, |
39 self.hgHisteditStartAct.setStatusTip(self.tr( |
40 0, |
40 'Start a new changeset history editing session' |
41 self, |
41 )) |
42 "mercurial_histedit_start", |
42 self.hgHisteditStartAct.setWhatsThis(self.tr( |
43 ) |
43 """<b>Start</b>""" |
44 self.hgHisteditStartAct.setStatusTip( |
44 """<p>This starts a new history editing session. A dialog""" |
45 self.tr("Start a new changeset history editing session") |
45 """ will be presented to modify the edit plan.</p>""" |
46 ) |
46 )) |
47 self.hgHisteditStartAct.setWhatsThis( |
|
48 self.tr( |
|
49 """<b>Start</b>""" |
|
50 """<p>This starts a new history editing session. A dialog""" |
|
51 """ will be presented to modify the edit plan.</p>""" |
|
52 ) |
|
53 ) |
47 self.hgHisteditStartAct.triggered.connect(self.__hgHisteditStart) |
54 self.hgHisteditStartAct.triggered.connect(self.__hgHisteditStart) |
48 self.actions.append(self.hgHisteditStartAct) |
55 self.actions.append(self.hgHisteditStartAct) |
49 |
56 |
50 self.hgHisteditContinueAct = EricAction( |
57 self.hgHisteditContinueAct = EricAction( |
51 self.tr('Continue'), |
58 self.tr("Continue"), |
52 self.tr('Continue'), |
59 self.tr("Continue"), |
53 0, 0, self, 'mercurial_histedit_continue') |
60 0, |
54 self.hgHisteditContinueAct.setStatusTip(self.tr( |
61 0, |
55 'Continue an interrupted changeset history editing session' |
62 self, |
56 )) |
63 "mercurial_histedit_continue", |
57 self.hgHisteditContinueAct.setWhatsThis(self.tr( |
64 ) |
58 """<b>Continue</b>""" |
65 self.hgHisteditContinueAct.setStatusTip( |
59 """<p>This continues an interrupted history editing session.</p>""" |
66 self.tr("Continue an interrupted changeset history editing session") |
60 )) |
67 ) |
|
68 self.hgHisteditContinueAct.setWhatsThis( |
|
69 self.tr( |
|
70 """<b>Continue</b>""" |
|
71 """<p>This continues an interrupted history editing session.</p>""" |
|
72 ) |
|
73 ) |
61 self.hgHisteditContinueAct.triggered.connect(self.__hgHisteditContinue) |
74 self.hgHisteditContinueAct.triggered.connect(self.__hgHisteditContinue) |
62 self.actions.append(self.hgHisteditContinueAct) |
75 self.actions.append(self.hgHisteditContinueAct) |
63 |
76 |
64 self.hgHisteditAbortAct = EricAction( |
77 self.hgHisteditAbortAct = EricAction( |
65 self.tr('Abort'), |
78 self.tr("Abort"), self.tr("Abort"), 0, 0, self, "mercurial_histedit_abort" |
66 self.tr('Abort'), |
79 ) |
67 0, 0, self, 'mercurial_histedit_abort') |
80 self.hgHisteditAbortAct.setStatusTip( |
68 self.hgHisteditAbortAct.setStatusTip(self.tr( |
81 self.tr("Abort an interrupted changeset history editing session") |
69 'Abort an interrupted changeset history editing session' |
82 ) |
70 )) |
83 self.hgHisteditAbortAct.setWhatsThis( |
71 self.hgHisteditAbortAct.setWhatsThis(self.tr( |
84 self.tr( |
72 """<b>Abort</b>""" |
85 """<b>Abort</b>""" |
73 """<p>This aborts an interrupted history editing session.</p>""" |
86 """<p>This aborts an interrupted history editing session.</p>""" |
74 )) |
87 ) |
|
88 ) |
75 self.hgHisteditAbortAct.triggered.connect(self.__hgHisteditAbort) |
89 self.hgHisteditAbortAct.triggered.connect(self.__hgHisteditAbort) |
76 self.actions.append(self.hgHisteditAbortAct) |
90 self.actions.append(self.hgHisteditAbortAct) |
77 |
91 |
78 self.hgHisteditEditPlanAct = EricAction( |
92 self.hgHisteditEditPlanAct = EricAction( |
79 self.tr('Edit Plan'), |
93 self.tr("Edit Plan"), |
80 self.tr('Edit Plan'), |
94 self.tr("Edit Plan"), |
81 0, 0, self, 'mercurial_histedit_edit_plan') |
95 0, |
82 self.hgHisteditEditPlanAct.setStatusTip(self.tr( |
96 0, |
83 'Edit the remaining actions list' |
97 self, |
84 )) |
98 "mercurial_histedit_edit_plan", |
85 self.hgHisteditEditPlanAct.setWhatsThis(self.tr( |
99 ) |
86 """<b>Edit Plan</b>""" |
100 self.hgHisteditEditPlanAct.setStatusTip( |
87 """<p>This opens an editor to edit the remaining actions list""" |
101 self.tr("Edit the remaining actions list") |
88 """ of an interrupted history editing session.</p>""" |
102 ) |
89 )) |
103 self.hgHisteditEditPlanAct.setWhatsThis( |
|
104 self.tr( |
|
105 """<b>Edit Plan</b>""" |
|
106 """<p>This opens an editor to edit the remaining actions list""" |
|
107 """ of an interrupted history editing session.</p>""" |
|
108 ) |
|
109 ) |
90 self.hgHisteditEditPlanAct.triggered.connect(self.__hgHisteditEditPlan) |
110 self.hgHisteditEditPlanAct.triggered.connect(self.__hgHisteditEditPlan) |
91 self.actions.append(self.hgHisteditEditPlanAct) |
111 self.actions.append(self.hgHisteditEditPlanAct) |
92 |
112 |
93 def initMenu(self, mainMenu): |
113 def initMenu(self, mainMenu): |
94 """ |
114 """ |
95 Public method to generate the extension menu. |
115 Public method to generate the extension menu. |
96 |
116 |
97 @param mainMenu reference to the main menu |
117 @param mainMenu reference to the main menu |
98 @type QMenu |
118 @type QMenu |
99 @return populated menu (QMenu) |
119 @return populated menu (QMenu) |
100 """ |
120 """ |
101 menu = QMenu(self.menuTitle(), mainMenu) |
121 menu = QMenu(self.menuTitle(), mainMenu) |
102 menu.setIcon(UI.PixmapCache.getIcon("vcsEditHistory")) |
122 menu.setIcon(UI.PixmapCache.getIcon("vcsEditHistory")) |
103 menu.setTearOffEnabled(True) |
123 menu.setTearOffEnabled(True) |
104 |
124 |
105 menu.addAction(self.hgHisteditStartAct) |
125 menu.addAction(self.hgHisteditStartAct) |
106 menu.addSeparator() |
126 menu.addSeparator() |
107 menu.addAction(self.hgHisteditContinueAct) |
127 menu.addAction(self.hgHisteditContinueAct) |
108 menu.addAction(self.hgHisteditAbortAct) |
128 menu.addAction(self.hgHisteditAbortAct) |
109 menu.addSeparator() |
129 menu.addSeparator() |
110 menu.addAction(self.hgHisteditEditPlanAct) |
130 menu.addAction(self.hgHisteditEditPlanAct) |
111 |
131 |
112 return menu |
132 return menu |
113 |
133 |
114 def menuTitle(self): |
134 def menuTitle(self): |
115 """ |
135 """ |
116 Public method to get the menu title. |
136 Public method to get the menu title. |
117 |
137 |
118 @return title of the menu |
138 @return title of the menu |
119 @rtype str |
139 @rtype str |
120 """ |
140 """ |
121 return self.tr("Edit History") |
141 return self.tr("Edit History") |
122 |
142 |
123 def __hgHisteditStart(self): |
143 def __hgHisteditStart(self): |
124 """ |
144 """ |
125 Private slot used to start a history editing session. |
145 Private slot used to start a history editing session. |
126 """ |
146 """ |
127 shouldReopen = ( |
147 shouldReopen = self.vcs.getExtensionObject("histedit").hgHisteditStart() |
128 self.vcs.getExtensionObject("histedit").hgHisteditStart() |
|
129 ) |
|
130 if shouldReopen: |
148 if shouldReopen: |
131 res = EricMessageBox.yesNo( |
149 res = EricMessageBox.yesNo( |
132 None, |
150 None, |
133 self.tr("Start History Editing"), |
151 self.tr("Start History Editing"), |
134 self.tr("""The project should be reread. Do this now?"""), |
152 self.tr("""The project should be reread. Do this now?"""), |
135 yesDefault=True) |
153 yesDefault=True, |
136 if res: |
154 ) |
137 self.project.reopenProject() |
155 if res: |
138 |
156 self.project.reopenProject() |
|
157 |
139 def __hgHisteditContinue(self): |
158 def __hgHisteditContinue(self): |
140 """ |
159 """ |
141 Private slot used to continue an interrupted history editing session. |
160 Private slot used to continue an interrupted history editing session. |
142 """ |
161 """ |
143 shouldReopen = ( |
162 shouldReopen = self.vcs.getExtensionObject("histedit").hgHisteditContinue() |
144 self.vcs.getExtensionObject("histedit").hgHisteditContinue() |
|
145 ) |
|
146 if shouldReopen: |
163 if shouldReopen: |
147 res = EricMessageBox.yesNo( |
164 res = EricMessageBox.yesNo( |
148 None, |
165 None, |
149 self.tr("Continue History Editing"), |
166 self.tr("Continue History Editing"), |
150 self.tr("""The project should be reread. Do this now?"""), |
167 self.tr("""The project should be reread. Do this now?"""), |
151 yesDefault=True) |
168 yesDefault=True, |
152 if res: |
169 ) |
153 self.project.reopenProject() |
170 if res: |
154 |
171 self.project.reopenProject() |
|
172 |
155 def __hgHisteditAbort(self): |
173 def __hgHisteditAbort(self): |
156 """ |
174 """ |
157 Private slot used to abort an interrupted history editing session. |
175 Private slot used to abort an interrupted history editing session. |
158 """ |
176 """ |
159 shouldReopen = ( |
177 shouldReopen = self.vcs.getExtensionObject("histedit").hgHisteditAbort() |
160 self.vcs.getExtensionObject("histedit").hgHisteditAbort() |
|
161 ) |
|
162 if shouldReopen: |
178 if shouldReopen: |
163 res = EricMessageBox.yesNo( |
179 res = EricMessageBox.yesNo( |
164 None, |
180 None, |
165 self.tr("Abort History Editing"), |
181 self.tr("Abort History Editing"), |
166 self.tr("""The project should be reread. Do this now?"""), |
182 self.tr("""The project should be reread. Do this now?"""), |
167 yesDefault=True) |
183 yesDefault=True, |
168 if res: |
184 ) |
169 self.project.reopenProject() |
185 if res: |
170 |
186 self.project.reopenProject() |
|
187 |
171 def __hgHisteditEditPlan(self): |
188 def __hgHisteditEditPlan(self): |
172 """ |
189 """ |
173 Private slot used to edit the remaining actions list of an interrupted |
190 Private slot used to edit the remaining actions list of an interrupted |
174 history editing session. |
191 history editing session. |
175 """ |
192 """ |
176 shouldReopen = ( |
193 shouldReopen = self.vcs.getExtensionObject("histedit").hgHisteditEditPlan() |
177 self.vcs.getExtensionObject("histedit").hgHisteditEditPlan() |
|
178 ) |
|
179 if shouldReopen: |
194 if shouldReopen: |
180 res = EricMessageBox.yesNo( |
195 res = EricMessageBox.yesNo( |
181 None, |
196 None, |
182 self.tr("Edit Plan"), |
197 self.tr("Edit Plan"), |
183 self.tr("""The project should be reread. Do this now?"""), |
198 self.tr("""The project should be reread. Do this now?"""), |
184 yesDefault=True) |
199 yesDefault=True, |
185 if res: |
200 ) |
186 self.project.reopenProject() |
201 if res: |
|
202 self.project.reopenProject() |