Skip to content

Commit b05e96b

Browse files
committed
fix version
1 parent 8d646f7 commit b05e96b

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

oqtopus/oqtopus_plugin.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,27 @@
1212

1313
class OqtopusPlugin:
1414

15-
def __init__(self, iface):
15+
def __init__(self, iface, modules_config_path=None, about_dialog_cls=None):
1616
"""Constructor.
1717
1818
:param iface: An interface instance that will be passed to this class
1919
which provides the hook by which you can manipulate the QGIS
2020
application at run time.
2121
:type iface: QgsInterface
22+
:param modules_config_path: Optional path to the modules configuration YAML file.
23+
Defaults to ``default_config.yaml`` next to this file.
24+
:type modules_config_path: Path | None
25+
:param about_dialog_cls: Optional custom About dialog class.
26+
Defaults to the bundled ``AboutDialog``.
27+
:type about_dialog_cls: type | None
2228
"""
2329
# Save reference to the QGIS interface
2430
self.iface = iface
2531
self.canvas = iface.mapCanvas()
32+
self._modules_config_path = (
33+
modules_config_path or Path(__file__).parent / "default_config.yaml"
34+
)
35+
self._about_dialog_cls = about_dialog_cls or AboutDialog
2636

2737
self.__version__ = PluginUtils.get_plugin_version()
2838

@@ -176,16 +186,18 @@ def unload(self):
176186
logger.debug(f"Removed {mod} from sys.modules for clean reload")
177187

178188
def show_main_dialog(self):
179-
conf_path = Path(__file__).parent / "default_config.yaml"
180-
181-
main_dialog = MainDialog(modules_config_path=conf_path, parent=self.iface.mainWindow())
189+
main_dialog = MainDialog(
190+
modules_config_path=self._modules_config_path,
191+
about_dialog_cls=self._about_dialog_cls,
192+
parent=self.iface.mainWindow(),
193+
)
182194
main_dialog.exec()
183195

184196
def show_logs_folder(self):
185197
PluginUtils.open_logs_folder()
186198

187199
def show_about_dialog(self):
188-
about_dialog = AboutDialog(self.iface.mainWindow())
200+
about_dialog = self._about_dialog_cls(self.iface.mainWindow())
189201
about_dialog.exec()
190202

191203
def _get_main_menu_action(self):

0 commit comments

Comments
 (0)