1313class OqtopusPlugin :
1414
1515 def __init__ (
16- self , iface , modules_config_path = None , about_dialog_cls = None , settings_plugin_name = None
16+ self ,
17+ iface ,
18+ modules_config_path = None ,
19+ about_dialog_cls = None ,
20+ settings_plugin_name = None ,
21+ icon = None ,
1722 ):
1823 """Constructor.
1924
@@ -30,6 +35,9 @@ def __init__(
3035 :param settings_plugin_name: Optional name for the QGIS settings tree node.
3136 Defaults to ``"oqtopus"``.
3237 :type settings_plugin_name: str | None
38+ :param icon: Optional path to the plugin icon.
39+ Defaults to the bundled ``oqtopus-logo.png``.
40+ :type icon: str | None
3341 """
3442 # Save reference to the QGIS interface
3543 self .iface = iface
@@ -39,6 +47,7 @@ def __init__(
3947 )
4048 self ._about_dialog_cls = about_dialog_cls or AboutDialog
4149 self ._settings_plugin_name = settings_plugin_name
50+ self ._icon = icon or PluginUtils .get_plugin_icon_path ("oqtopus-logo.png" )
4251
4352 self .__version__ = PluginUtils .get_plugin_version ()
4453
@@ -140,7 +149,7 @@ def initGui(self):
140149 Settings (plugin_name = self ._settings_plugin_name )
141150
142151 self .add_action (
143- icon_path = PluginUtils . get_plugin_icon_path ( "oqtopus-logo.png" ) ,
152+ icon_path = self . _icon ,
144153 text = self .tr ("Show &main dialog" ),
145154 callback = self .show_main_dialog ,
146155 parent = self .iface .mainWindow (),
@@ -161,15 +170,15 @@ def initGui(self):
161170 add_to_toolbar = False ,
162171 )
163172 self .add_action (
164- icon_path = PluginUtils . get_plugin_icon_path ( "oqtopus-logo.png" ) ,
173+ icon_path = self . _icon ,
165174 text = self .tr ("&About" ),
166175 callback = self .show_about_dialog ,
167176 parent = self .iface .mainWindow (),
168177 add_to_toolbar = False ,
169178 )
170179
171180 self ._get_main_menu_action ().setIcon (
172- PluginUtils . get_plugin_icon ( "oqtopus-logo.png" ),
181+ QIcon ( self . _icon ),
173182 )
174183
175184 def unload (self ):
0 commit comments