Plugins/VcsPlugins/vcsMercurial/FetchExtension/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
32 def initActions(self): 32 def initActions(self):
33 """ 33 """
34 Public method to generate the action objects. 34 Public method to generate the action objects.
35 """ 35 """
36 self.hgFetchAct = E5Action( 36 self.hgFetchAct = E5Action(
37 self.trUtf8('Fetch changes'), 37 self.tr('Fetch changes'),
38 UI.PixmapCache.getIcon("vcsUpdate.png"), 38 UI.PixmapCache.getIcon("vcsUpdate.png"),
39 self.trUtf8('Fetch changes'), 39 self.tr('Fetch changes'),
40 0, 0, self, 'mercurial_fetch') 40 0, 0, self, 'mercurial_fetch')
41 self.hgFetchAct.setStatusTip(self.trUtf8( 41 self.hgFetchAct.setStatusTip(self.tr(
42 'Fetch changes from a remote repository' 42 'Fetch changes from a remote repository'
43 )) 43 ))
44 self.hgFetchAct.setWhatsThis(self.trUtf8( 44 self.hgFetchAct.setWhatsThis(self.tr(
45 """<b>Fetch changes</b>""" 45 """<b>Fetch changes</b>"""
46 """<p>This pulls changes from a remote repository into the """ 46 """<p>This pulls changes from a remote repository into the """
47 """local repository. If the pulled changes add a new branch""" 47 """local repository. If the pulled changes add a new branch"""
48 """ head, the head is automatically merged, and the result of""" 48 """ head, the head is automatically merged, and the result of"""
49 """ the merge is committed. Otherwise, the working directory""" 49 """ the merge is committed. Otherwise, the working directory"""
50 """ is updated to include the new changes.</p>""" 50 """ is updated to include the new changes.</p>"""
51 )) 51 ))
52 self.hgFetchAct.triggered[()].connect(self.__hgFetch) 52 self.hgFetchAct.triggered.connect(self.__hgFetch)
53 self.actions.append(self.hgFetchAct) 53 self.actions.append(self.hgFetchAct)
54 54
55 def initMenu(self, mainMenu): 55 def initMenu(self, mainMenu):
56 """ 56 """
57 Public method to generate the extension menu. 57 Public method to generate the extension menu.
63 menu.setIcon(UI.PixmapCache.getIcon("vcsUpdate.png")) 63 menu.setIcon(UI.PixmapCache.getIcon("vcsUpdate.png"))
64 menu.setTearOffEnabled(True) 64 menu.setTearOffEnabled(True)
65 65
66 menu.addAction(self.hgFetchAct) 66 menu.addAction(self.hgFetchAct)
67 67
68 menu.aboutToShow.connect(self.__aboutToShowMenu)
69
68 return menu 70 return menu
71
72 def __aboutToShowMenu(self):
73 """
74 Private slot to handle the aboutToShow signal of the background menu.
75 """
76 self.hgFetchAct.setEnabled(self.vcs.canPull())
69 77
70 def menuTitle(self): 78 def menuTitle(self):
71 """ 79 """
72 Public method to get the menu title. 80 Public method to get the menu title.
73 81
74 @return title of the menu (string) 82 @return title of the menu (string)
75 """ 83 """
76 return self.trUtf8("Fetch") 84 return self.tr("Fetch")
77 85
78 def __hgFetch(self): 86 def __hgFetch(self):
79 """ 87 """
80 Private slot used to fetch changes from a remote repository. 88 Private slot used to fetch changes from a remote repository.
81 """ 89 """
82 shouldReopen = self.vcs.getExtensionObject("fetch")\ 90 shouldReopen = self.vcs.getExtensionObject("fetch")\
83 .hgFetch(self.project.getProjectPath()) 91 .hgFetch(self.project.getProjectPath())
84 if shouldReopen: 92 if shouldReopen:
85 res = E5MessageBox.yesNo( 93 res = E5MessageBox.yesNo(
86 None, 94 None,
87 self.trUtf8("Fetch"), 95 self.tr("Fetch"),
88 self.trUtf8("""The project should be reread. Do this now?"""), 96 self.tr("""The project should be reread. Do this now?"""),
89 yesDefault=True) 97 yesDefault=True)
90 if res: 98 if res:
91 self.project.reopenProject() 99 self.project.reopenProject()

eric ide

mercurial