LinuxCNC Features - a kind of NGCGUI
- Nick
- Topic Author
- Offline
- Elite Member
- Posts: 178
- Thank you received: 15
We have started to develop a kind of replacement for ngcgui.
What is done allready:
GUI for creating Features, system for saving/parsing the subroutines, creating Gcode.
There are some new features like Linear or Circular array.
We are planning to make able Refreshing Gcode in real time, so any changes in parameters will be seen at LinuxCNC preview in realtime.
Source codes are available at github.com/cnc-club/linuxcnc-features
Here's the link to original developping thread (in Russian) cnc-club.ru/forum/viewtopic.php?f=15&t=3...ilit=features#p69194
Now to the problems
We thought that it will be great if we would be able to make GladeVCP component from LinuxCNC Features. So we'll be able to pack it into any interface.
But we faced the problem - this tutorial does not work (wiki.linuxcnc.org/cgi-bin/wiki.pl?GladeVCP_Custom_Widgets). And gladevcp does not give much debugging information, except that creating from xml was failed.
Can anybody help us with that, please?
Any help will be appreciated.
PS sorry for my English.
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
- Posts: 7773
- Thank you received: 2055
Sometimes the error message is posted when opening the glade interface from a terminal. It is easy to miss as it scrolls by.
Chris M
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
- Posts: 7773
- Thank you received: 2055
So a guaranteed working example is already on your computer.
In fact there are several gladeVCP widgets there. Look in <linuxcnc folder>/lib/python/gladevcp/
Chris M
Please Log in or Create an account to join the conversation.
- Nick
- Topic Author
- Offline
- Elite Member
- Posts: 178
- Thank you received: 15
If I run gladevcp features.glade, where features.glade - is glade interface from git - it starts up a new window with the widget.
If I try to run gladevcp features.ui where glade.ui is
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gladevcp 0.0 -->
<requires lib="gtk+" version="2.24"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<child>
<object class="Features" id="features">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</interface>
gladevcp features.ui
(gladevcp:8918): libglade-WARNING **: Expected <glade-interface>. Got <interface>.
(gladevcp:8918): libglade-WARNING **: did not finish in PARSER_FINISH state
**** GLADE VCP ERROR: With xml file: features.ui : could not create GladeXML object
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
- Posts: 7773
- Thank you received: 2055
if you start the glade editor the widget will show?
If you make a gladevcp panel with the widget it will show?
If you change the ending to .ui it won't show?
Remember that you must have the scripts/rip/environment set up.
also to update the hal_python.xml I believe require make clean;make
Chris M
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
- Posts: 7773
- Thank you received: 2055
Are you planning to put the subroutines folder somewhere - right now it has to be in the folder you start the glade editor from.
Chris M
Please Log in or Create an account to join the conversation.
- Nick
- Topic Author
- Offline
- Elite Member
- Posts: 178
- Thank you received: 15
Sorry for another delay .
I've almost solved the problem with creating gladevcp widget.
It appears that gladevcp objects are stored and linked into two different location, so it was not enough just adding new files, creating links was also needed.
Another problem I met - after embedding widget into axis TreeView does not react on it's usual keypresses. Up/Down/Left/Right does not work as they work in standalone version. If I add 'key_press_event' to TreeView it sees keypress events, but I have no clue how to bring back standard behavior.
Another thing - I can not force Axis to load created file. I can only force it to reload already opened file by executing axis-remote --reload. NGCGUI uses something like
if ![catch {send axis "remote open_file_name $f"} msg] { ...
How can it be done from python? Or are there any other ways to do it?
PS I've add subroutines path search from the path defined in ini file.
Here's how it looks now:
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
- Posts: 7773
- Thank you received: 2055
programs that end in .py or .glade that are in the gladevcp folder should just work. it may require a make clean; make but it shouldn't
Not sure about the reload problem. You might look at pyngcgui in another thread.
There are problems passing key events from AXIS to gladeVCP panels - might look in the manual to see if there is advice.
Chris M
Please Log in or Create an account to join the conversation.
- Nick
- Topic Author
- Offline
- Elite Member
- Posts: 178
- Thank you received: 15
We believe key handling works OK, but since it is new code, we’re telling about it you so you can watch out for problems; please let us know of errors or odd behavior. This is the story:
Axis uses the TkInter widget set. GladeVCP applications use Gtk widgets and run in a separate process context. They are hooked into Axis with the Xembed protocol. This allows a child application like GladeVCP to properly fit in a parent’s window, and - in theory - have integrated event handling.
However, this assumes that both parent and child application properly support the Xembed protocol, which Gtk does, but TkInter doesn’t. A consequence of this is that certain keys would not be forwarded from a GladeVCP panel to Axis properly under all circumstances. One of these situations was the case when an Entry, or SpinButton widget had focus: in this case, for instance an Escape key would not have been forwarded to Axis and cause an abort as it should, with potentially disastrous consequences.
Therefore, key events in GladeVCP are explicitly handled, and selectively forwarded to Axis, to assure that such situations cannot arise. For details, see the keyboard_forward() function in lib/python/gladevcp/xembed.py.
But I thought that it means that GladeVCP will froward some events to Axis. More over I added on_key_press event and saw that TreeView gets this events, just do not handle it in default mode by moving the cursor.
Hmmm... Probably it is because I've tried to use it with already installed linuxcnc, and not built from source one.No links should be require.
programs that end in .py or .glade that are in the gladevcp folder should just work. it may require a make clean; make but it shouldn't
Please Log in or Create an account to join the conversation.
- Nick
- Topic Author
- Offline
- Elite Member
- Posts: 178
- Thank you received: 15
I've found that axis-remote has open file function, but it is not described in Usage and unsuspected...
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...73e1fe8f;hb=HEAD#l65
if mode == UNSPECIFIED:
mode = OPEN
Is there any reason why it is not made the same as --mdi, i.e.
axis-remote --open filename ?
Concerning keybindings it seems to be deeper than event forwarding. I've removed any signal connects from xembed.py, and still have no effect...
Do you know why widgets do not take focus? Treeview is drawn like it is not focused...
Please Log in or Create an account to join the conversation.