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