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> Xidorn Quan <me@upsuper.org>
Alexander Bocken <alexander@bocken.org> Alexander Bocken <alexander@bocken.org>
James Elmore <email@jameselmore.org> James Elmore <email@jameselmore.org>
David Culley <6276049+davidculley@users.noreply.github.com>
Rastislav Kish <rastislav.kish@protonmail.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" class_ = "rounded"
if not disables: if not disables:
class_ += " perm" class_ += " perm"
return """<button tabindex=-1 return f"""<button tabindex=-1
{id} {idstr}
class="{class_}" class="{class_}"
type="button" type="button"
title="{tip}" title="{tip}"
onclick="pycmd('{cmd}');{togglesc}return false;" onclick="pycmd('{cmd}');{toggleScript}return false;"
onmousedown="window.event.preventDefault();" onmousedown="window.event.preventDefault();"
> >
{imgelm} {imgelm}
{labelelm} {labelelm}
</button>""".format( </button>"""
imgelm=imgelm,
cmd=cmd,
tip=tip,
labelelm=labelelm,
id=idstr,
togglesc=toggleScript,
class_=class_,
)
def setupShortcuts(self) -> None: def setupShortcuts(self) -> None:
# if a third element is provided, enable shortcut even when no field selected # if a third element is provided, enable shortcut even when no field selected