Call o-sub with toggle button
03 Nov 2018 01:13 #119860
by cmorley
Replied by cmorley on topic Call o-sub with toggle button
EMBED_TAB_COMMAND = gladevcp -x {XID} -u myui.py myui.ui
Try that - ui file must be last IIRC
also if you run linuxcnc from the terminal then you can see it the button
toggles the print statement - letting us know if at least that part works.
Chris M
Try that - ui file must be last IIRC
also if you run linuxcnc from the terminal then you can see it the button
toggles the print statement - letting us know if at least that part works.
Chris M
Please Log in or Create an account to join the conversation.
03 Nov 2018 10:46 - 03 Nov 2018 12:42 #119864
by FedX
Replied by FedX on topic Call o-sub with toggle button
When i start the code from terminal i get some failures:
And i have another big problem.. when a axis hits a limit joint then gmoccapy completeley freezes.., in axis i get just get a warning that one of the limit switches hits an end is that a known problem i couldnt find something
**** GMOCCAPY INFO : postgui halfile = custom_postgui.hal ****:
gladevcp: trouble looking for handlers in 'myui': HandlerClass instance has no attribute 'builder'
Traceback (most recent call last):
File "/usr/bin/gladevcp", line 122, in load_handlers
objlist = h(halcomp,builder,useropts)
File "./myui.py", line 20, in get_handlers
return [HandlerClass(halcomp,builder,useropts)]
File "./myui.py", line 9, in __init__
self.mdi_1 = self.builder.get_object('on_mdi_camon_activate')
AttributeError: HandlerClass instance has no attribute 'builder'
/usr/bin/gladevcp:212: RuntimeWarning: missing handler 'on_Cam_active_toggled'
builder.connect_signals(handlers)
/usr/bin/gladevcp:212: RuntimeWarning: missing handler 'on_mdi_camon_activate'
builder.connect_signals(handlers)
/usr/bin/gladevcp:212: RuntimeWarning: missing handler 'on_mdi_camoff_activate'
builder.connect_signals(handlers)
And i have another big problem.. when a axis hits a limit joint then gmoccapy completeley freezes.., in axis i get just get a warning that one of the limit switches hits an end is that a known problem i couldnt find something
Last edit: 03 Nov 2018 12:42 by FedX.
Please Log in or Create an account to join the conversation.
03 Nov 2018 17:17 - 03 Nov 2018 17:17 #119871
by cmorley
Replied by cmorley on topic Call o-sub with toggle button
Oops sorry:
change the two lines to (note i removed self.):
I don't know anything about freezing at limit stops - other then needing to push a ignore limits button to move off the limit.
does a pop message come?
Does the GUI actually freeze on all input or is it you just can't do certain things anymore.
Chris M
change the two lines to (note i removed self.):
self.mdi_1 = builder.get_object('on_mdi_camon_activate')
self.mdi_2 = builder.get_object('on_mdi_camoff_activate')
I don't know anything about freezing at limit stops - other then needing to push a ignore limits button to move off the limit.
does a pop message come?
Does the GUI actually freeze on all input or is it you just can't do certain things anymore.
Chris M
Last edit: 03 Nov 2018 17:17 by cmorley.
Please Log in or Create an account to join the conversation.
03 Nov 2018 20:37 #119882
by rodw
Replied by rodw on topic Call o-sub with toggle button
On the gmoccappy jog screen, there should be an ignore limits tickbox to allow you to jog off a limit switch.
In reality, the known problem is with your machine configuration as you should never be able to hit a limit switch in normal operation. You need to change your ini file settings so the joint and axis lengths fall inside the limit switches.
In reality, the known problem is with your machine configuration as you should never be able to hit a limit switch in normal operation. You need to change your ini file settings so the joint and axis lengths fall inside the limit switches.
Please Log in or Create an account to join the conversation.
03 Nov 2018 23:39 - 04 Nov 2018 00:27 #119894
by FedX
Replied by FedX on topic Call o-sub with toggle button
When the limit switches are active at startup and im starting the machine without overwriting the limits, then the whole GUI freezes and crashes. Normally i should get a warning when trying to activate the machine, this is like axis act. My machine isn't connected at the moment for testing the camera and new GUI stuff, thats why linuxCNC thinks my machine is at limit. But i think gmoccapy shouldn't act like this anyways.. I'll attach a screenshot later and the terminal text.
so next problem with the handler code is the widget argument:
when i only call
the button "works", but when toggled first time it prints the same state as it gets untoggled
and another question: should it really be self.mdi_1.emit('activate') or the signal name of mdi command: self.mdi_1.emit('on_mdi_camon_activate')
I'll try to understand the Gtk.ToggleButton, at the moment its really hard for me to understand all these Gtk/ Python stuff, ive never used python before
so next problem with the handler code is the widget argument:
TypeError: on_Cam_active_toggled() takes exactly 3 arguments (2 given)
when i only call
def on_Cam_active_toggled(self, state):
print 'Button 1 toggled. state: ', state
if state:
self.mdi_1.emit('activate')
else:
self.mdi_2.emit('activate')
the button "works", but when toggled first time it prints the same state as it gets untoggled
Button 1 toggled. state: <gtk.ToggleButton object at 0x8de55a4 (GtkToggleButton at 0x85da990)>
Traceback (most recent call last):
File "./myui.py", line 9, in on_Cam_active_toggled
self.mdi_1.emit('activate')
AttributeError: 'NoneType' object has no attribute 'emit'
Button 1 toggled. state: <gtk.ToggleButton object at 0x8de55a4 (GtkToggleButton at 0x85da990)>
Traceback (most recent call last):
File "./myui.py", line 9, in on_Cam_active_toggled
self.mdi_1.emit('activate')
AttributeError: 'NoneType' object has no attribute 'emit'
and another question: should it really be self.mdi_1.emit('activate') or the signal name of mdi command: self.mdi_1.emit('on_mdi_camon_activate')
I'll try to understand the Gtk.ToggleButton, at the moment its really hard for me to understand all these Gtk/ Python stuff, ive never used python before
Last edit: 04 Nov 2018 00:27 by FedX.
Please Log in or Create an account to join the conversation.
04 Nov 2018 00:46 #119899
by cmorley
Replied by cmorley on topic Call o-sub with toggle button
I apologize - it's been awhile since using gladevcp:
here is an example that will work (I tested it)
add the test.py and test.glade file to your config folder.
add these line to your INI under the heading [DISPLAY}:
EMBED_TAB_NAME = test
EMBED_TAB_LOCATION = hbtb_MDI
EMBED_TAB_COMMAND = gladevcp -x {XID} -u test.py test.glade
When you press the button it will display a message box with text about which action is running.
Chris M
here is an example that will work (I tested it)
add the test.py and test.glade file to your config folder.
add these line to your INI under the heading [DISPLAY}:
EMBED_TAB_NAME = test
EMBED_TAB_LOCATION = hbtb_MDI
EMBED_TAB_COMMAND = gladevcp -x {XID} -u test.py test.glade
When you press the button it will display a message box with text about which action is running.
Chris M
The following user(s) said Thank You: FedX
Please Log in or Create an account to join the conversation.
04 Nov 2018 13:26 #119929
by FedX
Replied by FedX on topic Call o-sub with toggle button
yes its finally working thank you!
do you have some recommended pages to learn more about python and gtk3 ? I would like to understand these functions and calls
do you have some recommended pages to learn more about python and gtk3 ? I would like to understand these functions and calls
Please Log in or Create an account to join the conversation.
04 Nov 2018 19:50 #119935
by cmorley
Replied by cmorley on topic Call o-sub with toggle button
Yaay - sorry about the long road there.
GladeVCP uses python2 and GTK2 in a library called PyGTK2
PyGTK2 tutorials on the net that I found useful:
georgejhunt.com/olpc/pydebug/Pygtk2Tutor...2tutorial/index.html
zetcode.com/gui/pygtk/
Python 2 is pretty easy to learn the basics pretty much any source is good.
Much of GladeVCP programming is boiler code with a few basic function.
Chris M
GladeVCP uses python2 and GTK2 in a library called PyGTK2
PyGTK2 tutorials on the net that I found useful:
georgejhunt.com/olpc/pydebug/Pygtk2Tutor...2tutorial/index.html
zetcode.com/gui/pygtk/
Python 2 is pretty easy to learn the basics pretty much any source is good.
Much of GladeVCP programming is boiler code with a few basic function.
Chris M
Please Log in or Create an account to join the conversation.
07 Nov 2018 08:39 #120155
by FedX
Replied by FedX on topic Call o-sub with toggle button
OK i want to so something more. To get a better accuracity of the camera, i want to set it to the same height for different heights of workpieces. To do this i want to use a pop up which appears when pressing the toggle button first time. To do so i would use a gtk.dialog with a spin button.
Lets say camera height without workpiece is g53 z -100, and the workpiece has a height of 20, then the camera height should go to g53 z-100+20
That means that i have to give my .ngc the value entered to the spin button. Ist it possible to read values from .py to .ngc Files?
A nice Feature would be to use a Tool offset z for the absolute starting height of -100, because im using these offset values to calculate the x and y values of camera Offset. but i didnt find a way to move the g43 tool Offset in g53 coordinates. I use these ngc files to do so wiki.linuxcnc.org/cgi-bin/wiki.pl?Axis_Embed_Video
Best regards
Lets say camera height without workpiece is g53 z -100, and the workpiece has a height of 20, then the camera height should go to g53 z-100+20
That means that i have to give my .ngc the value entered to the spin button. Ist it possible to read values from .py to .ngc Files?
A nice Feature would be to use a Tool offset z for the absolute starting height of -100, because im using these offset values to calculate the x and y values of camera Offset. but i didnt find a way to move the g43 tool Offset in g53 coordinates. I use these ngc files to do so wiki.linuxcnc.org/cgi-bin/wiki.pl?Axis_Embed_Video
Best regards
Please Log in or Create an account to join the conversation.
07 Nov 2018 12:32 #120162
by rodw
M66 En L0 will retrieve an analog pin (0-3) and store it in parameter #5399
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m66
So you just need to define a pin in your python script and connect it to the analog pin motion.analog-in-nn
Replied by rodw on topic Call o-sub with toggle button
. Ist it possible to read values from .py to .ngc Files?
Best regards
M66 En L0 will retrieve an analog pin (0-3) and store it in parameter #5399
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m66
So you just need to define a pin in your python script and connect it to the analog pin motion.analog-in-nn
Please Log in or Create an account to join the conversation.
Moderators: HansU
Time to create page: 0.090 seconds