eric6/UI/UserInterface.py

changeset 8220
006ee31b4835
parent 8218
7c09585bd960
child 8227
349308e84eeb
--- a/eric6/UI/UserInterface.py	Sun Apr 11 11:34:32 2021 +0200
+++ b/eric6/UI/UserInterface.py	Sun Apr 11 12:38:16 2021 +0200
@@ -4238,9 +4238,10 @@
         self.__menus["user_tools"].addSeparator()
         
         # add the configurable entries
-        idx = 0
         try:
-            for tool in self.toolGroups[self.currentToolGroup][1]:
+            for idx, tool in enumerate(
+                self.toolGroups[self.currentToolGroup][1]
+            ):
                 if tool['menutext'] == '--':
                     self.__menus["user_tools"].addSeparator()
                 else:
@@ -4248,7 +4249,6 @@
                         UI.PixmapCache.getIcon(tool['icon']),
                         tool['menutext'])
                     act.setData(idx)
-                idx += 1
         except IndexError:
             # the current tool group might have been deleted
             act = self.__menus["user_tools"].addAction(
@@ -4263,15 +4263,13 @@
         
         # add the configurable tool groups
         if self.toolGroups:
-            idx = 0
-            for toolGroup in self.toolGroups:
+            for idx, toolGroup in enumerate(self.toolGroups):
                 act = self.toolGroupsMenu.addAction(toolGroup[0])
                 act.setData(idx)
                 if self.currentToolGroup == idx:
                     font = act.font()
                     font.setBold(True)
                     act.setFont(font)
-                idx += 1
         else:
             act = self.toolGroupsMenu.addAction(
                 self.tr("No User Tools Configured"))

eric ide

mercurial