Plugins/VcsPlugins/vcsMercurial/TransplantExtension/ProjectHelper.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3345
071afe8be2a1
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
44 def initActions(self): 44 def initActions(self):
45 """ 45 """
46 Public method to generate the action objects. 46 Public method to generate the action objects.
47 """ 47 """
48 self.hgTransplantAct = E5Action( 48 self.hgTransplantAct = E5Action(
49 self.trUtf8('Transplant Changesets'), 49 self.tr('Transplant Changesets'),
50 UI.PixmapCache.getIcon("vcsTransplant.png"), 50 UI.PixmapCache.getIcon("vcsTransplant.png"),
51 self.trUtf8('Transplant Changesets'), 51 self.tr('Transplant Changesets'),
52 0, 0, self, 'mercurial_transplant') 52 0, 0, self, 'mercurial_transplant')
53 self.hgTransplantAct.setStatusTip(self.trUtf8( 53 self.hgTransplantAct.setStatusTip(self.tr(
54 'Transplant changesets from another branch' 54 'Transplant changesets from another branch'
55 )) 55 ))
56 self.hgTransplantAct.setWhatsThis(self.trUtf8( 56 self.hgTransplantAct.setWhatsThis(self.tr(
57 """<b>Transplant Changesets</b>""" 57 """<b>Transplant Changesets</b>"""
58 """<p>This transplants changesets from another branch on top""" 58 """<p>This transplants changesets from another branch on top"""
59 """ of the current working directory with the log of the""" 59 """ of the current working directory with the log of the"""
60 """ original changeset.</p>""" 60 """ original changeset.</p>"""
61 )) 61 ))
62 self.hgTransplantAct.triggered[()].connect(self.__hgTransplant) 62 self.hgTransplantAct.triggered[()].connect(self.__hgTransplant)
63 self.actions.append(self.hgTransplantAct) 63 self.actions.append(self.hgTransplantAct)
64 64
65 self.hgTransplantContinueAct = E5Action( 65 self.hgTransplantContinueAct = E5Action(
66 self.trUtf8('Continue Transplant Session'), 66 self.tr('Continue Transplant Session'),
67 self.trUtf8('Continue Transplant Session'), 67 self.tr('Continue Transplant Session'),
68 0, 0, self, 'mercurial_transplant_continue') 68 0, 0, self, 'mercurial_transplant_continue')
69 self.hgTransplantContinueAct.setStatusTip(self.trUtf8( 69 self.hgTransplantContinueAct.setStatusTip(self.tr(
70 'Continue the last transplant session after repair' 70 'Continue the last transplant session after repair'
71 )) 71 ))
72 self.hgTransplantContinueAct.setWhatsThis(self.trUtf8( 72 self.hgTransplantContinueAct.setWhatsThis(self.tr(
73 """<b>Continue Transplant Session</b>""" 73 """<b>Continue Transplant Session</b>"""
74 """<p>This continues the last transplant session after""" 74 """<p>This continues the last transplant session after"""
75 """ repair.</p>""" 75 """ repair.</p>"""
76 )) 76 ))
77 self.hgTransplantContinueAct.triggered[()].connect( 77 self.hgTransplantContinueAct.triggered[()].connect(
88 menu = QMenu(self.menuTitle(), mainMenu) 88 menu = QMenu(self.menuTitle(), mainMenu)
89 menu.setIcon(UI.PixmapCache.getIcon("vcsTransplant.png")) 89 menu.setIcon(UI.PixmapCache.getIcon("vcsTransplant.png"))
90 if self.vcs.version >= (2, 3): 90 if self.vcs.version >= (2, 3):
91 # transplant is deprecated as of Mercurial 2.3 91 # transplant is deprecated as of Mercurial 2.3
92 menu.addAction( 92 menu.addAction(
93 self.trUtf8("Transplant is deprecated")).setEnabled(False) 93 self.tr("Transplant is deprecated")).setEnabled(False)
94 else: 94 else:
95 menu.setTearOffEnabled(True) 95 menu.setTearOffEnabled(True)
96 96
97 menu.addAction(self.hgTransplantAct) 97 menu.addAction(self.hgTransplantAct)
98 menu.addAction(self.hgTransplantContinueAct) 98 menu.addAction(self.hgTransplantContinueAct)
103 """ 103 """
104 Public method to get the menu title. 104 Public method to get the menu title.
105 105
106 @return title of the menu (string) 106 @return title of the menu (string)
107 """ 107 """
108 return self.trUtf8("Transplant") 108 return self.tr("Transplant")
109 109
110 def __hgTransplant(self): 110 def __hgTransplant(self):
111 """ 111 """
112 Private slot used to transplant changesets from another branch. 112 Private slot used to transplant changesets from another branch.
113 """ 113 """
114 shouldReopen = self.vcs.getExtensionObject("transplant")\ 114 shouldReopen = self.vcs.getExtensionObject("transplant")\
115 .hgTransplant(self.project.getProjectPath()) 115 .hgTransplant(self.project.getProjectPath())
116 if shouldReopen: 116 if shouldReopen:
117 res = E5MessageBox.yesNo( 117 res = E5MessageBox.yesNo(
118 None, 118 None,
119 self.trUtf8("Transplant Changesets"), 119 self.tr("Transplant Changesets"),
120 self.trUtf8("""The project should be reread. Do this now?"""), 120 self.tr("""The project should be reread. Do this now?"""),
121 yesDefault=True) 121 yesDefault=True)
122 if res: 122 if res:
123 self.project.reopenProject() 123 self.project.reopenProject()
124 124
125 def __hgTransplantContinue(self): 125 def __hgTransplantContinue(self):
129 shouldReopen = self.vcs.getExtensionObject("transplant")\ 129 shouldReopen = self.vcs.getExtensionObject("transplant")\
130 .hgTransplantContinue(self.project.getProjectPath()) 130 .hgTransplantContinue(self.project.getProjectPath())
131 if shouldReopen: 131 if shouldReopen:
132 res = E5MessageBox.yesNo( 132 res = E5MessageBox.yesNo(
133 None, 133 None,
134 self.trUtf8("Transplant Changesets (Continue)"), 134 self.tr("Transplant Changesets (Continue)"),
135 self.trUtf8("""The project should be reread. Do this now?"""), 135 self.tr("""The project should be reread. Do this now?"""),
136 yesDefault=True) 136 yesDefault=True)
137 if res: 137 if res:
138 self.project.reopenProject() 138 self.project.reopenProject()

eric ide

mercurial