Creating a GUI

More
05 Aug 2012 21:39 #22878 by cmorley
Replied by cmorley on topic Re:Creating a GUI
no
from jtgui import emc_interface

means from folder jtgui import emc_interface
is your folder called that?
hold on for sample code for a widget...

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

More
05 Aug 2012 21:44 - 05 Aug 2012 21:51 #22879 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
I've gotten past that error but I think an internationalization thing is holding me up now with the gettext thing.

Ok, I'm past that and figured out where set_text was and now the libs load...

John
Last edit: 05 Aug 2012 21:51 by BigJohnT.

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

More
05 Aug 2012 22:08 #22880 by cmorley
Replied by cmorley on topic Re:Creating a GUI
sample
Attachments:

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

More
05 Aug 2012 22:11 #22881 by cmorley
Replied by cmorley on topic Re:Creating a GUI
you won't be able to run this file but you can see what I did to connect to module linuxcnc

File Attachment:

File Name: drowidget.zip
File Size:2 KB
Attachments:

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

More
05 Aug 2012 22:28 #22882 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
Thanks, I'll pick that apart and see if I can make it work for me.

John

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

More
06 Aug 2012 11:45 - 06 Aug 2012 11:52 #22898 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
I understand some of the code but this I don't have a clue what it is doing. I do understand the class HAL_DRO but not what the (gtk.VBox) is for. I know that __gproperties__ is assigned a dictionary but not what __gproperties__ or __gtype_name__ does.
class HAL_DRO(gtk.VBox):
    __gtype_name__ = 'HAL_DRO'
    __gproperties__ = {
        'is_editable' : ( gobject.TYPE_BOOLEAN, 'Is Editable', 'Ability to use a keyboard to enter data',
                    False, gobject.PARAM_READWRITE | gobject.PARAM_CONSTRUCT),
		'font' : ( gobject.TYPE_STRING, 'Pango Font', 'Display font to use',
                "sans 12", gobject.PARAM_READWRITE|gobject.PARAM_CONSTRUCT),
    }
    __gproperties = __gproperties__

And some googling later I see that __gtype_name__ has something to do with creating a custom widget for Glade3.

And even more googling I see that __gproperties__ is used to create custom properties for a class.

Thanks
John
Last edit: 06 Aug 2012 11:52 by BigJohnT.

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

More
06 Aug 2012 12:02 #22899 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
In the def __init__(self, *a, **kw) the *a and **kw what do they do?

John

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

More
06 Aug 2012 12:22 #22900 by BigJohnT
Replied by BigJohnT on topic Re:Creating a GUI
WEEEE! I make a huge breakthrough!

I added to my __init__
self.emc = linuxcnc
self.status = self.emc.stat()

and a button

def on_test_button_clicked(self, widget, data=None):
self.status.poll()
print self.status.g5x_offset[0]

and too my surprise when I click on the button I get something... where does emc.stat come from so I can see what all is there?

Thanks
John

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

More
06 Aug 2012 14:00 - 06 Aug 2012 14:09 #22907 by cmorley
Replied by cmorley on topic Re:Creating a GUI
Yaaaay!!

yes the other stuff was boiler code for making a widget.
The emc.stat stuff was what I was wanting to show you.

info for emc.stat() which comes from module linuxcnc:
look through the example gscreen's emc_interface, emc_stats
self.emcstat is the same as your self.status.

also run an interactive python in a terminal (type python <enter>)

then:
import linuxcnc
then
help(linuxcnc)

gives a whole ton of info on the module

there is
stat()
error_channel()
command()

each has methods to call to do stuff.

Chris M
Last edit: 06 Aug 2012 14:09 by cmorley.

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

More
06 Aug 2012 14:06 #22908 by cmorley
Replied by cmorley on topic Re:Creating a GUI
If your interested in looking at the source for module linuxcnc

src/emc/usr_intf/axis/extentions/linuxcnc.cc

lot of python to c++ boiler code in there....

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

Time to create page: 0.105 seconds
Powered by Kunena Forum