CANopenNode / CANopenEditor

CANopen Object Dictionary Editor
GNU General Public License v3.0
120 stars 60 forks source link

Allow instantly saving changes upon object change #44

Closed uniederer closed 9 months ago

uniederer commented 1 year ago

When editing larger profiles, annoyingly you always have to click "save" prior changing the (sub-)object. While the software detects changes and asks the user whether to lose the changes or not, it does not provide any possibility to simply say "yes, i want to keep the changes, but now let me switch the object".

This patch changes adds this missing third option to the dialog. It also adds a checkbox allowing to suppress the dialog and automatically save changes upon object change to speed up editing.

Remark: I have no idea, why so many lines show up changed in this merge, looking at the diffs on my cloned repository, there are only a few lines that are actually changed, even with white-space comparison.

trojanobelix commented 1 year ago

Thanks for contributing. I have merged it in the feature branch._ The text "save changes" checkbox might be renamed to "Always save" and/or get a Tooltip . Save button can be smaller if more space needed for text. Just my 2ct.

uniederer commented 1 year ago

Ah, I should have PRed to the feature branch. Sorry, I have to admit, I didn't do much research on which branch to target prior creating the PR and just sticked to my main behaviour. Mea culpa.

As for the checkbox: Sure, feel free to rename it as you like. I just thought it might be worth adding. I also was considering to move that behaviour setting to the settings dialog, but I was a bit short in time today, so I picked the more straight forward and obvious approach. In a perfect world we would probably bring up a custom dialog once and add a "remember my decision"-checkbox to it... what do you think?

trojanobelix commented 1 year ago

With the branch, I always decide spontaneously whether it should be in the feature or the bugfix branch. I have only recently created the two branches. I am also new here as a contributor. Therefore: No problem at all!

Yes, I also thought about whether it would be better in the settings dialogue. But that is too "far away" for me. I would also prefer the "Remember my decision" dialogue when saving for the first time. If you have time and feel like it: Feel free to implement it that way!

trojanobelix commented 1 year ago

I noticed that after changing an object and selecting another object from the list, the selected object is selected. Although you have pressed "Cancel".

So just not: "Cancel = Go back and stay on the object". In fact it seems to be the same as "Yes". The selected object is changed and the changes are lost

Tested with your 813788a66d77c5bdd909cd188fa000a16b35bfc1, bugfix is ahead

Can you reproduce and sent a bugfix PR in the bugfix release?