From 48dd3cd5aa048b36d22aed07c513c131084278d0 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Sun, 29 Dec 2019 12:31:36 +0000 Subject: [PATCH] Clean up function names in menu definitions Now that the functions called from menus are filtered and resolved safely rather than being directly executed, the explicit mudpy package name and the user parameter passing are no longer necessary. Remove them from the function names in menu definitions and also drop the old compatibility code which trims them. --- mudpy/misc.py | 7 ------- share/menu.yaml | 44 ++++++++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/mudpy/misc.py b/mudpy/misc.py index 2cd7992..5f09938 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -1680,13 +1680,6 @@ def get_choice_action(user): def call_hook_function(fname, arglist): """Safely execute named function with supplied arguments, return result.""" - # strip any explicit leader or parameter - # TODO(fungi) remove this once the menu functions transition is complete - if fname.startswith("mudpy."): - fname = fname[6:] - if fname.endswith("(user)"): - fname = fname[:-6] - # all functions relative to mudpy package function = mudpy diff --git a/share/menu.yaml b/share/menu.yaml index 2857c38..fa5baaf 100644 --- a/share/menu.yaml +++ b/share/menu.yaml @@ -7,11 +7,11 @@ _desc: This is the standard library of menu definitions. _lock: true -menu.activate_avatar.action: mudpy.menu.activate_avatar_action(user) -menu.activate_avatar.action_a: mudpy.menu.activate_avatar_action_a(user) +menu.activate_avatar.action: menu.activate_avatar_action +menu.activate_avatar.action_a: menu.activate_avatar_action_a menu.activate_avatar.branch_a: main_utility menu.activate_avatar.choice_a: abort selection -menu.activate_avatar.create: mudpy.menu.activate_avatar_create(user) +menu.activate_avatar.create: menu.activate_avatar_create menu.activate_avatar.default: "1" menu.activate_avatar.description: This is the list of avatars available for you to awaken. @@ -20,9 +20,9 @@ menu.activate_avatar.prompt: Whom would you like to awaken? menu.active.prompt: ">" menu.checking_new_account_name.action_d: - mudpy.menu.checking_new_account_name_action_d(user) + menu.checking_new_account_name_action_d menu.checking_new_account_name.action_g: - mudpy.menu.checking_new_account_name_action_g(user) + menu.checking_new_account_name_action_g menu.checking_new_account_name.branch_d: disconnecting menu.checking_new_account_name.branch_g: entering_account_name menu.checking_new_account_name.branch_n: entering_new_password @@ -40,7 +40,7 @@ menu.checking_password.echo: false menu.checking_password.error_incorrect: Incorrect password, please try again... menu.checking_password.prompt: "Password:" -menu.choose_gender.action: mudpy.menu.choose_gender_action(user) +menu.choose_gender.action: menu.choose_gender_action menu.choose_gender.branch: choose_name menu.choose_gender.choice_f: female menu.choose_gender.choice_m: male @@ -48,17 +48,17 @@ menu.choose_gender.description: First, your new avatar needs a birth gender. Avatars are one of male or female at birth. menu.choose_gender.prompt: "Pick a birth gender for your new avatar:" -menu.choose_name.action: mudpy.menu.choose_name_action(user) +menu.choose_name.action: menu.choose_name_action menu.choose_name.branch: main_utility menu.choose_name.branch_g: choose_name menu.choose_name.choice_g: generate more names -menu.choose_name.create_1: mudpy.menu.choose_name_create_1(user) -menu.choose_name.create_2: mudpy.menu.choose_name_create_2(user) -menu.choose_name.create_3: mudpy.menu.choose_name_create_3(user) -menu.choose_name.create_4: mudpy.menu.choose_name_create_4(user) -menu.choose_name.create_5: mudpy.menu.choose_name_create_5(user) -menu.choose_name.create_6: mudpy.menu.choose_name_create_6(user) -menu.choose_name.create_7: mudpy.menu.choose_name_create_7(user) +menu.choose_name.create_1: menu.choose_name_create_1 +menu.choose_name.create_2: menu.choose_name_create_2 +menu.choose_name.create_3: menu.choose_name_create_3 +menu.choose_name.create_4: menu.choose_name_create_4 +menu.choose_name.create_5: menu.choose_name_create_5 +menu.choose_name.create_6: menu.choose_name_create_6 +menu.choose_name.create_7: menu.choose_name_create_7 menu.choose_name.default: g menu.choose_name.description: Your new avatar needs a name. This will be the name with which $(tpsp) grew up, and will initially be the name by which @@ -67,7 +67,7 @@ menu.choose_name.description: Your new avatar needs a name. This will be the unremarkable name forever. menu.choose_name.prompt: "Choose a name for $(tpop):" -menu.delete_account.action_y: mudpy.menu.delete_account_action_y(user) +menu.delete_account.action_y: menu.delete_account_action_y menu.delete_account.branch_n: main_utility menu.delete_account.branch_y: disconnecting menu.delete_account.choice_n: no, don't delete my account @@ -78,12 +78,12 @@ menu.delete_account.description: By deleting your account, all your avatars menu.delete_account.prompt: Are you certain you wish to permanently delete your account? -menu.delete_avatar.action: mudpy.menu.delete_avatar_action(user) -menu.delete_avatar.action_a: mudpy.menu.delete_avatar_action_a(user) +menu.delete_avatar.action: menu.delete_avatar_action +menu.delete_avatar.action_a: menu.delete_avatar_action_a menu.delete_avatar.branch: main_utility menu.delete_avatar.branch_a: main_utility menu.delete_avatar.choice_a: abort selection -menu.delete_avatar.create: mudpy.menu.delete_avatar_create(user) +menu.delete_avatar.create: menu.delete_avatar_create menu.delete_avatar.default: a menu.delete_avatar.description: This is the list of avatars available for you to delete. @@ -109,7 +109,7 @@ menu.entering_new_password.error_differs: The two passwords did not match. Try menu.telopt_negotiation.prompt: -menu.main_utility.action_c: mudpy.menu.main_utility_action_c(user) +menu.main_utility.action_c: menu.main_utility_action_c menu.main_utility.branch_a: activate_avatar menu.main_utility.branch_c: choose_gender menu.main_utility.branch_d: delete_avatar @@ -120,9 +120,9 @@ menu.main_utility.choice_c: create a new avatar menu.main_utility.choice_d: delete an unwanted avatar menu.main_utility.choice_l: leave for now menu.main_utility.choice_p: permanently remove your account -menu.main_utility.demand_a: mudpy.menu.main_utility_demand_a(user) -menu.main_utility.demand_c: mudpy.menu.main_utility_demand_c(user) -menu.main_utility.demand_d: mudpy.menu.main_utility_demand_d(user) +menu.main_utility.demand_a: menu.main_utility_demand_a +menu.main_utility.demand_c: menu.main_utility_demand_c +menu.main_utility.demand_d: menu.main_utility_demand_d menu.main_utility.description: $(red)$(inc:banner.txt)$(nrm)$(eol)$(eol)From here you can awaken, create and delete avatars. An avatar is your persona in the World. You can also leave or permanently delete your account. -- 2.11.0