Skip to content

Commit

Permalink
fix: make sure pm is created
Browse files Browse the repository at this point in the history
  • Loading branch information
RaghavaAlajangi committed Dec 12, 2024
1 parent 075fc1b commit f021949
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pyjibe/head/custom_widgets/mpl_navigation_toolbar_icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ def _icon(self, name, color=None):
"""Override matplotlibs `_icon` function to get custom icons"""
name = name.replace('.png', '_large.png')
impath = cbook._get_data_path('images', name)
if not os.path.exists(impath):
if os.path.exists(impath):
pm = QtGui.QPixmap(str(impath))
else:
ref = importlib.resources.files("pyjibe.img") / name
with importlib.resources.as_file(ref) as ref_path:
impath = ref_path
pm = QtGui.QPixmap(str(impath))
pm = QtGui.QPixmap(str(ref_path))
pm.setDevicePixelRatio(self.devicePixelRatioF() or 1)
if self.palette().color(self.backgroundRole()).value() < 128:
icon_color = self.palette().color(self.foregroundRole())
Expand Down

0 comments on commit f021949

Please sign in to comment.