4236 act.setData(-2) |
4236 act.setData(-2) |
4237 act.setEnabled(self.currentToolGroup >= 0) |
4237 act.setEnabled(self.currentToolGroup >= 0) |
4238 self.__menus["user_tools"].addSeparator() |
4238 self.__menus["user_tools"].addSeparator() |
4239 |
4239 |
4240 # add the configurable entries |
4240 # add the configurable entries |
4241 idx = 0 |
|
4242 try: |
4241 try: |
4243 for tool in self.toolGroups[self.currentToolGroup][1]: |
4242 for idx, tool in enumerate( |
|
4243 self.toolGroups[self.currentToolGroup][1] |
|
4244 ): |
4244 if tool['menutext'] == '--': |
4245 if tool['menutext'] == '--': |
4245 self.__menus["user_tools"].addSeparator() |
4246 self.__menus["user_tools"].addSeparator() |
4246 else: |
4247 else: |
4247 act = self.__menus["user_tools"].addAction( |
4248 act = self.__menus["user_tools"].addAction( |
4248 UI.PixmapCache.getIcon(tool['icon']), |
4249 UI.PixmapCache.getIcon(tool['icon']), |
4249 tool['menutext']) |
4250 tool['menutext']) |
4250 act.setData(idx) |
4251 act.setData(idx) |
4251 idx += 1 |
|
4252 except IndexError: |
4252 except IndexError: |
4253 # the current tool group might have been deleted |
4253 # the current tool group might have been deleted |
4254 act = self.__menus["user_tools"].addAction( |
4254 act = self.__menus["user_tools"].addAction( |
4255 self.tr("No User Tools Configured")) |
4255 self.tr("No User Tools Configured")) |
4256 act.setData(-3) |
4256 act.setData(-3) |
4261 """ |
4261 """ |
4262 self.toolGroupsMenu.clear() |
4262 self.toolGroupsMenu.clear() |
4263 |
4263 |
4264 # add the configurable tool groups |
4264 # add the configurable tool groups |
4265 if self.toolGroups: |
4265 if self.toolGroups: |
4266 idx = 0 |
4266 for idx, toolGroup in enumerate(self.toolGroups): |
4267 for toolGroup in self.toolGroups: |
|
4268 act = self.toolGroupsMenu.addAction(toolGroup[0]) |
4267 act = self.toolGroupsMenu.addAction(toolGroup[0]) |
4269 act.setData(idx) |
4268 act.setData(idx) |
4270 if self.currentToolGroup == idx: |
4269 if self.currentToolGroup == idx: |
4271 font = act.font() |
4270 font = act.font() |
4272 font.setBold(True) |
4271 font.setBold(True) |
4273 act.setFont(font) |
4272 act.setFont(font) |
4274 idx += 1 |
|
4275 else: |
4273 else: |
4276 act = self.toolGroupsMenu.addAction( |
4274 act = self.toolGroupsMenu.addAction( |
4277 self.tr("No User Tools Configured")) |
4275 self.tr("No User Tools Configured")) |
4278 act.setData(-3) |
4276 act.setData(-3) |
4279 |
4277 |