find icons if cwd is not in the program root
This commit is contained in:
@@ -3,6 +3,8 @@ from typing import Callable
|
||||
from PySide6.QtGui import QAction, QIcon
|
||||
from PySide6.QtWidgets import QMenu, QPushButton, QWidget
|
||||
|
||||
from src.ui.icon import Icon
|
||||
|
||||
|
||||
class RAction():
|
||||
|
||||
@@ -65,9 +67,9 @@ class RAction():
|
||||
def _update_check_state(self):
|
||||
if self._action:
|
||||
if self.checked:
|
||||
self._action.setIcon(QIcon("icons/ionicons/checkbox-outline.svg"))
|
||||
self._action.setIcon(Icon("icons/ionicons/checkbox-outline.svg"))
|
||||
else:
|
||||
self._action.setIcon(QIcon("icons/ionicons/square-outline.svg"))
|
||||
self._action.setIcon(Icon("icons/ionicons/square-outline.svg"))
|
||||
|
||||
def set_label(self, label: str):
|
||||
if self._action:
|
||||
@@ -77,9 +79,9 @@ class RAction():
|
||||
action = QAction(self.label, qmenu)
|
||||
self._action = action
|
||||
if self.icon_from_theme:
|
||||
action.setIcon(QIcon.fromTheme(self.icon_from_theme))
|
||||
action.setIcon(Icon.fromTheme(self.icon_from_theme))
|
||||
if self.icon_file:
|
||||
action.setIcon(QIcon(self.icon_file))
|
||||
action.setIcon(Icon(self.icon_file))
|
||||
if self.shortcut:
|
||||
action.setShortcut(self.shortcut)
|
||||
if self.action:
|
||||
@@ -95,9 +97,9 @@ class RAction():
|
||||
if self.label:
|
||||
button.setText(self.label)
|
||||
if self.icon_from_theme:
|
||||
button.setIcon(QIcon.fromTheme(self.icon_from_theme))
|
||||
button.setIcon(Icon.fromTheme(self.icon_from_theme))
|
||||
if self.icon_file:
|
||||
button.setIcon(QIcon(self.icon_file))
|
||||
button.setIcon(Icon(self.icon_file))
|
||||
if self.shortcut:
|
||||
button.setShortcut(self.shortcut)
|
||||
if self.action:
|
||||
|
||||
Reference in New Issue
Block a user