OrcaSlicer icon indicating copy to clipboard operation
OrcaSlicer copied to clipboard

Port EditGCodeDialog from PrusaSlicer

Open Ocraftyone opened this issue 1 year ago β€’ 8 comments

This is a port of the EditGCodeDialog from PrusaSlicer 2.7.x. There were a few changes made to make it a bit more functional. Also, it isn't quite fully complete, but it should be in a very usable state.

General Changes:

  • Implement UndoValueUIManager and EditValueUI in Field
  • Implement EditGCodeDialog and add buttons to the tabs
  • Other minor changes to accommodate the new classes

Differences from PrusaSlicer's Implementation:

  • backported to wxWidgets 3.1.5 (reverse commit 8770c4b7 after updating to 3.2.x)
  • icons have been updated to use Orca colors
  • improve the report that tells you if certain placeholders have not been defined properly for the dialog. It now shows all issues at once rather than having to fix then recompile to see the next issue.
  • allow the use of the cmake option ORCA_CHECK_GCODE_PLACEHOLDERS to toggle the above report since our workflow rarely uses debug mode.
  • if a custom gcode value is not set when checking gcode placeholders, a testing value is set. Custom gcode is not parsed if it is empty, and the only way to check if the placeholders are all defined is by running the placeholder operation on the custom gcode.
  • some calls to print.config() in Gcode.cpp were changed to m_config to support the above testing values feature (only m_config is modified with the placeholders and print.config() would return an empty string)
  • a macro has been added to quickly add a definition to SlicingStatesConfigDefs with less boiler plate (it could technically be used for any ConfigOptionDef, but that would hurt interoperability with PS. I tried to not use the macro for too many PS defined definitions.)
  • the presets are now also categorized by the page they are on in their tab
Prusa Orca

TODO:

  • [x] Make sure all linux fixes have been applied
  • [x] Finish adding "universal" gcode options
  • [ ] add search function to dataview (maybe?)
  • [ ] determine if any options are being left out of the preset categories by getting options from Tab rather than Presets. If so, consider adding outside of the groupings

Ocraftyone avatar Jan 01 '24 16:01 Ocraftyone

sorry about the couple of extra PRs created. I had merged some of the changes from the wx upgrade ahead of time and it cause issues because of the reversion. Some cherry picking magic later, new branch!

Ocraftyone avatar Jan 01 '24 16:01 Ocraftyone

@Ocraftyone and @SoftFever, I noticed your check builds were failing. I ran into the same issue here today and found that it's because the site hosting Boost (https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.gz) was returning "409 Conflict". Now it's prompting for the original registrant's email address to be added.

TL;DR, I got a copy of Boost from here: https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.gz

I put it in the OrcaSlicer\deps\DL_CACHE\Boost directory and after that, I could successfully compile. Just a PITA. lol

tsmith35 avatar Jan 02 '24 06:01 tsmith35

@Ocraftyone and @SoftFever, I noticed your check builds were failing. I ran into the same issue here today and found that it's because the site hosting Boost (https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.gz) was returning "409 Conflict". Now it's prompting for the original registrant's email address to be added.

TL;DR, I got a copy of Boost from here: https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.gz

I put it in the OrcaSlicer\deps\DL_CACHE\Boost directory and after that, I could successfully compile. Just a PITA. lol

yeah, we noticed that too. Lmao, let's see how long boost.org will recover it. If not, we will switch to github

SoftFever avatar Jan 02 '24 07:01 SoftFever

Just curious, why did we not use GitHub in the first place? Seems to be a very reliable source and more well known.

Ocraftyone avatar Jan 02 '24 08:01 Ocraftyone

Just curious, why did we not use GitHub in the first place? Seems to be a very reliable source and more well known.

Because Boost doesn't use github and we just download from their official links.

SoftFever avatar Jan 02 '24 10:01 SoftFever

I guess it doesn't matter because the link is back up! πŸŽ‰

Ocraftyone avatar Jan 02 '24 10:01 Ocraftyone

I guess it doesn't matter because the link is back up! πŸŽ‰

lmao, just 1 hour after I changed to github cache

SoftFever avatar Jan 02 '24 12:01 SoftFever

I guess it doesn't matter because the link is back up!

lmao, just 1 hour after I changed to github cache

That is expected behavior, much like finding a lost item after buying a replacement. 😁

tsmith35 avatar Jan 02 '24 14:01 tsmith35

@SoftFever I believe we are good to go on the features. I have tested a bit in windows and I am about to do some testing in ubuntu. @Noisyfox , @discip , @igiannakas , and any other testers, if you don't mind giving it a quick overview and LMK if there are any improvements or bugs to address, that would be awesome!

Ocraftyone avatar Jan 11 '24 03:01 Ocraftyone

Good morning @Ocraftyone, First and foremost: Thank you for this contribution! If you wouldn't have done this I would probably never now there was a g-code-editor in Orca. πŸ˜…

The only thing I noticed using Windows: The plus symbol in the middle jumps up and down when selecting different entries on the left side.

Will test Linux later.

discip avatar Jan 11 '24 10:01 discip

I see what is happening. It is when the description text goes longer than a single line an it wraps. I will see if I can hardcode a position for the button to try and prevent that during resizing

If you wouldn't have done this I would probably never now there was a g-code-editor in Orca. πŸ˜…

There isn't. Now there is 😁

Ocraftyone avatar Jan 11 '24 10:01 Ocraftyone

@discip I got that change implemented. It now is positioned half way down the original height of the parameter list. This should be fine for now, but I did also identify another bug in the process. The window is resizable and the text field properly resizes, but the param list does not resize vertically. I am thinking that this is due to a wxWidgets change though because I am not able to identify any code that relates to that.

Ocraftyone avatar Jan 11 '24 11:01 Ocraftyone

Latest commit removes the ability to resize the border. It solves a few issues that are laid out in the commit message

Ocraftyone avatar Jan 11 '24 12:01 Ocraftyone

@SoftFever I believe we are good to go on the features. I have tested a bit in windows and I am about to do some testing in ubuntu. @Noisyfox , @discip , @igiannakas , and any other testers, if you don't mind giving it a quick overview and LMK if there are any improvements or bugs to address, that would be awesome!

Thanks @Ocraftyone ! I should be able to start to review PRs again from tomorrow. Was fully occupied with until todayπŸ˜…

SoftFever avatar Jan 11 '24 13:01 SoftFever

@SoftFever I believe we are good to go on the features. I have tested a bit in windows and I am about to do some testing in ubuntu. @Noisyfox , @discip , @igiannakas , and any other testers, if you don't mind giving it a quick overview and LMK if there are any improvements or bugs to address, that would be awesome!

Thanks @Ocraftyone ! I should be able to start to review PRs again from tomorrow. Was fully occupied with until todayπŸ˜…

No problem! I am trying to do some more tests in the mean time. I would ideally like someone to test on mac too, which is why I pinged @igiannakas

Ocraftyone avatar Jan 11 '24 13:01 Ocraftyone

@Ocraftyone Finally I had time to test this on Linux (Manjaro) but unfortunately it doesn't work at all. As soon as I click on the corresponding icon, it asks me to either wait or to force quit, but even if I choose "Wait" it crashes.

Also I'm not sure where to find the related logfile.

setup
CPU GPU RAM SSD
Ryzen 9 7950X3D XFX 7900 XTX G.Skill Flare X5 32 GB (EXPO I enabled) Samsung 990 Pro 2 TB

discip avatar Jan 11 '24 21:01 discip

Nice one this PR! There are so many gcode options that knowing them all is impossible!

UI wise on an M1 Pro MacBook Pro

https://github.com/SoftFever/OrcaSlicer/assets/59056762/81c7c3e0-a5ab-4323-ba36-eb705fea43e6

When clicking an option the list is momentarily refreshed displaying that option as a label for all Gcode placeholders. Once the tree loads, the correct values are displayed.

igiannakas avatar Jan 12 '24 10:01 igiannakas

@igiannakas would mind trying PrusaSlicer and see if it does something similar?

Ocraftyone avatar Jan 12 '24 10:01 Ocraftyone

@igiannakas would mind trying PrusaSlicer and see if it does something similar?

Yeap it does exactly the same... It's cosmetic so no real issue, but was the only thing I could see!

Another thing to consider is possibly filtering the list by the options available to the current print model - for example ramming doesn't apply to BBL printers etc. Again, that is polishing type stuff.

igiannakas avatar Jan 12 '24 10:01 igiannakas

Another thing to consider is possibly filtering the list by the options available to the current print model - for example ramming doesn't apply to BBL printers etc. Again, that is polishing type stuff.

That would be nice, but it would be a pretty manual process of determining all of the options that don't apply to BBL printers. Unless there is somewhere that specifies the options that are disabled or there are only a handful of options that would need to be disabled, I am hesitant to do that.

As for the dataview issue, do you have the same issue with the object list dataview? Maybe it has some logic to alleviate this. While building this, I saw that there were some options indicating that you can set an animation for expanding and collapsing items, but I did not mess with them. Maybe it has to be explicitly disabled for mac.

Ocraftyone avatar Jan 12 '24 10:01 Ocraftyone

Finally I had time to test this on Linux (Manjaro) but unfortunately it doesn't work at all. As soon as I click on the corresponding icon, it asks me to either wait or to force quit, but even if I choose "Wait" it crashes.

Just got a chance to test on ubuntu and I am getting a seg fault. I am having trouble building it in my test environment with github codespaces, so I still haven't been able to debug it yet.

Ocraftyone avatar Jan 12 '24 11:01 Ocraftyone

@discip I fixed that linux crash. It was one of the STUPIDEST mistake I have ever made, but its fixed now! 🀦

Ocraftyone avatar Jan 21 '24 00:01 Ocraftyone

@discip I fixed that linux crash. It was one of the STUPIDEST mistake I have ever made, but its fixed now! 🀦

@Ocraftyone People who don't make mistakes never learn anything and are most likely doing nothing. You're doing fine. πŸ‘

tsmith35 avatar Jan 21 '24 20:01 tsmith35

@discip I fixed that linux crash. It was one of the STUPIDEST mistake I have ever made, but its fixed now! 🀦

@Ocraftyone People who don't make mistakes never learn anything and are most likely doing nothing. You're doing fine. πŸ‘

Ain't that the truth!

Ocraftyone avatar Jan 21 '24 20:01 Ocraftyone

@Ocraftyone Sorry for the late answer. πŸ˜…

Indeed, it works now on Linux as well, but I think the color of the text is definitely too dim:

image

Just that. Otherwise: Much appreciated!

discip avatar Jan 22 '24 20:01 discip

@Ocraftyone @SoftFever

Sorry to bother, but unfortunately this issue persists.

the color of the text is definitely too dim:

image

setup
CPU GPU RAM SSD
Ryzen 9 7950X3D XFX 7900 XTX G.Skill Flare X5 32 GB (EXPO I enabled) Samsung 990 Pro 2 TB

discip avatar Jan 27 '24 21:01 discip

@discip I'll take a look when I get a chance. I had meant to before merging but I will try to get a patch together.

Ocraftyone avatar Jan 27 '24 21:01 Ocraftyone

Thank you! πŸ‘πŸ»

I just noticed there are even more cases where the font is to dark: image

image

Maybe there is even more. πŸ€·πŸ»β€β™‚οΈ

discip avatar Jan 27 '24 21:01 discip

@Ocraftyone Have you had time to look into that by any chance?

discip avatar Feb 19 '24 19:02 discip

@Ocraftyone Have you had time to look into that by any chance?

Is the text really that dark on Linux? Is there a light mode or similar available?

tsmith35 avatar Feb 20 '24 22:02 tsmith35