mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
Remove another compiled icon use
This commit is contained in:
parent
c4342425eb
commit
b45f68274c
@ -77,7 +77,7 @@ class DatabaseInfo:
|
||||
|
||||
def toHtml(self):
|
||||
if self.db is None:
|
||||
return HtmlSection(QApplication.translate("DBManagerPlugin", 'Not connected')).toHtml()
|
||||
return HtmlSection(QApplication.translate("DBManagerPlugin", '<warning> Not connected')).toHtml()
|
||||
|
||||
ret = []
|
||||
|
||||
|
@ -72,11 +72,9 @@ class GuiUtils:
|
||||
return path
|
||||
|
||||
@staticmethod
|
||||
def get_icon_as_pixmap(icon: str) -> Optional[QPixmap]:
|
||||
def get_pixmap_path(icon: str) -> Optional[str]:
|
||||
"""
|
||||
Returns a plugin icon's PNG file path
|
||||
:param icon: icon name (png file name)
|
||||
:return: icon png path
|
||||
Returns the path to a pixmap icon
|
||||
"""
|
||||
for suffix in ('.png', '.gif', '.xpm'):
|
||||
path = os.path.join(
|
||||
@ -84,8 +82,21 @@ class GuiUtils:
|
||||
'icons',
|
||||
icon + suffix)
|
||||
if os.path.exists(path):
|
||||
im = QImage(path)
|
||||
return QPixmap.fromImage(im)
|
||||
return path
|
||||
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def get_icon_as_pixmap(icon: str) -> Optional[QPixmap]:
|
||||
"""
|
||||
Returns a plugin icon's PNG file path
|
||||
:param icon: icon name (png file name)
|
||||
:return: icon png path
|
||||
"""
|
||||
path = GuiUtils.get_pixmap_path(icon)
|
||||
if path is not None:
|
||||
im = QImage(path)
|
||||
return QPixmap.fromImage(im)
|
||||
|
||||
return None
|
||||
|
||||
|
@ -24,6 +24,7 @@ from qgis.utils import OverrideCursor
|
||||
|
||||
from .db_plugins.plugin import BaseError, DbError, DBPlugin, Schema, Table
|
||||
from .dlg_db_error import DlgDbError
|
||||
from .gui_utils import GuiUtils
|
||||
|
||||
|
||||
class InfoViewer(QTextBrowser):
|
||||
@ -135,8 +136,9 @@ class InfoViewer(QTextBrowser):
|
||||
return True
|
||||
|
||||
def setHtml(self, html):
|
||||
# convert special tags :)
|
||||
html = str(html).replace('<warning>', '<img src=":/db_manager/warning"> ')
|
||||
# convert special tags
|
||||
warning_icon_path = GuiUtils.get_pixmap_path('warning-20px')
|
||||
html = str(html).replace('<warning>', f'<img src="{warning_icon_path}"> ')
|
||||
|
||||
# add default style
|
||||
html = """
|
||||
|
Loading…
x
Reference in New Issue
Block a user