Skip to content

Conversation

@seb5g
Copy link
Contributor

@seb5g seb5g commented Oct 30, 2025

No description provided.

@seb5g seb5g requested a review from rgeneaux October 30, 2025 13:38
@seb5g
Copy link
Contributor Author

seb5g commented Oct 30, 2025

fix PyMoDAQ/PyMoDAQ#188

Copy link
Contributor

@rgeneaux rgeneaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the available PI hardware to test right now but this looks nice, I didn't understand that the self.axis_names and _units were setters for the Parameters, this is practical!

But I could test this on a smaract controller with 4 axes, with the same logic. It works well in a daq_move, but there is a slight issue when launching from a preset because the parametertree doesn't show the correct selected axis once loaded.

I could fix it like that during the ini_stage (my plugin uses dicts instead of lists but it doesn't matter):

axis_parameter = self.settings.child("multiaxes","axis")
current_axis = axis_parameter.value() #If we are loading from a preset, some non-default value might be here
self.axis_names = dict(zip(names, range(self.controller.get_number_of_channels()))) # Set limits of axis parameter

axis_parameter.setValue(current_axis) # Set to preset value
axis_parameter.sigValueChanged.emit(axis_parameter, axis_parameter.value()) # Trigger UI change

Perhaps there is a better way of doing it - using the @axis_name.setter perhaps? also maybe QtWidgets.QApplication.processEvents() instead of triggering manually the sigvaluechanged?

@seb5g
Copy link
Contributor Author

seb5g commented Oct 31, 2025

yes axis_name setter is the way to do it.

However I used this on a three axis PI stage with a preset where all axes where set manually and I got it working ok!
Maybe the problem is because you use dict type axis...

@rgeneaux
Copy link
Contributor

rgeneaux commented Nov 3, 2025

Regarding the PI plugin, I was only able to test that your version works well for single-axis controller (what I have). If nobody else can test it on a multi-axis one let's accept the PR!

@seb5g seb5g merged commit c500586 into main Nov 3, 2025
1 check failed
@seb5g seb5g deleted the patch/axis_at_creation branch November 3, 2025 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants