G-code syntax highlighting issues and file handling issues

More
22 Apr 2024 14:24 #298840 by Unlogic
I'm running the latest stable version of LinuxCNC 2.9.2 on a fully updated Debian 12.5 install along with the latest ProbeBasic updates and I've come across some issues relating to syntax highlighting and file handling.

If I fire up ProbeBasic and start typing in the G-code editor under the File tab I get this very nice syntax highlighting seen on the screenshot below.

 

However if I press the "Save" button nothing happens. If I press the "Save as" button a dialog prompting for a file name appears but the file doesn't actually seem to get saved anywhere and the G-code doesn't get loaded into the "Gcode" preview under the main tab (as seen on the screenshot below).

 

If I instead load an existing file using the "Load G-code" button under the File tab the selected file is actually loaded and displayed both in the G-code editor and "Gcode" preview under the main tab. However now the nice G-code syntax highlighting is gone.

 

 

These are not show stopping issues but I thought I'd bring them up to get the attention of the developers.

If you want me to create a GitHub issue just let me know and I'll add one.

I'm getting the same behavior in the simulator so I haven't attached my LinuxCNC ini/hal files.




 
Attachments:

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

More
04 May 2024 08:42 #299694 by andypugh
I suspect that the syntnax highlighting is handled by a plugin of the file editor widget (ie, I very much doubt that the author of the gui wrote an editor from scratch).
So, this possibly comes down to the file extension, and which highlighter is associated with which file extension.

Is there any sign of the file that you edited if you look in that location with the system file manager? Maybe with a .nc extension, rather than ngc?

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

More
04 May 2024 18:25 #299746 by Unlogic
Thanks for the input Andy, I'll give that a try tomorrow when I'm the garage and see if it makes any difference.

The syntax highlighting really improves the readability of the code so I'd love to get it working as I'm still a rookie when it comes to G-code.

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

More
05 May 2024 09:26 - 05 May 2024 09:26 #299794 by Unlogic
Changing the file extension to .nc did change the icon of the files in the file browsers but it still doesn't give any syntax highlighting.

Think I found the classes responsible for the syntax highlighting and file editing in the QtPyVCP GitHub repository. But at first glance I don't see anything obviously wrong.

github.com/kcjengr/qtpyvcp/blob/f007c618...s/gcode_text_edit.py
Last edit: 05 May 2024 09:26 by Unlogic.

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

More
07 May 2024 07:49 #300012 by Unlogic
I dug further into this issue yesterday and while I didn't manage to figure out the syntax highlighting issues I did however notice that the "Save as" button actually works when you start with a blank previously unsaved file.

It's just that the filename dialog that pops up doesn't have any path set so if you just type in a filename the file is saved relative to where the config is located for the current LinuxCNC session. I think a more user friendly approach here would be to prefill the path to the directory currently displayed in the file manager to left of the G-code editor.

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

More
15 May 2024 05:25 #300648 by Lcvette
I noticed this the other day also, I have it on my list to address. If you enter a path to save it works but it could certainly be easier than typing a full path out. If you have a fix already please let me know and submit a pull request and I'll have a look and incorporate it after testing,

Thanks!

Chris

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

More
15 May 2024 05:33 #300650 by Unlogic
Did you notice the missing syntax highlighting in your environment too?

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

More
15 May 2024 05:40 #300652 by Lcvette
I did not, but wasn't paying attention, I had created an mdi program for some twister lathe work and was just saving the g code file after use, so wasn't editing just saving for future use.

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

Moderators: KCJLcvette
Time to create page: 0.295 seconds
Powered by Kunena Forum