Merge pull request #275 from glutanimate/editor-addbutton-qrc-support

Add support for button icons stored in Qt resource system
This commit is contained in:
Damien Elmes 2019-01-29 08:26:07 +10:00 committed by GitHub
commit c8b5ce1b66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)