Skip to content

Commit

Permalink
more formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hugow committed Apr 2, 2024
1 parent 97deb9e commit a0209ea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/packages/menuhook/menuhook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def add_menu_item(menu, action, category):
OTHER_SAMPLES = "CBB6F619-57B9-4C81-8135-41958BEF5BED"
registered_items = []

#pylint: disable=too-many-arguments
#pylint: disable=too-many-arguments, line-too-long
def register(action, category, fcn, menu=None, text=None, tooltip=None, in2025_menuid=None, id_2025=None):
"""
Appends a menu item to one of the menus of the main menubar.
Expand All @@ -135,7 +135,7 @@ def register(action, category, fcn, menu=None, text=None, tooltip=None, in2025_m
add_macro(action, category, text or action, tooltip or action, fcn)
if not defined and not menu is None:
add_menu_item(menu, action, category)
#pylint: enable=too-many-arguments, line-too-long, broad-exception-caught
#pylint: enable=too-many-arguments, line-too-long

# for 2025, pre-can a menu for the howtos
def register_howtos_menu_2025(menumgr):
Expand All @@ -157,15 +157,17 @@ def register_howtos_menu_2025(menumgr):
python_development.createsubmenu(
OTHER_SAMPLES,
"Other Samples")

# hook the registered items
for reg in registered_items:
(in2025_menuid, id_2025, category, action) = reg
scriptmenu = menumgr.getmenubyid(in2025_menuid)
if scriptmenu is not None:
try:
scriptmenu.createaction(id_2025, 647394, f"{action}`{category}")
#pylint: disable=line-too-long, broad-exception-caught
except Exception as e:
print(f"Could not create item {category}, {action} in menu {in2025_menuid} because {e}")
#pylint: enable=line-too-long, broad-exception-caught
else:
print(f"Could not create item {category}, {action}, in missing menu {in2025_menuid}")

0 comments on commit a0209ea

Please sign in to comment.