mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 08:22:24 -04:00
refactor: rename variables
This commit is contained in:
parent
bca0d7a001
commit
8f6538e22e
1 changed files with 11 additions and 9 deletions
|
@ -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}
|
||||||
|
|
Loading…
Reference in a new issue