Plugins/VcsPlugins/vcsMercurial/TransplantExtension/ProjectHelper.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3345
071afe8be2a1
child 3656
441956d8fce5
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
47 def initActions(self): 47 def initActions(self):
48 """ 48 """
49 Public method to generate the action objects. 49 Public method to generate the action objects.
50 """ 50 """
51 self.hgTransplantAct = E5Action( 51 self.hgTransplantAct = E5Action(
52 self.trUtf8('Transplant Changesets'), 52 self.tr('Transplant Changesets'),
53 UI.PixmapCache.getIcon("vcsTransplant.png"), 53 UI.PixmapCache.getIcon("vcsTransplant.png"),
54 self.trUtf8('Transplant Changesets'), 54 self.tr('Transplant Changesets'),
55 0, 0, self, 'mercurial_transplant') 55 0, 0, self, 'mercurial_transplant')
56 self.hgTransplantAct.setStatusTip(self.trUtf8( 56 self.hgTransplantAct.setStatusTip(self.tr(
57 'Transplant changesets from another branch' 57 'Transplant changesets from another branch'
58 )) 58 ))
59 self.hgTransplantAct.setWhatsThis(self.trUtf8( 59 self.hgTransplantAct.setWhatsThis(self.tr(
60 """<b>Transplant Changesets</b>""" 60 """<b>Transplant Changesets</b>"""
61 """<p>This transplants changesets from another branch on top""" 61 """<p>This transplants changesets from another branch on top"""
62 """ of the current working directory with the log of the""" 62 """ of the current working directory with the log of the"""
63 """ original changeset.</p>""" 63 """ original changeset.</p>"""
64 )) 64 ))
65 self.hgTransplantAct.triggered[()].connect(self.__hgTransplant) 65 self.hgTransplantAct.triggered.connect(self.__hgTransplant)
66 self.actions.append(self.hgTransplantAct) 66 self.actions.append(self.hgTransplantAct)
67 67
68 self.hgTransplantContinueAct = E5Action( 68 self.hgTransplantContinueAct = E5Action(
69 self.trUtf8('Continue Transplant Session'), 69 self.tr('Continue Transplant Session'),
70 self.trUtf8('Continue Transplant Session'), 70 self.tr('Continue Transplant Session'),
71 0, 0, self, 'mercurial_transplant_continue') 71 0, 0, self, 'mercurial_transplant_continue')
72 self.hgTransplantContinueAct.setStatusTip(self.trUtf8( 72 self.hgTransplantContinueAct.setStatusTip(self.tr(
73 'Continue the last transplant session after repair' 73 'Continue the last transplant session after repair'
74 )) 74 ))
75 self.hgTransplantContinueAct.setWhatsThis(self.trUtf8( 75 self.hgTransplantContinueAct.setWhatsThis(self.tr(
76 """<b>Continue Transplant Session</b>""" 76 """<b>Continue Transplant Session</b>"""
77 """<p>This continues the last transplant session after""" 77 """<p>This continues the last transplant session after"""
78 """ repair.</p>""" 78 """ repair.</p>"""
79 )) 79 ))
80 self.hgTransplantContinueAct.triggered[()].connect( 80 self.hgTransplantContinueAct.triggered.connect(
81 self.__hgTransplantContinue) 81 self.__hgTransplantContinue)
82 self.actions.append(self.hgTransplantContinueAct) 82 self.actions.append(self.hgTransplantContinueAct)
83 83
84 def initMenu(self, mainMenu): 84 def initMenu(self, mainMenu):
85 """ 85 """
91 menu = QMenu(self.menuTitle(), mainMenu) 91 menu = QMenu(self.menuTitle(), mainMenu)
92 menu.setIcon(UI.PixmapCache.getIcon("vcsTransplant.png")) 92 menu.setIcon(UI.PixmapCache.getIcon("vcsTransplant.png"))
93 if self.vcs.version >= (2, 3): 93 if self.vcs.version >= (2, 3):
94 # transplant is deprecated as of Mercurial 2.3 94 # transplant is deprecated as of Mercurial 2.3
95 menu.addAction( 95 menu.addAction(
96 self.trUtf8("Transplant is deprecated")).setEnabled(False) 96 self.tr("Transplant is deprecated")).setEnabled(False)
97 else: 97 else:
98 menu.setTearOffEnabled(True) 98 menu.setTearOffEnabled(True)
99 99
100 menu.addAction(self.hgTransplantAct) 100 menu.addAction(self.hgTransplantAct)
101 menu.addAction(self.hgTransplantContinueAct) 101 menu.addAction(self.hgTransplantContinueAct)
106 """ 106 """
107 Public method to get the menu title. 107 Public method to get the menu title.
108 108
109 @return title of the menu (string) 109 @return title of the menu (string)
110 """ 110 """
111 return self.trUtf8("Transplant") 111 return self.tr("Transplant")
112 112
113 def __hgTransplant(self): 113 def __hgTransplant(self):
114 """ 114 """
115 Private slot used to transplant changesets from another branch. 115 Private slot used to transplant changesets from another branch.
116 """ 116 """
117 shouldReopen = self.vcs.getExtensionObject("transplant")\ 117 shouldReopen = self.vcs.getExtensionObject("transplant")\
118 .hgTransplant(self.project.getProjectPath()) 118 .hgTransplant(self.project.getProjectPath())
119 if shouldReopen: 119 if shouldReopen:
120 res = E5MessageBox.yesNo( 120 res = E5MessageBox.yesNo(
121 None, 121 None,
122 self.trUtf8("Transplant Changesets"), 122 self.tr("Transplant Changesets"),
123 self.trUtf8("""The project should be reread. Do this now?"""), 123 self.tr("""The project should be reread. Do this now?"""),
124 yesDefault=True) 124 yesDefault=True)
125 if res: 125 if res:
126 self.project.reopenProject() 126 self.project.reopenProject()
127 127
128 def __hgTransplantContinue(self): 128 def __hgTransplantContinue(self):
132 shouldReopen = self.vcs.getExtensionObject("transplant")\ 132 shouldReopen = self.vcs.getExtensionObject("transplant")\
133 .hgTransplantContinue(self.project.getProjectPath()) 133 .hgTransplantContinue(self.project.getProjectPath())
134 if shouldReopen: 134 if shouldReopen:
135 res = E5MessageBox.yesNo( 135 res = E5MessageBox.yesNo(
136 None, 136 None,
137 self.trUtf8("Transplant Changesets (Continue)"), 137 self.tr("Transplant Changesets (Continue)"),
138 self.trUtf8("""The project should be reread. Do this now?"""), 138 self.tr("""The project should be reread. Do this now?"""),
139 yesDefault=True) 139 yesDefault=True)
140 if res: 140 if res:
141 self.project.reopenProject() 141 self.project.reopenProject()

eric ide

mercurial