How to get values from retain memory and ini file?

More
5 years 8 months ago #200039 by aleksamc
I wan't to get from ini file value of maximum speed for setting jog speed . As in the basic tutorial .

Also QHSpinbox I would like to save last value to some file that in next turn on, it will load values from that file.

Does it's possible to do this?

Please Log in to join the conversation.

More
5 years 7 months ago #202083 by HansU
For saving persistent values have a look at github.com/LinuxCNC/linuxcnc/blob/b8ce6c.../persistence.py#L122

And for reading the INI file could this be useful I think: github.com/LinuxCNC/linuxcnc/blob/b8ce6c...y/getiniinfo.py#L242

In forum.linuxcnc.org/gmoccapy/40709-gmocap...lock?start=30#201950 you find an example how to use this.

Please Log in to join the conversation.

More
5 years 7 months ago #202128 by aleksamc
Thanks Hansu for your answer. Please give me more information where I can connect this python code? I've never used gmoccapy.

Please Log in to join the conversation.

More
5 years 7 months ago #202132 by HansU
It is not only for gmoccapy. What GUI do you use?

Hans

Please Log in to join the conversation.

More
5 years 7 months ago #202133 by aleksamc
I use QtPyVCP, there is main file .py where I add functions for buttons.

Please Log in to join the conversation.

More
5 years 7 months ago #202199 by HansU

aleksamc wrote: I use QtPyVCP, there is main file .py where I add functions for buttons.


Ok what stupid question of me as your post is in the QtPyVCP sub forum :silly:

So you just have to import the libs like
Code:
from gladevcp.persistence import IniFile # we use this one to save the states of the widgets on shut down and restart
and create a IniFile object and so on...

Please Log in to join the conversation.

More
5 years 7 months ago #202224 by aleksamc
Ok, thanks, I will try.
I'm not so good in python but I will try.

Please Log in to join the conversation.

More
5 years 5 months ago #208738 by aleksamc
I copied to directory with main file.py
persistance.py and getiniinfo.py.

in main file i added
Code:
import persistance.py import getiniinfo.py

And also line
Code:
from gladevcp.persistence import IniFile
But I really doesn't understand from what directory file is imported.

and visualisation doesn't load.

Attachment not found


But really I don't know logic of execution of QtPyVCP, I write to this file functions that should be executable when buttons pressed,

Please Log in to join the conversation.

More
4 years 9 months ago #231991 by HansU
Basically you have to do something like this
Code:
import linuxcnc inifile = linuxcnc.ini("name amd path of ini file") max_jog_vel = inifile.find("TRAJ","MAX_LINEAR_VELOCITY")

Please Log in to join the conversation.

Time to create page: 0.101 seconds
Powered by Kunena Forum