Commits

Yuya Nishihara committed 4432af9

filectxactions: inline factory method of custom-tools menu again

  • Participants
  • Parent commits 3a72fb1

Comments (0)

Files changed (1)

tortoisehg/hgqt/filectxactions.py

             qtlib.openshell(root, currentfile, self._ui)
 
     def setupCustomToolsMenu(self, location):
-        m = self._createCustomToolsMenu(location)
-        m.triggered.connect(self._runCustomCommandByMenu)
-        m.menuAction().setVisible(bool(self._customactions))
-        self._addAction('customToolsMenu', m.menuAction(), ())
-        self._updateActions()
-
-    def _createCustomToolsMenu(self, location):
         tools, toollist = hglib.tortoisehgtools(self._ui, location)
         submenu = QMenu(_('Custom Tools'), self.parent())
+        submenu.triggered.connect(self._runCustomCommandByMenu)
         for name in toollist:
             if name == '|':
                 submenu.addSeparator()
             else:
                 fdfilters = ()
             self._customactions[name] = (a, fdfilters)
-        return submenu
+        submenu.menuAction().setVisible(bool(self._customactions))
+        self._addAction('customToolsMenu', submenu.menuAction(), ())
+        self._updateActions()
 
     @pyqtSlot(QAction)
     def _runCustomCommandByMenu(self, action):