Skip to content

Commit

Permalink
MNT: Switch to importing IconFont directly, for use with new icon pro…
Browse files Browse the repository at this point in the history
…perty
  • Loading branch information
nstelter-slac committed Oct 31, 2023
1 parent 042f198 commit 951bd24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pydm/widgets/pushbutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from qtpy.QtWidgets import QPushButton, QMessageBox, QInputDialog, QLineEdit, QStyle
from qtpy.QtCore import Slot, Property
from .base import PyDMWritableWidget
from pydm.utilities import iconfont
from ..utilities import IconFont
import logging

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -112,7 +112,7 @@ def PyDMIcon(self, value: str) -> None:
# We don't know if user is trying to use a standard icon or an icon from "Font Awesome",
# so 1st try to create a Font Awesome one, which hits exception if icon name is not valid.
try:
icon_f = iconfont.IconFont()
icon_f = IconFont()
i = icon_f.icon(value, color=self._pydm_icon_color)
self.setIcon(i)
except Exception:
Expand Down Expand Up @@ -144,7 +144,7 @@ def PyDMIconColor(self, state_color: QColor) -> None:
self._pydm_icon_color = state_color
# apply the new color
try:
icon_f = iconfont.IconFont()
icon_f = IconFont()
i = icon_f.icon(self._pydm_icon_name, color=self._pydm_icon_color)
self.setIcon(i)
except Exception:
Expand Down
5 changes: 2 additions & 3 deletions pydm/widgets/related_display_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ..utilities.stylesheet import merge_widget_stylesheet
from ..display import load_file, ScreenTarget
from typing import Optional, List
from pydm.utilities import iconfont

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -131,7 +130,7 @@ def PyDMIcon(self, value: str) -> None:
# We don't know if user is trying to use a standard icon or an icon from "Font Awesome",
# so 1st try to create a Font Awesome one, which hits exception if icon name is not valid.
try:
icon_f = iconfont.IconFont()
icon_f = IconFont()
i = icon_f.icon(value, color=self._pydm_icon_color)
self.setIcon(i)
except Exception:
Expand Down Expand Up @@ -163,7 +162,7 @@ def PyDMIconColor(self, state_color: QColor) -> None:
self._pydm_icon_color = state_color
# apply the new color
try:
icon_f = iconfont.IconFont()
icon_f = IconFont()
i = icon_f.icon(self._pydm_icon_name, color=self._pydm_icon_color)
self.setIcon(i)
except Exception:
Expand Down
5 changes: 2 additions & 3 deletions pydm/widgets/shell_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from .base import PyDMWidget, only_if_channel_set
from ..utilities import IconFont
from typing import Optional, Union, List
from pydm.utilities import iconfont

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -142,7 +141,7 @@ def PyDMIcon(self, value: str) -> None:
# We don't know if user is trying to use a standard icon or an icon from "Font Awesome",
# so 1st try to create a Font Awesome one, which hits exception if icon name is not valid.
try:
icon_f = iconfont.IconFont()
icon_f = IconFont()
i = icon_f.icon(value, color=self._pydm_icon_color)
self.setIcon(i)
except Exception:
Expand Down Expand Up @@ -174,7 +173,7 @@ def PyDMIconColor(self, state_color: QColor) -> None:
self._pydm_icon_color = state_color
# apply the new color
try:
icon_f = iconfont.IconFont()
icon_f = IconFont()
i = icon_f.icon(self._pydm_icon_name, color=self._pydm_icon_color)
self.setIcon(i)
except Exception:
Expand Down

0 comments on commit 951bd24

Please sign in to comment.