def testGetIconSvg(self): """ Tests get_icon svg path """ self.assertTrue(GuiUtils.get_icon_svg('providerR.svg')) self.assertIn('providerR.svg', GuiUtils.get_icon_svg('providerR.svg')) self.assertFalse(GuiUtils.get_icon_svg('not_an_icon.svg'))
from qgis.utils import iface, OverrideCursor # from qgis.processing import alg as algfactory from processing.gui.AlgorithmDialog import AlgorithmDialog from processing.script import ScriptUtils from processing_r.processing.utils import RUtils from processing_r.processing.algorithm import RAlgorithm from processing_r.gui.gui_utils import GuiUtils pluginPath = os.path.split(os.path.dirname(__file__))[0] with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) WIDGET, BASE = uic.loadUiType( GuiUtils.get_ui_file_path('DlgScriptEditor.ui')) # This class is ported from the QGIS core Processing script editor. # Unfortunately generalising the core editor to allow everything we want in an R editor # isn't feasible... so lots of duplicate code here :( # Try to keep the diff between the two as small as possible, to allow porting fixes from QGIS core class ScriptEditorDialog(BASE, WIDGET): hasChanged = False def __init__(self, filePath=None, parent=None): super(ScriptEditorDialog, self).__init__(parent) self.setupUi(self)
def svgIconPath(self): """ Returns a path to the provider's icon as a SVG file """ return GuiUtils.get_icon_svg("providerR.svg")
def icon(self): """ Returns the provider's icon """ return GuiUtils.get_icon("providerR.svg")
def testGetIcon(self): """ Tests get_icon """ self.assertFalse(GuiUtils.get_icon('providerR.svg').isNull()) self.assertTrue(GuiUtils.get_icon('not_an_icon.svg').isNull())