19 |
19 |
20 class RebaseProjectHelper(HgExtensionProjectHelper): |
20 class RebaseProjectHelper(HgExtensionProjectHelper): |
21 """ |
21 """ |
22 Class implementing the rebase extension project helper. |
22 Class implementing the rebase 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.hgRebaseAct = EricAction( |
35 self.hgRebaseAct = EricAction( |
35 self.tr('Rebase Changesets'), |
36 self.tr("Rebase Changesets"), |
36 UI.PixmapCache.getIcon("vcsRebase"), |
37 UI.PixmapCache.getIcon("vcsRebase"), |
37 self.tr('Rebase Changesets'), |
38 self.tr("Rebase Changesets"), |
38 0, 0, self, 'mercurial_rebase') |
39 0, |
39 self.hgRebaseAct.setStatusTip(self.tr( |
40 0, |
40 'Rebase changesets to another branch' |
41 self, |
41 )) |
42 "mercurial_rebase", |
42 self.hgRebaseAct.setWhatsThis(self.tr( |
43 ) |
43 """<b>Rebase Changesets</b>""" |
44 self.hgRebaseAct.setStatusTip(self.tr("Rebase changesets to another branch")) |
44 """<p>This rebases changesets to another branch.</p>""" |
45 self.hgRebaseAct.setWhatsThis( |
45 )) |
46 self.tr( |
|
47 """<b>Rebase Changesets</b>""" |
|
48 """<p>This rebases changesets to another branch.</p>""" |
|
49 ) |
|
50 ) |
46 self.hgRebaseAct.triggered.connect(self.__hgRebase) |
51 self.hgRebaseAct.triggered.connect(self.__hgRebase) |
47 self.actions.append(self.hgRebaseAct) |
52 self.actions.append(self.hgRebaseAct) |
48 |
53 |
49 self.hgRebaseContinueAct = EricAction( |
54 self.hgRebaseContinueAct = EricAction( |
50 self.tr('Continue Rebase Session'), |
55 self.tr("Continue Rebase Session"), |
51 self.tr('Continue Rebase Session'), |
56 self.tr("Continue Rebase Session"), |
52 0, 0, self, 'mercurial_rebase_continue') |
57 0, |
53 self.hgRebaseContinueAct.setStatusTip(self.tr( |
58 0, |
54 'Continue the last rebase session after repair' |
59 self, |
55 )) |
60 "mercurial_rebase_continue", |
56 self.hgRebaseContinueAct.setWhatsThis(self.tr( |
61 ) |
57 """<b>Continue Rebase Session</b>""" |
62 self.hgRebaseContinueAct.setStatusTip( |
58 """<p>This continues the last rebase session after repair.</p>""" |
63 self.tr("Continue the last rebase session after repair") |
59 )) |
64 ) |
|
65 self.hgRebaseContinueAct.setWhatsThis( |
|
66 self.tr( |
|
67 """<b>Continue Rebase Session</b>""" |
|
68 """<p>This continues the last rebase session after repair.</p>""" |
|
69 ) |
|
70 ) |
60 self.hgRebaseContinueAct.triggered.connect(self.__hgRebaseContinue) |
71 self.hgRebaseContinueAct.triggered.connect(self.__hgRebaseContinue) |
61 self.actions.append(self.hgRebaseContinueAct) |
72 self.actions.append(self.hgRebaseContinueAct) |
62 |
73 |
63 self.hgRebaseAbortAct = EricAction( |
74 self.hgRebaseAbortAct = EricAction( |
64 self.tr('Abort Rebase Session'), |
75 self.tr("Abort Rebase Session"), |
65 self.tr('Abort Rebase Session'), |
76 self.tr("Abort Rebase Session"), |
66 0, 0, self, 'mercurial_rebase_abort') |
77 0, |
67 self.hgRebaseAbortAct.setStatusTip(self.tr( |
78 0, |
68 'Abort the last rebase session' |
79 self, |
69 )) |
80 "mercurial_rebase_abort", |
70 self.hgRebaseAbortAct.setWhatsThis(self.tr( |
81 ) |
71 """<b>Abort Rebase Session</b>""" |
82 self.hgRebaseAbortAct.setStatusTip(self.tr("Abort the last rebase session")) |
72 """<p>This aborts the last rebase session.</p>""" |
83 self.hgRebaseAbortAct.setWhatsThis( |
73 )) |
84 self.tr( |
|
85 """<b>Abort Rebase Session</b>""" |
|
86 """<p>This aborts the last rebase session.</p>""" |
|
87 ) |
|
88 ) |
74 self.hgRebaseAbortAct.triggered.connect(self.__hgRebaseAbort) |
89 self.hgRebaseAbortAct.triggered.connect(self.__hgRebaseAbort) |
75 self.actions.append(self.hgRebaseAbortAct) |
90 self.actions.append(self.hgRebaseAbortAct) |
76 |
91 |
77 def initMenu(self, mainMenu): |
92 def initMenu(self, mainMenu): |
78 """ |
93 """ |
79 Public method to generate the extension menu. |
94 Public method to generate the extension menu. |
80 |
95 |
81 @param mainMenu reference to the main menu (QMenu) |
96 @param mainMenu reference to the main menu (QMenu) |
82 @return populated menu (QMenu) |
97 @return populated menu (QMenu) |
83 """ |
98 """ |
84 menu = QMenu(self.menuTitle(), mainMenu) |
99 menu = QMenu(self.menuTitle(), mainMenu) |
85 menu.setIcon(UI.PixmapCache.getIcon("vcsRebase")) |
100 menu.setIcon(UI.PixmapCache.getIcon("vcsRebase")) |
86 menu.setTearOffEnabled(True) |
101 menu.setTearOffEnabled(True) |
87 |
102 |
88 menu.addAction(self.hgRebaseAct) |
103 menu.addAction(self.hgRebaseAct) |
89 menu.addAction(self.hgRebaseContinueAct) |
104 menu.addAction(self.hgRebaseContinueAct) |
90 menu.addAction(self.hgRebaseAbortAct) |
105 menu.addAction(self.hgRebaseAbortAct) |
91 |
106 |
92 return menu |
107 return menu |
93 |
108 |
94 def menuTitle(self): |
109 def menuTitle(self): |
95 """ |
110 """ |
96 Public method to get the menu title. |
111 Public method to get the menu title. |
97 |
112 |
98 @return title of the menu (string) |
113 @return title of the menu (string) |
99 """ |
114 """ |
100 return self.tr("Rebase") |
115 return self.tr("Rebase") |
101 |
116 |
102 def __hgRebase(self): |
117 def __hgRebase(self): |
103 """ |
118 """ |
104 Private slot used to rebase changesets to another branch. |
119 Private slot used to rebase changesets to another branch. |
105 """ |
120 """ |
106 shouldReopen = self.vcs.getExtensionObject("rebase").hgRebase() |
121 shouldReopen = self.vcs.getExtensionObject("rebase").hgRebase() |
107 if shouldReopen: |
122 if shouldReopen: |
108 res = EricMessageBox.yesNo( |
123 res = EricMessageBox.yesNo( |
109 None, |
124 None, |
110 self.tr("Rebase Changesets"), |
125 self.tr("Rebase Changesets"), |
111 self.tr("""The project should be reread. Do this now?"""), |
126 self.tr("""The project should be reread. Do this now?"""), |
112 yesDefault=True) |
127 yesDefault=True, |
|
128 ) |
113 if res: |
129 if res: |
114 self.project.reopenProject() |
130 self.project.reopenProject() |
115 |
131 |
116 def __hgRebaseContinue(self): |
132 def __hgRebaseContinue(self): |
117 """ |
133 """ |
118 Private slot used to continue the last rebase session after repair. |
134 Private slot used to continue the last rebase session after repair. |
119 """ |
135 """ |
120 shouldReopen = self.vcs.getExtensionObject("rebase").hgRebaseContinue() |
136 shouldReopen = self.vcs.getExtensionObject("rebase").hgRebaseContinue() |
121 if shouldReopen: |
137 if shouldReopen: |
122 res = EricMessageBox.yesNo( |
138 res = EricMessageBox.yesNo( |
123 None, |
139 None, |
124 self.tr("Rebase Changesets (Continue)"), |
140 self.tr("Rebase Changesets (Continue)"), |
125 self.tr("""The project should be reread. Do this now?"""), |
141 self.tr("""The project should be reread. Do this now?"""), |
126 yesDefault=True) |
142 yesDefault=True, |
|
143 ) |
127 if res: |
144 if res: |
128 self.project.reopenProject() |
145 self.project.reopenProject() |
129 |
146 |
130 def __hgRebaseAbort(self): |
147 def __hgRebaseAbort(self): |
131 """ |
148 """ |
132 Private slot used to abort the last rebase session. |
149 Private slot used to abort the last rebase session. |
133 """ |
150 """ |
134 shouldReopen = self.vcs.getExtensionObject("rebase").hgRebaseAbort() |
151 shouldReopen = self.vcs.getExtensionObject("rebase").hgRebaseAbort() |
135 if shouldReopen: |
152 if shouldReopen: |
136 res = EricMessageBox.yesNo( |
153 res = EricMessageBox.yesNo( |
137 None, |
154 None, |
138 self.tr("Rebase Changesets (Abort)"), |
155 self.tr("Rebase Changesets (Abort)"), |
139 self.tr("""The project should be reread. Do this now?"""), |
156 self.tr("""The project should be reread. Do this now?"""), |
140 yesDefault=True) |
157 yesDefault=True, |
|
158 ) |
141 if res: |
159 if res: |
142 self.project.reopenProject() |
160 self.project.reopenProject() |