Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port EditGCodeDialog from PrusaSlicer #3417

Merged
merged 47 commits into from
Jan 24, 2024

Conversation

Ocraftyone
Copy link
Contributor

@Ocraftyone Ocraftyone commented Jan 1, 2024

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 8770c4b 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:

  • Make sure all linux fixes have been applied
  • 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 and others added 25 commits January 1, 2024 10:57
Only current issue is that the grabber for the resizeable window is currently white (ongoing issue for Orca)

Original Commit: prusa3d/PrusaSlicer@a8307bf

Co-authored-by: YuSanka <[email protected]>
+ GUI_App : Fixed update of the dark mode, when DataViewCtrl doesn't have header
-Orca: currently doesn't seem to display dataview labels properly. TBD if it continues to be an issue.

Original Commit: prusa3d/PrusaSlicer@c577b7f

Co-authored-by: YuSanka <[email protected]>
Included pre-generated files specific to Orca rather than PS provided files

Original Commit: prusa3d/PrusaSlicer@55d5921

Co-authored-by: YuSanka <[email protected]>
Orca: Added option to use CMake config option ORCA_CHECK_GCODE_PLACEHOLDERS to check custom gcode placeholders rather than using debug

Original Commit: prusa3d/PrusaSlicer@b8bb7f2

Co-authored-by: YuSanka <[email protected]>
Original Commit: prusa3d/PrusaSlicer@7efdbec

Co-authored-by: Lukas Matena <[email protected]>
Original Commit: prusa3d/PrusaSlicer@361ef22

Co-authored-by: YuSanka <[email protected]>
Add new icons from PS and update to use Orca color scheme

Original Commit: prusa3d/PrusaSlicer@37afe79

Co-authored-by: YuSanka <[email protected]>
Also organized and added missing options to `s_CustomGcodeSpecificPlaceholders`
Dialog now shows all issues within the same dialog

If a custom gcode value is not specified within the config, a testing value is added. This ensures that (most) of the custom gcode is parsed, and thus checked against the definitions.
# Conflicts:
#	src/slic3r/GUI/OG_CustomCtrl.cpp
#	src/slic3r/GUI/OG_CustomCtrl.hpp
This should be reverted when wxWidgets 3.2.1 is re-implemented
make sure that the local copy of the config is being used when checking if there is custom gcode otherwise it would be possible it doesn't get run during testing
@Ocraftyone
Copy link
Contributor Author

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 Ocraftyone marked this pull request as draft January 1, 2024 16:02
@tsmith35
Copy link
Contributor

tsmith35 commented Jan 2, 2024

@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

@discip
Copy link
Contributor

discip commented Jan 11, 2024

@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

@igiannakas
Copy link
Contributor

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

UI wise on an M1 Pro MacBook Pro

Screen.Recording.2024-01-12.at.12.13.21.mov

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.

@Ocraftyone
Copy link
Contributor Author

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

@igiannakas
Copy link
Contributor

@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.

@Ocraftyone
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@@ -373,22 +373,31 @@ void OG_CustomCtrl::OnMotion(wxMouseEvent& event)
break;
}

for (size_t opt_idx = 0; opt_idx < line.rects_undo_icon.size(); opt_idx++)
size_t undo_icons_cnt = line.rects_undo_icon.size();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curiously, what are these changes for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe a lot of it is a refactor. Rather than having multiple loops, it is a single loop that handles all cases

@@ -41,7 +41,120 @@ wxString double_to_string(double const value, const int max_precision = 4);
wxString get_thumbnail_string(const Vec2d& value);
wxString get_thumbnails_string(const std::vector<Vec2d>& values);

class Field {
class UndoValueUIManager
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just trying to understand here: if I'm not wrong, this micro refactoring is not directly related to the EditGCodeDialog, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the commits from PS, it was a refactoring done in preparation for the dialog. It is still fully compatible. The EditUIManager IS directly related.


inline Line* get_line(const t_config_option_key& id) {
for (Line& line : m_lines)
if (line.has_only_option(id))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we is_separator() too?
I can't recall the exact causes why I added that check. I remember there were crashes caused by separators

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill look back into the commit it was added and get back to you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit is from the implementation of internal bridge speed. I didn't get any crashes, but that doesn't mean much. I am kinda leaning towards just going back the the original BBL function...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehehe, that change was introduced by myself.
It was crashing when a separator line was added

@Ocraftyone
Copy link
Contributor Author

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

@tsmith35
Copy link
Contributor

tsmith35 commented Jan 21, 2024

@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. 👍

@Ocraftyone
Copy link
Contributor Author

@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!

@discip
Copy link
Contributor

discip commented Jan 22, 2024

@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!

Copy link
Owner

@SoftFever SoftFever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work!
Thank you very much

@SoftFever SoftFever merged commit 5ff00fb into SoftFever:main Jan 24, 2024
12 checks passed
@Ocraftyone Ocraftyone deleted the enh-port-edit-gcode-dlg branch January 24, 2024 16:36
@discip
Copy link
Contributor

discip commented Jan 27, 2024

@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

@Ocraftyone
Copy link
Contributor Author

@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.

@discip
Copy link
Contributor

discip commented Jan 27, 2024

Thank you! 👍🏻

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

image

Maybe there is even more. 🤷🏻‍♂️

@discip
Copy link
Contributor

discip commented Feb 19, 2024

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

@tsmith35
Copy link
Contributor

tsmith35 commented Feb 20, 2024

@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?

@discip
Copy link
Contributor

discip commented Feb 20, 2024

This is a screenshot. 😆
It shows what I see on my machine. 😊

In the linux version there is no option to choose from.

@discip discip mentioned this pull request Apr 4, 2024
@jamincollins jamincollins mentioned this pull request Apr 5, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants