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:
|
||||
|
||||
@@ -7,7 +7,9 @@ from PySide6.QtCore import Qt
|
||||
from PySide6.QtGui import QFont, QPixmap
|
||||
from PySide6.QtWidgets import *
|
||||
|
||||
from pathlib import Path
|
||||
import constants
|
||||
from src.ui.icon import Icon
|
||||
from src.ui.label import Label
|
||||
from src.ui.vbox import VBox
|
||||
from src.i18n import _
|
||||
@@ -32,7 +34,7 @@ class AboutDialog(QDialog):
|
||||
version.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
||||
|
||||
app_icon = QLabel()
|
||||
app_icon.setPixmap(QPixmap(constants.krow_icon))
|
||||
app_icon.setPixmap(Icon(constants.krow_icon).pixmap(64, 64))
|
||||
heading = QWidget(self)
|
||||
hbox = QHBoxLayout(heading)
|
||||
hbox.addWidget(app_icon)
|
||||
@@ -85,8 +87,4 @@ class AboutDialog(QDialog):
|
||||
return result
|
||||
|
||||
def _version(self):
|
||||
with open('VERSION.info', "rt") as f:
|
||||
line = f.readline()
|
||||
version = line.strip()
|
||||
return version
|
||||
|
||||
return Path(__file__).parent.parent.parent.parent.joinpath('VERSION.info').read_text("utf8").strip()
|
||||
|
||||
@@ -18,6 +18,7 @@ from src.ui.bigtext.logFileModel import LogFileModel
|
||||
from src.i18n import _
|
||||
from src.pluginregistry import PluginRegistry
|
||||
from src.ui.hbox import HBox
|
||||
from src.ui.icon import Icon
|
||||
from src.ui.label import Label
|
||||
from src.zonedpluginregistry import ZonedPluginRegistry
|
||||
|
||||
@@ -151,7 +152,7 @@ class FilterWidget(QWidget):
|
||||
self.btn_cancel_search.pressed.connect(self._cancel_search)
|
||||
self.search_is_running.connect(self.search_running_status_changed)
|
||||
|
||||
self.btn_bookmark = QPushButton(QIcon("icons/ionicons/star.svg"), "")
|
||||
self.btn_bookmark = QPushButton(Icon("icons/ionicons/star.svg"), "")
|
||||
self.btn_bookmark.setToolTip(_("save query"))
|
||||
self.btn_bookmark.pressed.connect(self._save_query)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user