How to get values from retain memory and ini file?

More
24 Feb 2021 21:39 #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 or Create an account to join the conversation.

More
13 Mar 2021 11:07 #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.
The following user(s) said Thank You: aleksamc

Please Log in or Create an account to join the conversation.

More
13 Mar 2021 19:11 #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 or Create an account to join the conversation.

More
13 Mar 2021 19:25 - 14 Mar 2021 09:06 #202132 by HansU
It is not only for gmoccapy. What GUI do you use?

Hans
Last edit: 14 Mar 2021 09:06 by HansU.

Please Log in or Create an account to join the conversation.

More
13 Mar 2021 19:29 #202133 by aleksamc
I use QtPyVCP, there is main file .py where I add functions for buttons.

Please Log in or Create an account to join the conversation.

More
14 Mar 2021 09:09 - 14 Mar 2021 21:00 #202199 by HansU

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
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...
Last edit: 14 Mar 2021 21:00 by HansU.

Please Log in or Create an account to join the conversation.

More
14 Mar 2021 16:14 #202224 by aleksamc
Ok, thanks, I will try.
I'm not so good in python but I will try.

Please Log in or Create an account to join the conversation.

More
13 May 2021 15:35 - 13 May 2021 15:58 #208738 by aleksamc
I copied to directory with main file.py
persistance.py and getiniinfo.py.

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

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

and visualisation doesn't load.

File Attachment:

File Name: mainwindow.py
File Size:4 KB

But really I don't know logic of execution of QtPyVCP, I write to this file functions that should be executable when buttons pressed,
Attachments:
Last edit: 13 May 2021 15:58 by aleksamc.

Please Log in or Create an account to join the conversation.

More
16 Jan 2022 08:45 #231991 by HansU
Basically you have to do something like this
import linuxcnc
inifile = linuxcnc.ini("name amd path of ini file")
max_jog_vel = inifile.find("TRAJ","MAX_LINEAR_VELOCITY")

Please Log in or Create an account to join the conversation.

Moderators: KCJLcvette
Time to create page: 0.175 seconds
Powered by Kunena Forum