Gscreen - a GTK / Glade / Python based screen

More
03 Dec 2017 11:26 #102614 by cmorley
Gscreen uses sourceview 2 looks like there is a sourceview 3 which probably gedit on the system uses.
(sourceview is the underlying library that both use)

You can change the syntax customizer. You just have to do it more manually.
If this is an installed version the folder should be /usr/share/gtksourceview-2.0/language-specs
an RIP version RIP_LINUXCNC_FOLDER/ share/gtksourceview-2.0/language-specs
gscreen uses the 'ngc.lang' description ( I have ngc.lang and gcode.lang on my RIP)
You could rename the gcode.lang to ngc.lang if you wanted gscreen to use it.

I can't say if they will look exactly the same as sourceview3 gedit but it should.
See if that helps.

Chris M

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

More
04 Dec 2017 11:20 #102655 by Big_Mas74
Hi Chris,
Apparently there is a deference between gtksourceview2.0 and gtksourceview3.0 because if rename the gcode.lang file to ngc.lang there is no customization while reusing the old one from RIP version still gives me the older result.
I've to look further into it.
Thanks

Masoun

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

More
04 Dec 2017 19:27 #102677 by cmorley
Strange. I doubt anyone made a lang specifically for sourcview3 (and i would expect them to work the same anyways)
The python file is in lib/python/gladevcp/hal_sourceview

There is a function to set it directly from the handler file:
from hal_sourceview:
    def set_language(self, lang, path = None):
        # path = the search path for the langauage file
        # if none, set to default
        # lang = the lang file to set
        if path == None:
            if 'EMC2_HOME' in os.environ:
                path = os.path.join(os.environ['EMC2_HOME'], 'share/gtksourceview-2.0/language-specs/')
        if path:
            self.lm.set_search_path(path)
        self.buf.set_language(self.lm.get_language(lang))

Chris M

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

More
10 Dec 2018 17:57 #122149 by sqmathlete
Hi,

Well, here's another kick at the cat for a custom gscreen skin. It's pretty similar to gaxis, meant specifically for a CNC Lathe that has a Hydraulic
  • 10 station turret
  • programable tailstock
  • 3 speed gearbox

and will have the following physical buttons
  • program start/pause
  • MPG
  • Joystick
  • tailstock/tailseeve fwd/rev

using a rip 2.8 wheezy, glade 3.8.0

I am trying to use the KISS method, i.e. use glade auto connect signal handling and vcp widgets/actions wherever possible.
At this point my most pressing issue's are (not in order)

1) I want to embed Ngcgui, (and potientally NativeCAM if it can be done) I don't get any errors when it starts up but I can't see the tab,
2) pyNCG and gremlin plus crash glade everytime
3) **** setting up gscreen to jog with MPG or Joystick
4) setting/updating labels and having them react to hal pin changes for CSS and RPM

Threre are still many other issues but I don't want to get too far ahead of myself. Any help would be apreciated,
Dan


Attachments:

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

More
10 Dec 2018 18:34 #122154 by cmorley
Welcome!

It's been awhile since working on gscreen, but i'll try not to lie...:)

1) I assume you mean embedded in a tab - AFAIK both can be embedded.
There is a sample config that works for me in configs/sim/gscreen/ngcgui - does it work for you?

2) I tried gremlim_plus and pyngc in GLADE - it didn't crash the editor for me - but the editor is known buddy - usually glade 3.8.6 is better but harder to get.

3)Jogging buttons are done in HAL, rate, increment and enable/selection are done in the gui.

4) hal_labels can change text via HAL pins in a limited way - the number follows the pin but the text is always the same as you set it in GLADE.
hal_lightbutton can be controlled from a hal pin and text can toggle between two selections.
But for more complicated visuals, you'll need to write some python code in the handler_file.

If you post your config files it will help with specifics
.I'm happy to see you try your hand at screen building !

Chris M

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

More
10 Dec 2018 22:51 #122172 by andypugh
There is a resizable version of the lathe macros screen based on an SVG. That might look better.
It is a bit kludgey in that the entry boxes are in a large but sparsely populated table overlaid in the image.

It would probably be possible to make the entry boxes part of the SVG, and also have them support clicks etc: www.svgopen.org/2010/presentations/47-Mi...ser_Input/index.html

Whether that is worth the trouble, or whether it is a terrible idea, I am not sure.

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

More
11 Dec 2018 01:04 #122179 by cmorley
I just pushed two new widgets to gladevcp.
Status_label can display:
0:user system
1:loaded file path
2:feed override
3:rapid override
4:spindle override
Status label has a text template that can be used to modify the displayed text.
eg if displaying user system you might use:
User System G%s
or for override:
Feed Override %d


State label can display:
0:metric mode
1:Diameter mode
2:CSS Mode

It has two properties false_text and true_text that can hold two text strings that will be displayed depending on the state.

Of course normal label properties can be changes to0 such as color or size.

You'll have to pull in the new changes I just pushed them.
See if that helps you out.

Chris M

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

More
12 Dec 2018 07:21 #122247 by sqmathlete
Wow! Thanks for the quick responses.

There is a sample config that works for me in configs/sim/gscreen/ngcgui - does it work for you?

Yes, I've got the ngcgui tab going now


3.8.6 is better but harder to get.

I followed this,
forum.linuxcnc.org/48-gladevcp/33309-gla...ollow-this-for-3-8-6,
worked perfect!


I just pushed two new widgets to gladevcp.

Awesome, Ill add them to the screen to test them out. Sound like they are exactly what I need.


@andypugh

That might look better.

Agreed!

It's going to take me a few days to amalgamate all of this into what I call lathezy. Ill post my files once I have them reorganized, cleaned up a bit and have as much done as possible...probably need to figure out how tar files for that though. lol.

Thanks again,
Dan

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

More
12 Dec 2018 11:30 #122260 by cmorley
Yes let me know about how the new widgets work out - there is more that should be added to them but i was a bit lazy...

The interface to select the options (selecting a digit) does not make me happy but it was quick and easy.
I could also add a spindle rpm status option to it - i think you wanted that. - It's nice because then you don't need to connect a HAL pin for it to work in the screen.

Chris M

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

More
18 Dec 2018 17:15 - 18 Dec 2018 17:16 #122578 by sqmathlete
Hi Chris,

I had to do a bit of messing around to get my version of glade to update with the new label widgets but, I have it working now. Thanks :)
Also, NativeCAM is embedded in a tab, and I have managed to figure out a few leds as you can see. However, I am a little unclear about how to access the status, command, and error channel if the info that I want access to is not in gscreens data class. For example the joint dictionary or how to tell if the interpreter is idle before one of my buttons does something? As well as how to update everything when the screen starts up and the operator hasn't pushed a button or anything.



I have posted my files, the commenting is pretty verbose, feel free to add to it. You might need to comment out the embed pyngcgui and cycles tabs in the ini.file since I have all of the ngc files in my config folder. I started with the sim-fanucy lathe config since it already had a remapped tool change that was the same as the original fanuc controller. T202, calls tool 2, applies offset 2, and applies wear offset 100002. T2 calls tool2 , and applies offset 2. Will probably have to make a few changes in the .ngc files to accommodate that behavior. Will deal with that later though.

Thanks in advance,
Dan
Last edit: 18 Dec 2018 17:16 by sqmathlete. Reason: too many file attachmnets

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

Time to create page: 0.209 seconds
Powered by Kunena Forum