Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/action manager qicon import #3

Open
wants to merge 11 commits into
base: 5.0.x_dev
Choose a base branch
from
11 changes: 8 additions & 3 deletions src/pymodaq_gui/managers/action_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@

def create_icon(icon_name: str):
icon = QtGui.QIcon()
if Path(icon_name).is_file():
if Path(icon_name).is_file(): # Test if icon is in path
icon.addPixmap(QtGui.QPixmap(icon_name), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
else:
icon.addPixmap(QtGui.QPixmap(f":/icons/Icon_Library/{icon_name}.png"), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
pixmap = QtGui.QPixmap(f":/icons/Icon_Library/{icon_name}.png") # Test if icon is in pymodaq's library
if pixmap.isNull():
if hasattr(QtGui.QIcon.ThemeIcon,icon_name): # Test if icon is in Qt's library
Ashwolaa marked this conversation as resolved.
Show resolved Hide resolved
icon = QtGui.QIcon.fromTheme(getattr(QtGui.QIcon.ThemeIcon,icon_name))
else:
icon.addPixmap(QtGui.QPixmap(pixmap), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
return icon


Expand Down