Gcode Editor saving issues

More
07 Apr 2021 00:11 - 07 Apr 2021 00:11 #205217 by snowgoer540
I've run into an issue in QtPlasmaC that I believe gcode_editor.py to be responsible for. I say that because I did some poking around and I see the same issue in QtDragon.

The issue comes with saving a file that was edited with the editor and giving it a different name.

Steps to reproduce:
1. edit a file
2. save the file
3. the editor for both qtdragon and qtplasmac has a GCode filetype option, click that
4. type in the file name, but omit the extension ("test" for example)
5. click save

At this point, the file "test.ngc" will be saved in the folder you selected. However you will get the following error:

"Unable to open file </home/plasma/linuxcnc/nc_files/test>
can't open /home/plasma/linuxcnc/nc_files/test"

So, it seems that it is being saved to the file system correctly, but when the file name is being passed to open/reload the file, the extension is missing.

Possibly worth noting, that if you type in "test.ngc", it will save "test.ngc" in the file system, and it will open without error. A bit odd as I would have expected it to save "test.ngc.ngc", but it does not.

I poked around in gcode_editor.py, but this is above my pay grade. :) I appreciate the help, please let me know if I can provide any extra info, etc.
Last edit: 07 Apr 2021 00:11 by snowgoer540.

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

More
10 Apr 2021 15:38 #205531 by persei8
Replied by persei8 on topic Gcode Editor saving issues
I can confirm this same behaviour. It seems that when a file is saved, qtvcp immediately tries to load the new file into linuxcnc with the name given when saved without checking if the filename has a valid extension. The workaround is to either save the file with an extension or switch back to MAN mode and reselect the FILE tab and load the file you just saved. However, it does need to have a valid extension.
Jim
The following user(s) said Thank You: snowgoer540

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

More
11 Apr 2021 15:23 #205644 by cmorley
Replied by cmorley on topic Gcode Editor saving issues
If you don't add an ending what - what would be a good assumption?
the library function ACTION.SAVE_PROGRAM automatically adds .ngc if there is no ending.

I can fix the reported problem by having the function return the saved path rather then use the typed in path, but currently the automatic path ending can't be changed.

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

More
11 Apr 2021 15:30 #205645 by cmorley
Replied by cmorley on topic Gcode Editor saving issues
thinking more maybe if a different filename has been entered then the file should be not reloaded.

Originally the editor was for editing the file being used, so it would ant to be reloaded in to linuxcnc. maybe that was a bad assumption.

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

More
11 Apr 2021 15:46 #205647 by persei8
Replied by persei8 on topic Gcode Editor saving issues

Originally the editor was for editing the file being used, so it would ant to be reloaded in to linuxcnc. maybe that was a bad assumption.

I don't think that is a bad assumption. IMO, your suggestion to load the saved filename rather than the typed in filename is the best solution.
Jim
The following user(s) said Thank You: snowgoer540

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

More
11 Apr 2021 17:41 - 11 Apr 2021 18:44 #205661 by hottabich
In linuxcnc 2.8.1 works great. If we do not specify the file extension, we will get an error (but why do that). We edit the uploaded file, save it by choosing replace and that's it. You can add a version number. I also added to the handler
if isinstance(receiver2, EDITOR):
               flag = True
               break
          receiver2 = receiver2.parent()
Attachments:
Last edit: 11 Apr 2021 18:44 by hottabich.

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

More
11 Apr 2021 17:55 #205663 by cmorley
Replied by cmorley on topic Gcode Editor saving issues
i changed it in master so it will add the ending before trying to reload.
it's possible (in ACTION.SAVE_PROGRAN) to specify the ending to add when saving, it defaults to .ngc
The following user(s) said Thank You: snowgoer540

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

More
11 Apr 2021 18:10 #205666 by snowgoer540

Originally the editor was for editing the file being used, so it would ant to be reloaded in to linuxcnc. maybe that was a bad assumption.

I don't think that is a bad assumption. IMO, your suggestion to load the saved filename rather than the typed in filename is the best solution.
Jim


I am a bit late to the party on this, I have been messing around with some wiring on the plasma table, but I agree. I dont think it's a bad assumption. If the user doesn't specify a extension, it defaults to .ngc. Then in that case, it should try to load what it saved. I think that's best case.

Which is what it sounds like you did, so that should be good!

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

More
11 Apr 2021 18:15 #205668 by snowgoer540
Yep, can confirm, works awesome!

Thanks Chris!
The following user(s) said Thank You: cmorley

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

More
20 Apr 2021 16:01 #206539 by hottabich
If I add stocks to the handler as in the screenshot, then the Editor works as I want and the hint does not interfere when writing a filename, but use_keyboard breaks down. How can I fix this? Thank you.
Attachments:

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

Moderators: cmorley
Time to create page: 0.167 seconds
Powered by Kunena Forum