Creating a GUI

More
06 Aug 2012 14:29 #22910 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
This is fantastic stuff.

Cradek also added that from python

import linuxcnc
x = linuxcnc.stat()
x.poll()
dir(x)

and that popped up a list of all the things in stat too. Then I could print type(x.dtg) and see what type it is and guess how to handle it...

Thanks so much for the help.

I can all ready see that I need to redesign my screen some but it sure is fun when it works...

Also I sorted out what gobject.timeout_add was all about with some help from mhaberler so that is cool too how that works.

John

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

More
06 Aug 2012 16:13 #22914 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
Just wanted to let you know that I got the DRO to update using linuxcnc.stat()!

Taking notes now like a mad man...

Thanks
John

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

More
06 Aug 2012 16:30 #22915 by cmorley
Replied by cmorley on topic Re:Creating a GUI
oh great John!

a few things to remember:
you probably want to be able to switch from relative to absolute. (how about commanded vrs actual)
not sure if you use metric and imperial but that needs some careful conversions especially if you plan to be able to set the origin from your DRO.
Though setting the origin to zero is safe and easy and maybe enough.

Glad your having fun - and can't wait to see your tutorial on it.
Chris

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

More
07 Aug 2012 16:32 #22952 by mhaberler
Replied by mhaberler on topic Re:Creating a GUI
I've written up some documentation for the linuxcnc Python module.

www.linuxcnc.org/docs/2.5/html/common/python-interface.html

this is 'raw hide' - suggestions & improvements welcome.

- Michael

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

More
07 Aug 2012 20:35 #22958 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
That was is a huge part of the puzzle when writing your own GUI's thanks for that mhaberler.

John

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

More
08 Aug 2012 03:48 #22963 by cmorley
Replied by cmorley on topic Re:Creating a GUI
hey John I looked at your tutorial..

couple things I noticed maybe you already know...
in 3b the python code...
This is not needed:

# language stuff I think
import gettext
LOCALEDIR = os.path.join(BASE, "share", "locale")
gettext.install("linuxcnc", localedir=LOCALEDIR, unicode=True)
gtk.glade.bindtextdomain("linuxcnc", LOCALEDIR)
gtk.glade.textdomain("linuxcnc")
TCLPATH = os.environ

Also when putting the new screen in /bin you don't need to remove the .py part.
DISPLAY=gui3.py
will work.
The reason I mention this is if someone is testing it is nice if the editor knows the file is python.

great work though! is your plan to add it to the official docs ?

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

More
08 Aug 2012 03:56 #22964 by cmorley
Replied by cmorley on topic Re:Creating a GUI
Michael

That is great documentation too!
It's very good to see documentation on some of the inner workings of linuxcnc - lowers the barrier for new developers.
(you actually make a habit of good documentation!)

have any idea how SPINDLE_CONSTANT works? I assume it means constant surface speed...

Chris M

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

More
08 Aug 2012 08:48 #22970 by mhaberler
Replied by mhaberler on topic Re:Creating a GUI
cmorley wrote:

Michael

have any idea how SPINDLE_CONSTANT works? I assume it means constant surface speed...

Chris M


The linuxcnc forensics & reverse engineering department has determined it's a noop:

from git.linuxcnc.org/gitweb?p=linuxcnc.git;a...52410e7a786578#l1430

maybe Alex Joni can shed some light on this:

$ git blame src/emc/task/taskintf.cc
...
1d62729f (Alex Joni 2006-07-10 21:35:34 +0000 1421) int emcSpindleConstant()
1d62729f (Alex Joni 2006-07-10 21:35:34 +0000 1422) {
1d62729f (Alex Joni 2006-07-10 21:35:34 +0000 1423) return 0; // nothing to do
1d62729f (Alex Joni 2006-07-10 21:35:34 +0000 1424) }

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

More
08 Aug 2012 11:09 - 08 Aug 2012 11:44 #22972 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
cmorley wrote:

hey John I looked at your tutorial..

couple things I noticed maybe you already know...
in 3b the python code...
This is not needed:

# language stuff I think
import gettext
LOCALEDIR = os.path.join(BASE, "share", "locale")
gettext.install("linuxcnc", localedir=LOCALEDIR, unicode=True)
gtk.glade.bindtextdomain("linuxcnc", LOCALEDIR)
gtk.glade.textdomain("linuxcnc")
TCLPATH = os.environ

Also when putting the new screen in /bin you don't need to remove the .py part.
DISPLAY=gui3.py
will work.
The reason I mention this is if someone is testing it is nice if the editor knows the file is python.

great work though! is your plan to add it to the official docs ?


I wasn't really sure what the heck that code did... but I do know when I was importing the support libraries from touchy it was needed for some reason.

I was just blindly following the leader in removing the .py....

I've not given any thoughts to adding the tutorials to the docs yet but that is a good idea once they are polished up. I think for now I'll add some links here and on the wiki.

I added links to the wiki and the documents page here.

Thanks
John
Last edit: 08 Aug 2012 11:44 by BigJohnT.

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

More
01 Sep 2012 14:01 - 01 Sep 2012 14:04 #23829 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
I just gotta tell someone... I've been making progress on writing a GUI from scratch. The latest hurdles have been testing for a postgui file and running it if found, jogging the axes around and getting the value from a slider to control my jog speed and presetting the slider to a default value on start up and enabling part of the screen based on conditions like is the estop out and power on.



I'll work on adding gui 6 to the custom gui tutorial. This will add a lot of information about building your own GUI.

John
Attachments:
Last edit: 01 Sep 2012 14:04 by BigJohnT.

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

Time to create page: 0.299 seconds
Powered by Kunena Forum