refactor: rename variables

This commit is contained in:
David Culley 2024-07-10 19:17:50 +02:00
parent bca0d7a001
commit 8f6538e22e
No known key found for this signature in database
GPG key ID: E6D8947E83ACCD4F

View file

@ -295,6 +295,8 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too
disables: bool = True, disables: bool = True,
rightside: bool = True, rightside: bool = True,
) -> str: ) -> str:
title_attribute = tip
if icon: if icon:
if icon.startswith("qrc:/"): if icon.startswith("qrc:/"):
iconstr = icon iconstr = icon
@ -311,22 +313,22 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too
else: else:
label_element = "" label_element = ""
idstr = f"id={id}" if id else "" id_attribute_assignment = f"id={id}" if id else ""
toggleScript = "toggleEditorButton(this);" if toggleable else "" cmd_to_toggle_button = "toggleEditorButton(this);" if toggleable else ""
tip = shortcut(tip) title_attribute = shortcut(title_attribute)
class_ = "linkb" if rightside else "rounded" class_attribute = "linkb" if rightside else "rounded"
if not disables: if not disables:
class_ += " perm" class_attribute += " perm"
return f"""<button tabindex=-1 return f"""<button tabindex=-1
{idstr} {id_attribute_assignment}
class="{class_}" class="{class_attribute}"
type="button" type="button"
title="{tip}" title="{title_attribute}"
onclick="pycmd('{cmd}');{toggleScript}return false;" onclick="pycmd('{cmd}');{cmd_to_toggle_button}return false;"
onmousedown="window.event.preventDefault();" onmousedown="window.event.preventDefault();"
> >
{image_element} {image_element}