- Posts: 566
- Thank you received: 0
How to get values from retain memory and ini file?
5 years 8 months ago #200039
by aleksamc
How to get values from retain memory and ini file? was created 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?
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.
5 years 7 months ago #202083
by HansU
Replied by HansU on topic How to get values from retain memory and ini file?
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.
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.
5 years 7 months ago #202128
by aleksamc
Replied by aleksamc on topic How to get values from retain memory and ini file?
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.
5 years 7 months ago #202132
by HansU
Replied by HansU on topic How to get values from retain memory and ini file?
It is not only for gmoccapy. What GUI do you use?
Hans
Hans
Please Log in to join the conversation.
5 years 7 months ago #202133
by aleksamc
Replied by aleksamc on topic How to get values from retain memory and ini file?
I use QtPyVCP, there is main file .py where I add functions for buttons.
Please Log in to join the conversation.
5 years 7 months ago #202199
by HansU
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
and create a IniFile object and so on...
Replied by HansU on topic How to get values from retain memory and ini file?
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
Please Log in to join the conversation.
5 years 7 months ago #202224
by aleksamc
Replied by aleksamc on topic How to get values from retain memory and ini file?
Ok, thanks, I will try.
I'm not so good in python but I will try.
I'm not so good in python but I will try.
Please Log in to join the conversation.
5 years 5 months ago #208738
by aleksamc
Replied by aleksamc on topic How to get values from retain memory and ini file?
I copied to directory with main file.py
persistance.py and getiniinfo.py.
in main file i added
And also line
But I really doesn't understand from what directory file is imported.
and visualisation doesn't load.
But really I don't know logic of execution of QtPyVCP, I write to this file functions that should be executable when buttons pressed,
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
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.
4 years 9 months ago #231991
by HansU
Replied by HansU on topic How to get values from retain memory and ini file?
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
