Custom Simple Gscreen Skin - Need help linking values

More
24 Apr 2019 14:12 #131768 by adamj12b
Hello Everyone,

I have been working on a custom Gscreen skin for my machine. It is simple and straight forwards and mimics the Haas GUI somewhat.



Even though I have a touchscreen, I wanted as few on screen buttons as possible. I am in process of building a console that will eventually be available to purchase, but right now it is just a project I am working on. Here it is running Gmoccapy with a dark theme.



My machine is a tool room bed mill that I have converted into a VMC. forum.linuxcnc.org/30-cnc-machines/33016...11-bed-mill-retrofit

Anyways, I am having a hard time understanding where the Gscreen skins get their data from. I have looked at the Industrial skin and the Gaxis skins and have borrowed from both, but im stuck trying to connect the other fields.

Things im trying to understand are how to get values for Feed rate, Spindle Speed and Velocity as individual labels instead of all the values in one label. Also, how would the override labels be changed from FO, SO and VO to read Feed:, Spindle: and Velocity:? The label in Glade seems to just set the location of the label and the values come from somewhere. This somewhere is what Im trying to find.

If someone would point me in the direction I should be looking, I would greatly appreciate it.

-Adam
Attachments:
The following user(s) said Thank You: tivoi

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

More
26 Apr 2019 00:05 #131906 by BigJohnT
Have you looked at QtPyVCP?

qtpyvcp.kcjengr.com/

JT

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

More
26 Apr 2019 07:56 - 26 Apr 2019 07:57 #131931 by phillc54
Or QtVCP from the developer of Gscreen

linuxcnc.org/docs/devel/html/gui/qtvcp.html

Cheers, Phill.
Last edit: 26 Apr 2019 07:57 by phillc54.
The following user(s) said Thank You: cmorley

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

More
26 Apr 2019 22:38 - 26 Apr 2019 22:59 #132031 by Grotius
Adam,

Very, very nice machine interface !! Quality !! Was this Haas out of factory or self made together?
I see on the picture that your machine is in progress. ;)

Anyways, I am having a hard time understanding where the Gscreen skins get their data from.

Hmm.... I can tell you that, but if you are new in gui programming, QT is the most powerfull application at the moment.

Mr. Morley is the designer of Gscreen.

Me self has a gui made in about 1 year with the help of gscreen (mr. morley) and the gmocappy (mr. sneider) files.
I had also personal help from both person's trough forum questions. They are masters in coding. Each with a whole different
programming style. They are very good in python programming !

Look at the attachment's, it's a old backup during ethercat gui development. It say's nothing about the linuxcnc file structure.
Therefore, you can look at github : github.com/grotius-cnc/stable

The file structure i can layout for you if you want to know it how it's all connected together.

But i prefer that you start with QT if possible. You can stay with Gscreen and adapt more code like the example below. B)

If you look at the linking process, related to the attachments (you can add the same into your gscreen gui i think) :
import linuxcnc, hal
this is the next item involved (declare / initialisation section):
self.c = linuxcnc.command()
In the program loop you can see :
def on_torch_on_pressed(self, widget, data=None):
    print " torch on "
    #self.c.spindle( 1, self.widgets.power.get_value())
    self.c.spindle( 1, 1 ) 

  def on_torch_off_pressed(self, widget, data=None):
    print " torch off "
    self.c.spindle( 1, 0 )

The advantage of QT is that the glade file and the python file is integrated in the same program environment QT.
The disadvangtage of QT is that it's only free for open source applications. And for how long?
Attachments:
Last edit: 26 Apr 2019 22:59 by Grotius.

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

More
27 Apr 2019 11:22 #132084 by tommylight
Has any one noticed the amount of new videos about QT popping out on youtube ?
Grotius is right, how long till it goes proprietary and we end up with..............<<add comment here !
Personally, i like what can be done with it, i do not like how it does it. It is reminding me of the time the "visual basic" came out, everyone was singing praises about it, i took a loot at how it works and never used it, still hate it. The others hated with a bit of delay ! :)
The following user(s) said Thank You: rodw

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

More
28 Apr 2019 02:04 #132142 by persei8
I am also in the process of building a gscreen ui so maybe I can help. The label widgets from the glade file are periodically updated in the python code. To browse this code, just copy it to a local folder ( sudo cp /bin/gscreen gscreen.py) and open it with a text editor like notepadqq or something. The specific labels you mentioned are in update_feed_speed_label(self). HTH

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

More
28 Apr 2019 15:10 #132179 by cmorley
As persel8 said, the built in skins usually call functions that are builtin to gscreen's main body of code. for instance the call update_feed_speed_label(self) calls code in gscreen.py :
    def update_feed_speed_label(self):
        data = self.data.velocity
        if self.data.IPR_mode:
            try:
                data = data/abs(self.halcomp["spindle-readout-in"])
            except:
                data = 0
        if self.data.dro_units == self.data._MM:
            text = "%.2f"% (data)
        else:
            text = "%.3f"% (data)
        self.widgets.active_feed_speed_label.set_label("F%s    S%s   V%s"% (self.data.active_feed_command,
                            self.data.active_spindle_command,text))
you could copy this code into your handler file, and modify it to suit.
I guess I should add more docs for Gscreen....

Chris M
The following user(s) said Thank You: adamj12b

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

More
28 Apr 2019 18:55 #132189 by persei8
"I guess I should add more docs for Gscreen...."

Yes please. For example, how do I use the user message system? All I want to do is get a yes/no dialog before running a gcode program. I figured out the restart dialog but the yes/no has me stumped. I don't want to replicate all the gscreen code in my handler, but use what is already there. Gscreen creates the HAL pins for a message in the INI file, but how do I instantiate that message from the handler? Is there a way to get it without creating HAL pins?
The following user(s) said Thank You: adamj12b

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

More
29 Apr 2019 06:31 #132245 by cmorley
What version of linuxcnc do you use?
You can manipulate the HAL pins on the handler file. How depends on the linuxcnc version.

Imvsure you can call the popup function directly too...but I would have to check how.

Chris M

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

More
29 Apr 2019 12:17 - 29 Apr 2019 12:25 #132272 by RotarySMP
Really nice inteface module you have built there. Where is the keyboard from?
Mark
Last edit: 29 Apr 2019 12:25 by RotarySMP.

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

Time to create page: 0.125 seconds
Powered by Kunena Forum