Skip to content

Commit 9c718f3

Browse files
Merge pull request #889 from annie-xd-wang/fix-loading-plugin-error
pass hardware_configuration to plugin load_device function
2 parents e95cf2c + f8c9bc8 commit 9c718f3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

docs/source/plugin/plugin_home.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ A function to load the device connection should be given,
172172

173173
.. code-block:: python
174174
175-
def load_device(configuration, is_synthetic=False):
175+
def load_device(hardware_configuration, is_synthetic=False):
176176
# ...
177177
return device_connection
178178

src/navigate/model/microscope.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,14 @@ def __init__(
194194
device_plugin_dict = devices_dict.get(device_name, {})
195195
try:
196196
exec(
197-
f"device_plugin_dict['{device_ref_name}'] = devices_dict['__plugins__']['{device_name}']['load_device'](self.microscope_name, configuration, is_synthetic)"
197+
f"device_plugin_dict['{device_ref_name}'] = devices_dict['__plugins__']['{device_name}']['load_device']"
198+
f"(configuration['configuration']['microscopes'][self.microscope_name]['{device_name}']['hardware'], is_synthetic)"
198199
)
199200
devices_dict[device_name] = device_plugin_dict
200201
device_connection = device_plugin_dict[device_ref_name]
201202
exec(
202-
f"self.plugin_devices['{device_name}'] = devices_dict['__plugins__']['{device_name}']['start_device'](self.microscope_name, device_connection, configuration, is_synthetic)"
203+
f"self.plugin_devices['{device_name}'] = devices_dict['__plugins__']['{device_name}']['start_device']"
204+
f"(self.microscope_name, device_connection, configuration, is_synthetic)"
203205
)
204206
except RuntimeError:
205207
print(

0 commit comments

Comments
 (0)