JasonGilholme / iconify

An icon and image library for Qt that lets you use svg's from popular icon packs like FontAwesome, Material Design etc
GNU General Public License v3.0
12 stars 5 forks source link

iconify does not work with the PyQT5 #2

Open alexfdo opened 4 years ago

alexfdo commented 4 years ago

Working code:

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
import iconify as ico

class Window(QtWidgets.QWidget):
    def __init__(self, parent=None):
        super().__init__()
        layout = QtWidgets.QVBoxLayout(self)
        button = QtWidgets.QPushButton('OK')
        # icon = ico.Icon('delete', color=QtGui.QColor('blue'))
        # button.setIcon(icon)
        button.setIcon(QtGui.QIcon("resources/icons/eye.svg"))      # 1
        layout.addWidget(button)

if __name__ == "__main__":
    app = QtWidgets.QApplication([])
    w = Window()
    w.show()
    sys.exit(app.exec_())

But if I uncomment the two lines instead of the line with comment 1, I immediately get the following error: TypeError: setIcon(self, QIcon): argument 1 has unexpected type 'PySide2.QtGui.QIcon'

I really liked the program, its ability to work with SVG directly and suddenly such OPS !!! What am I doing wrong?

alexfdo commented 4 years ago

When I add this code:

import os
os.environ["ICONIFY_QTLIB"] = "PyQt5"

and uncomment the lines, I get the following error: File "/home/alex/anaconda3/envs/lastrium/lib/python3.6/site-packages/iconify/anim.py", line 16, in GlobalTick timeout = QtCore.Signal() AttributeError: module 'PyQt5.QtCore' has no attribute 'Signal'

alexfdo commented 4 years ago

Greetings. In principle, I ported the program to the PyQt5 and it practically works, but with some exceptions: I could not correctly translate line 336 from the core.py module to the terms PyQt5, in which the method setAlphaChannel was not implemented. If we could solve this problem, the program will be able to work correctly with the PyQt5 API.

hyuuki commented 4 years ago

Stumbled upon with this cool module, unfortunately currently its only working fine with PySide2, not PyQt5. Also trying to port to PyQt5, but still some error occurs. Hope the author also investigate this bug.

intact commented 4 years ago

You can try #3