İnstall glade

More
23 Aug 2024 15:57 #308473 by Moutomation
Replied by Moutomation on topic İnstall glade
 
 
Attachments:

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

More
23 Aug 2024 16:06 #308474 by Aciera
Replied by Aciera on topic İnstall glade
Terminal output?

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

More
23 Aug 2024 16:12 #308475 by Moutomation
Replied by Moutomation on topic İnstall glade
linuxcnc boots without any warning. I don't know how to get terminal output

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

More
23 Aug 2024 16:14 #308476 by Aciera
Replied by Aciera on topic İnstall glade
Problem is your handler script does not load so start a terminal and type:
linuxcnc -l

note the minus and lowercase letter 'L' should load the last config.

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

More
23 Aug 2024 16:22 #308477 by Moutomation
Replied by Moutomation on topic İnstall glade
I will do this first thing tomorrow morning.

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

More
23 Aug 2024 17:24 - 23 Aug 2024 17:25 #308481 by Aciera
Replied by Aciera on topic İnstall glade
Looking at the screenshot of your ini file it seems that you are loading both panels ('testpanel' and 'testpanel1') to the same location 'ntb_preview', not sure what that does but you may want to load the 'testpanel' to a different location like.
EMBED_TAB_LOCATION = box_cooling
Last edit: 23 Aug 2024 17:25 by Aciera.
The following user(s) said Thank You: Moutomation

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

More
23 Aug 2024 19:42 - 23 Aug 2024 19:44 #308493 by Moutomation
Replied by Moutomation on topic İnstall glade
I will try
I uploaded 4 separate pages to this location and now all 4 separate pages are working without any problems.
The only problem now is that they are not permanent.
 
Last edit: 23 Aug 2024 19:44 by Moutomation.

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

More
24 Aug 2024 04:01 - 24 Aug 2024 04:46 #308514 by Moutomation
Replied by Moutomation on topic İnstall glade
Yesterday, I tried many times and the value was not permanent. I turned off the CNC and went home. Now, when I turned it on, I saw that the value was permanent. And I am trying it now, there is no problem. The difference from yesterday is only the PC was turned off and on. Could this be related to this?

How can I make the second variable permanent on the same page?
Or how can I run a second Python code on the same page?
If I can run a 2nd python code. I will edit the code for the 2nd variable
Last edit: 24 Aug 2024 04:46 by Moutomation.

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

More
24 Aug 2024 04:05 - 24 Aug 2024 06:30 #308515 by Moutomation
Replied by Moutomation on topic İnstall glade
How can I make the buttons I put in Glade so that they become active when I first press them, such as turning the water on and off, and become passive when I press them the second time?

done!
I adjusted it by looking at the features of the water button.
Last edit: 24 Aug 2024 06:30 by Moutomation.

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

More
24 Aug 2024 09:06 #308522 by Aciera
Replied by Aciera on topic İnstall glade
Actually there is a much easier way to do this as GladeVCP has a built in module for saving panel state on shutdown:
www.linuxcnc.org/docs/html/gui/gladevcp....on_gladevcp_shutdown

To try this you need to:
1. Delete 'gladevcp-handler.py' in your 'python' folder (since you seem to have more than one panel it makes more sense to name the handler file like the panel it serves)

2. Save this as 'testpanel-handler.py':
#!/usr/bin/env python3

import hal
from gladevcp.persistence import IniFile,widget_defaults,set_debug,select_widgets

debug = 0

class HandlerClass:

    def on_destroy(self,obj,data=None):
        # note: save_state(<object to fetch attributes from>) only:
        self.ini.save_state(self)

    def __init__(self, halcomp,builder,useropts):
        self.halcomp = halcomp
        self.builder = builder

        self.ini_filename = __name__ + '.ini'
        self.defaults = {  IniFile.vars: dict(),
                           IniFile.widgets : widget_defaults(select_widgets(self.builder.get_objects(), hal_only=False,output_only = True))
                        }
        # note extra self.builder parameter
        self.ini = IniFile(self.ini_filename,self.defaults,self.builder)
        # note - only the object which gets attributes set is passed:
        self.ini.restore_state(self)


def get_handlers(halcomp,builder,useropts):
    global debug
    for cmd in useropts:
        exec(cmd, globals())

    # get some detail what save/restore etc are doing
    set_debug(debug)

    return [HandlerClass(halcomp,builder,useropts)]
 
2. Update the tab command In the [DISPLAY] section of your ini to this:
EMBED_TAB_COMMAND= halcmd loadusr -Wn testpanel gladevcp -c testpanel -u python/testpanel-handler.py -H ./gladevcp/testpanel.hal -x {XID} ./gladevcp/testpanel.ui

3. Open 'testpanel.ui' in glade and select the 'hal_spinbutton1' widget
 a) Remove the handler from 'GtkSpinButton.value-changed' signal (that is the one we added last time):
 

 b) Add 'on_destroy' as handler for the 'GtkWidget.destroy' signal :
 

That should be all.
Note:
- The 'on_destroy' handler only needs to be added to a single widget in the panel, does not matter which one as they all get destroyed when the GUI is closed.
- This will save/restore the state of the whole panel
- The data is stored in a file named 'testpanel-handler.ini'
- If you have more than one custom panel you can copy this handler file for each of them and replace 'testpanel' in the filename and the 'EMBED_TAB_COMMAND' with the name of the panel.
 
Attachments:
The following user(s) said Thank You: Moutomation

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

Moderators: newbynobiHansU
Time to create page: 0.204 seconds
Powered by Kunena Forum