44from qgis .PyQt .QtGui import QIcon
55from qgis .PyQt .QtWidgets import QAction , QApplication
66
7- from .core .settings import PLUGIN_NAME , Settings
7+ from .core .settings import Settings
88from .gui .about_dialog import AboutDialog
99from .gui .main_dialog import MainDialog
1010from .utils .plugin_utils import PluginUtils , logger
1111
1212
1313class OqtopusPlugin :
1414
15- def __init__ (self , iface , modules_config_path = None , about_dialog_cls = None ):
15+ def __init__ (
16+ self , iface , modules_config_path = None , about_dialog_cls = None , settings_plugin_name = None
17+ ):
1618 """Constructor.
1719
1820 :param iface: An interface instance that will be passed to this class
@@ -25,6 +27,9 @@ def __init__(self, iface, modules_config_path=None, about_dialog_cls=None):
2527 :param about_dialog_cls: Optional custom About dialog class.
2628 Defaults to the bundled ``AboutDialog``.
2729 :type about_dialog_cls: type | None
30+ :param settings_plugin_name: Optional name for the QGIS settings tree node.
31+ Defaults to ``"oqtopus"``.
32+ :type settings_plugin_name: str | None
2833 """
2934 # Save reference to the QGIS interface
3035 self .iface = iface
@@ -33,6 +38,7 @@ def __init__(self, iface, modules_config_path=None, about_dialog_cls=None):
3338 modules_config_path or Path (__file__ ).parent / "default_config.yaml"
3439 )
3540 self ._about_dialog_cls = about_dialog_cls or AboutDialog
41+ self ._settings_plugin_name = settings_plugin_name
3642
3743 self .__version__ = PluginUtils .get_plugin_version ()
3844
@@ -131,7 +137,7 @@ def add_action(
131137 def initGui (self ):
132138 """Create the menu entries and toolbar icons inside the QGIS GUI."""
133139 # Register settings tree node early
134- Settings ()
140+ Settings (plugin_name = self . _settings_plugin_name )
135141
136142 self .add_action (
137143 icon_path = PluginUtils .get_plugin_icon_path ("oqtopus-logo.png" ),
@@ -173,7 +179,7 @@ def unload(self):
173179 self .iface .removeToolBarIcon (action )
174180
175181 # Unregister the plugin settings tree node
176- QgsSettingsTree .unregisterPluginTreeNode (PLUGIN_NAME )
182+ QgsSettingsTree .unregisterPluginTreeNode (Settings . _plugin_name )
177183 Settings .instance = None
178184
179185 # Remove pum modules from sys.modules to allow proper reloading
0 commit comments