Turn _class into rightside boolean flag

This commit is contained in:
Henrik Giesel 2020-10-04 23:03:37 +02:00
parent e8c80174eb
commit e9ca17b1b3

View file

@ -124,16 +124,16 @@ class Editor:
"fields", "fields",
_("Customize Fields"), _("Customize Fields"),
_("Fields") + "...", _("Fields") + "...",
class_="",
disables=False, disables=False,
rightside=False,
), ),
self._addButton( self._addButton(
None, None,
"cards", "cards",
_("Customize Card Templates (Ctrl+L)"), _("Customize Card Templates (Ctrl+L)"),
_("Cards") + "...", _("Cards") + "...",
class_="",
disables=False, disables=False,
rightside=False,
), ),
] ]
@ -227,7 +227,7 @@ class Editor:
toggleable: bool = False, toggleable: bool = False,
keys: str = None, keys: str = None,
disables: bool = True, disables: bool = True,
class_: str = "linkb", rightside: bool = True,
): ):
"""Assign func to bridge cmd, register shortcut, return button""" """Assign func to bridge cmd, register shortcut, return button"""
if func: if func:
@ -246,7 +246,7 @@ class Editor:
id=id, id=id,
toggleable=toggleable, toggleable=toggleable,
disables=disables, disables=disables,
class_=class_, rightside=rightside,
) )
return btn return btn
@ -259,7 +259,7 @@ class Editor:
id: Optional[str] = None, id: Optional[str] = None,
toggleable: bool = False, toggleable: bool = False,
disables: bool = True, disables: bool = True,
class_: str = "linkb", rightside: bool = True,
) -> str: ) -> str:
if icon: if icon:
if icon.startswith("qrc:/"): if icon.startswith("qrc:/"):
@ -284,6 +284,10 @@ class Editor:
else: else:
toggleScript = "" toggleScript = ""
tip = shortcut(tip) tip = shortcut(tip)
if rightside:
class_ = "linkb"
else:
class_ = ""
if not disables: if not disables:
class_ += " perm" class_ += " perm"
return """ <button tabindex=-1 return """ <button tabindex=-1