From adb47b7e422736db08aeb7950b71d20524459347 Mon Sep 17 00:00:00 2001 From: David Bresteau Date: Tue, 16 Dec 2025 14:10:42 +0100 Subject: [PATCH 1/3] Replace first TODO instruction in daq_move_Template by a fake import. The previous instruction was a bit misleading and lead to copy-paste the content of the wrapper file. --- .../daq_move_plugins/daq_move_Template.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py b/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py index 3dafa38..1c5c3b2 100644 --- a/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py +++ b/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py @@ -6,10 +6,8 @@ from pymodaq_utils.utils import ThreadCommand # object used to send info back to the main thread from pymodaq_gui.parameter import Parameter - -class PythonWrapperOfYourInstrument: - # TODO Replace this fake class with the import of the real python wrapper of your instrument - pass +# TODO Replace this fake import with the import of the real python wrapper of your instrument +from pymodaq_plugins_template.hardware.PythonWrapperFileOfYourInstrument import PythonWrapperObjectOfYourInstrument # TODO: # (1) change the name of the following class to DAQ_Move_TheNameOfYourChoice @@ -56,7 +54,7 @@ class DAQ_Move_Template(DAQ_Move_base): def ini_attributes(self): # TODO declare the type of the wrapper (and assign it to self.controller) you're going to use for easy # autocompletion - self.controller: PythonWrapperOfYourInstrument = None + self.controller: PythonWrapperObjectOfYourInstrument = None #TODO declare here attributes you want/need to init with a default value pass @@ -133,7 +131,7 @@ def ini_stage(self, controller=None): """ raise NotImplementedError # TODO when writing your own plugin remove this line and modify the ones below if self.is_master: # is needed when controller is master - self.controller = PythonWrapperOfYourInstrument(arg1, arg2, ...) # arguments for instantiation!) + self.controller = PythonWrapperObjectOfYourInstrument(arg1, arg2, ...) # arguments for instantiation!) initialized = self.controller.a_method_or_atttribute_to_check_if_init() # todo # todo: enter here whatever is needed for your controller initialization and eventual # opening of the communication channel From db62c007c386aed6863a293febfcf4fefe721eaa Mon Sep 17 00:00:00 2001 From: David Bresteau Date: Tue, 16 Dec 2025 14:15:18 +0100 Subject: [PATCH 2/3] Replace first TODO instruction in all the daq_viewers. --- .../plugins_0D/daq_0Dviewer_Template.py | 9 ++++----- .../plugins_1D/daq_1Dviewer_Template.py | 10 ++++------ .../plugins_2D/daq_2Dviewer_Template.py | 10 +++++----- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py index f75a38c..ec4894f 100644 --- a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py +++ b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py @@ -7,9 +7,8 @@ from pymodaq.control_modules.viewer_utility_classes import DAQ_Viewer_base, comon_parameters, main from pymodaq.utils.data import DataFromPlugins -class PythonWrapperOfYourInstrument: - # TODO Replace this fake class with the import of the real python wrapper of your instrument - pass +# TODO Replace this fake import with the import of the real python wrapper of your instrument +from pymodaq_plugins_template.hardware.PythonWrapperFileOfYourInstrument import PythonWrapperObjectOfYourInstrument # TODO: # (1) change the name of the following class to DAQ_0DViewer_TheNameOfYourChoice @@ -47,7 +46,7 @@ class DAQ_0DViewer_Template(DAQ_Viewer_base): def ini_attributes(self): # TODO declare the type of the wrapper (and assign it to self.controller) you're going to use for easy # autocompletion - self.controller: PythonWrapperOfYourInstrument = None + self.controller: PythonWrapperObjectOfYourInstrument = None #TODO declare here attributes you want/need to init with a default value pass @@ -84,7 +83,7 @@ def ini_detector(self, controller=None): raise NotImplementedError # TODO when writing your own plugin remove this line and modify the one below if self.is_master: - self.controller = PythonWrapperOfYourInstrument() #instantiate you driver with whatever arguments are needed + self.controller = PythonWrapperObjectOfYourInstrument() #instantiate you driver with whatever arguments are needed self.controller.open_communication() # call eventual methods initialized = self.controller.a_method_or_atttribute_to_check_if_init() # TODO else: diff --git a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py index 34b7a6c..8d75dfc 100644 --- a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py +++ b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py @@ -7,10 +7,8 @@ from pymodaq.control_modules.viewer_utility_classes import DAQ_Viewer_base, comon_parameters, main from pymodaq.utils.data import DataFromPlugins - -class PythonWrapperOfYourInstrument: - # TODO Replace this fake class with the import of the real python wrapper of your instrument - pass +# TODO Replace this fake import with the import of the real python wrapper of your instrument +from pymodaq_plugins_template.hardware.PythonWrapperFileOfYourInstrument import PythonWrapperObjectOfYourInstrument # TODO: # (1) change the name of the following class to DAQ_1DViewer_TheNameOfYourChoice @@ -51,7 +49,7 @@ class DAQ_1DViewer_Template(DAQ_Viewer_base): def ini_attributes(self): # TODO declare the type of the wrapper (and assign it to self.controller) you're going to use for easy # autocompletion - self.controller: PythonWrapperOfYourInstrument = None + self.controller: PythonWrapperObjectOfYourInstrument = None # TODO declare here attributes you want/need to init with a default value @@ -89,7 +87,7 @@ def ini_detector(self, controller=None): raise NotImplementedError # TODO when writing your own plugin remove this line and modify the one below if self.is_master: - self.controller = PythonWrapperOfYourInstrument() #instantiate you driver with whatever arguments are needed + self.controller = PythonWrapperObjectOfYourInstrument() #instantiate you driver with whatever arguments are needed self.controller.open_communication() # call eventual methods initialized = self.controller.a_method_or_atttribute_to_check_if_init() # TODO else: diff --git a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py index 80419b0..300f4e1 100644 --- a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py +++ b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py @@ -6,9 +6,9 @@ from pymodaq.control_modules.viewer_utility_classes import DAQ_Viewer_base, comon_parameters, main from pymodaq.utils.data import DataFromPlugins -class PythonWrapperOfYourInstrument: - # TODO Replace this fake class with the import of the real python wrapper of your instrument - pass + +# TODO Replace this fake import with the import of the real python wrapper of your instrument +from pymodaq_plugins_template.hardware.PythonWrapperFileOfYourInstrument import PythonWrapperObjectOfYourInstrument # TODO: # (1) change the name of the following class to DAQ_2DViewer_TheNameOfYourChoice @@ -47,7 +47,7 @@ class DAQ_2DViewer_Template(DAQ_Viewer_base): def ini_attributes(self): # TODO declare the type of the wrapper (and assign it to self.controller) you're going to use for easy # autocompletion - self.controller: PythonWrapperOfYourInstrument = None + self.controller: PythonWrapperObjectOfYourInstrument = None # TODO declare here attributes you want/need to init with a default value @@ -84,7 +84,7 @@ def ini_detector(self, controller=None): """ raise NotImplementedError # TODO when writing your own plugin remove this line and modify the one below if self.is_master: - self.controller = PythonWrapperOfYourInstrument() #instantiate you driver with whatever arguments are needed + self.controller = PythonWrapperObjectOfYourInstrument() #instantiate you driver with whatever arguments are needed self.controller.open_communication() # call eventual methods initialized = self.controller.a_method_or_atttribute_to_check_if_init() # TODO else: From ecade7760da432bd0514810181dab32c13e49961 Mon Sep 17 00:00:00 2001 From: David Bresteau Date: Tue, 16 Dec 2025 17:36:35 +0100 Subject: [PATCH 3/3] Import wrapper TODO: * consider the possibility of import from an external librairy like Pylablib or PyMeasure. * use lower case for wrapper file name --- .../daq_move_plugins/daq_move_Template.py | 8 ++++++-- .../plugins_0D/daq_0Dviewer_Template.py | 7 +++++-- .../plugins_1D/daq_1Dviewer_Template.py | 6 ++++-- .../plugins_2D/daq_2Dviewer_Template.py | 8 ++++++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py b/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py index 1c5c3b2..09774a7 100644 --- a/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py +++ b/src/pymodaq_plugins_template/daq_move_plugins/daq_move_Template.py @@ -6,8 +6,10 @@ from pymodaq_utils.utils import ThreadCommand # object used to send info back to the main thread from pymodaq_gui.parameter import Parameter -# TODO Replace this fake import with the import of the real python wrapper of your instrument -from pymodaq_plugins_template.hardware.PythonWrapperFileOfYourInstrument import PythonWrapperObjectOfYourInstrument +# TODO: +# Replace the following fake import with the import of the real Python wrapper of your instrument. Here we suppose that +# the wrapper is in the hardware directory, but it could come from an external librairy like pylablib or pymeasure. +from pymodaq_plugins_template.hardware.python_wrapper_file_of_your_instrument import PythonWrapperObjectOfYourInstrument # TODO: # (1) change the name of the following class to DAQ_Move_TheNameOfYourChoice @@ -15,6 +17,8 @@ # for the class name and the file name.) # (3) this file should then be put into the right folder, namely IN THE FOLDER OF THE PLUGIN YOU ARE DEVELOPING: # pymodaq_plugins_my_plugin/daq_move_plugins + + class DAQ_Move_Template(DAQ_Move_base): """ Instrument plugin class for an actuator. diff --git a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py index ec4894f..91a9122 100644 --- a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py +++ b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_0D/daq_0Dviewer_Template.py @@ -7,8 +7,10 @@ from pymodaq.control_modules.viewer_utility_classes import DAQ_Viewer_base, comon_parameters, main from pymodaq.utils.data import DataFromPlugins -# TODO Replace this fake import with the import of the real python wrapper of your instrument -from pymodaq_plugins_template.hardware.PythonWrapperFileOfYourInstrument import PythonWrapperObjectOfYourInstrument +# TODO: +# Replace the following fake import with the import of the real Python wrapper of your instrument. Here we suppose that +# the wrapper is in the hardware directory, but it could come from an external librairy like pylablib or pymeasure. +from pymodaq_plugins_template.hardware.python_wrapper_file_of_your_instrument import PythonWrapperObjectOfYourInstrument # TODO: # (1) change the name of the following class to DAQ_0DViewer_TheNameOfYourChoice @@ -17,6 +19,7 @@ # (3) this file should then be put into the right folder, namely IN THE FOLDER OF THE PLUGIN YOU ARE DEVELOPING: # pymodaq_plugins_my_plugin/daq_viewer_plugins/plugins_0D + class DAQ_0DViewer_Template(DAQ_Viewer_base): """ Instrument plugin class for a OD viewer. diff --git a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py index 8d75dfc..0a36fb6 100644 --- a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py +++ b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_1D/daq_1Dviewer_Template.py @@ -7,8 +7,10 @@ from pymodaq.control_modules.viewer_utility_classes import DAQ_Viewer_base, comon_parameters, main from pymodaq.utils.data import DataFromPlugins -# TODO Replace this fake import with the import of the real python wrapper of your instrument -from pymodaq_plugins_template.hardware.PythonWrapperFileOfYourInstrument import PythonWrapperObjectOfYourInstrument +# TODO: +# Replace the following fake import with the import of the real Python wrapper of your instrument. Here we suppose that +# the wrapper is in the hardware directory, but it could come from an external librairy like pylablib or pymeasure. +from pymodaq_plugins_template.hardware.python_wrapper_file_of_your_instrument import PythonWrapperObjectOfYourInstrument # TODO: # (1) change the name of the following class to DAQ_1DViewer_TheNameOfYourChoice diff --git a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py index 300f4e1..af7e7ee 100644 --- a/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py +++ b/src/pymodaq_plugins_template/daq_viewer_plugins/plugins_2D/daq_2Dviewer_Template.py @@ -7,8 +7,10 @@ from pymodaq.control_modules.viewer_utility_classes import DAQ_Viewer_base, comon_parameters, main from pymodaq.utils.data import DataFromPlugins -# TODO Replace this fake import with the import of the real python wrapper of your instrument -from pymodaq_plugins_template.hardware.PythonWrapperFileOfYourInstrument import PythonWrapperObjectOfYourInstrument +# TODO: +# Replace the following fake import with the import of the real Python wrapper of your instrument. Here we suppose that +# the wrapper is in the hardware directory, but it could come from an external librairy like pylablib or pymeasure. +from pymodaq_plugins_template.hardware.python_wrapper_file_of_your_instrument import PythonWrapperObjectOfYourInstrument # TODO: # (1) change the name of the following class to DAQ_2DViewer_TheNameOfYourChoice @@ -16,6 +18,8 @@ # for the class name and the file name.) # (3) this file should then be put into the right folder, namely IN THE FOLDER OF THE PLUGIN YOU ARE DEVELOPING: # pymodaq_plugins_my_plugin/daq_viewer_plugins/plugins_2D + + class DAQ_2DViewer_Template(DAQ_Viewer_base): """ Instrument plugin class for a 2D viewer.