Add support for button icons stored in Qt resource system

This commit is contained in:
Glutanimate 2019-01-26 20:42:56 +01:00
parent fcfb45ccdf
commit 709bfa4a11

View File

@ -145,7 +145,9 @@ class Editor:
def _addButton(self, icon, cmd, tip="", label="", id=None, toggleable=False,
disables=True):
if icon:
if os.path.isabs(icon):
if icon.startswith("qrc:/"):
iconstr = icon
elif os.path.isabs(icon):
iconstr = self.resourceToData(icon)
else:
iconstr = "/_anki/imgs/{}.png".format(icon)