Simplify the format string (#3293)

* refactor: simplify format string

* chore: add myself to CONTRIBUTORS file
This commit is contained in:
David Culley 2024-07-10 16:14:51 +02:00 committed by GitHub
parent 56a085bc21
commit 9d8782c31c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 12 deletions

View File

@ -177,6 +177,7 @@ RRomeroJr <117.rromero@gmail.com>
Xidorn Quan <me@upsuper.org>
Alexander Bocken <alexander@bocken.org>
James Elmore <email@jameselmore.org>
David Culley <6276049+davidculley@users.noreply.github.com>
Rastislav Kish <rastislav.kish@protonmail.com>
********************

View File

@ -323,25 +323,17 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too
class_ = "rounded"
if not disables:
class_ += " perm"
return """<button tabindex=-1
{id}
return f"""<button tabindex=-1
{idstr}
class="{class_}"
type="button"
title="{tip}"
onclick="pycmd('{cmd}');{togglesc}return false;"
onclick="pycmd('{cmd}');{toggleScript}return false;"
onmousedown="window.event.preventDefault();"
>
{imgelm}
{labelelm}
</button>""".format(
imgelm=imgelm,
cmd=cmd,
tip=tip,
labelelm=labelelm,
id=idstr,
togglesc=toggleScript,
class_=class_,
)
</button>"""
def setupShortcuts(self) -> None:
# if a third element is provided, enable shortcut even when no field selected