Skip to content

Add preferences page #65

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

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft

Add preferences page #65

wants to merge 18 commits into from

Conversation

greg19
Copy link
Contributor

@greg19 greg19 commented Feb 6, 2025

This closes #19.

image

This is currently a proof of concept and does not have any effect on the workbench. The main idea is for this to replace most of const.py file. As I saw some significant changes to this file in #55, I suggest we move forward with the preferences page after it is merged. We can then discuss what should be the content, shape and wording of the preferences page(s). I will also go ahead and use the actual values in the source code.

Developing

Full instructions on how to add preferences page can be found here.

The .ui file

The ui/preferences.ui file contains the appearance of the preference page and can be opened in Qt Widgets Designer. It uses custom widgets (think "boxes") distributed with FreeCAD. In order for them to appear in the Designer, one needs to compile and install the FreeCAD plugin for the Designer. There are instructions for Linux and Windows.

@Stu142
Copy link
Owner

Stu142 commented Feb 6, 2025

This is very cool. I assume these settings would save between sessions?

This might offer the ability to hide some properties from view in the objects that are rarely adjusted if they can be changed here. It feels a bit crowded in the bin properties at the moment.

I am nearly done with #55. It is fully functional, and I just have to clean things up a bit.

@greg19
Copy link
Contributor Author

greg19 commented Feb 6, 2025

Yes, the preferences are saved between sessions.

@kinghat
Copy link

kinghat commented Feb 6, 2025

does saving between sessions mean per document or object? i would say most peoples grids would be the standard 42x42 but if you have independent grid sizes for some, changing that setting globally would feel weird vs changing it locally(nearest the actual object).

@Stu142
Copy link
Owner

Stu142 commented Feb 6, 2025

@kinghat This would just set the default values for generation, it would still be a property of the gridfinity object once generated as it is now and you could change it to how you want. By per session I meant that if you adjusted these defaults and closed freeCAD they would remain the same next time. Once a bin is generated they would have no effect, such as opening a saved bin.

What I meant by removing properties was things such as the label shelf dimensions or bin base profile dimenisons. things that 99% of people would never touch but if they did want to could adjust them in this settings page. Anything that is something I expect someone to want to change would remain in the properties where it is easily adjustable for each bin or baseplate.

@greg19
Copy link
Contributor Author

greg19 commented Feb 7, 2025

This might offer the ability to hide some properties from view in the objects that are rarely adjusted if they can be changed here. It feels a bit crowded in the bin properties at the moment.

I don't think having some parameters customizable only in preferences page is a good idea. In that case when someone would want to create a single different bin with these changed, they would need to go to the preferences, change them, create the bin, and go to the preferences again to change them back to what they use normally. This is a bad workflow in terms of UX. "Preferences" are meant for the user to set how they "prefer" for the application to behave – not to operate on CAD objects. They should be set once and forgotten, unless what the user "prefers" change.

However, I agree that the reduction of the number of parameters would be beneficial. Maybe there could be a checkbox "show complex parameters" or something like this, and less used parameters would appear in the panel only when it is checked? I don't know how this could be implemented though.

@greg19
Copy link
Contributor Author

greg19 commented Feb 12, 2025

I ported all constants to preferences pages and grouped them how it made sense for me. It should defeneatly be improved, main areas could be:

  • Drawings
  • Labels (I pretty much blindly copied the varaibles names, some of them do not even make sense to me)
  • Having preferences be more in a spirit of "what the user desires" not as value holders – I think mostly default object values are akward in this area (but when included in a separate page not that bad, maybe they could be kept).
  • Hiding some of them as constants again

I think drawings would be really helpful (I included an example to show how including an image works). Maybe we could reuse somethink from Gridfinity-Documentation? I personally am not skilled in this area.

I also created a script to translate .ui files to python code. It also comes with a GitHub workflow to make sure the generated code is up to date with these files. I know this is a complex approach, but it is nice to have the parameters checked by the IDE. I tried my best to make the script as user friendly as possible. If you have any ideas on how to improve it I'd be happy to implement them.

@Stu142
Copy link
Owner

Stu142 commented Feb 16, 2025

These changes sound great and having a drawing next to some of the more confusing parameters would be a big benefit to users. Some of the names I admittedly did not think very hard about.

I am traveling until the end of the week but I have seen some other cool PRs rolling in and will take a look when I get back.

@Stu142
Copy link
Owner

Stu142 commented Feb 22, 2025

These changes look good.

  • I can help with drawings, and that would be an amazing way to add clarity to the names if it was right there. If you put something in as a placeholder like a snapshot from the Gridfinity Documentation I could potentially replace it with something more tailored.
  • Drawings would already help the labeling problem. This is an area where I am not very creative but it there are specific labels that are very confusing I am open to changing it for sure.

For sorting parameters is submenus potentially something like this

  • Individual object defaults

    • Bin defaults (width, height, stacking lip on , magnet holes on)
    • parts bin
    • eco bin
    • blank bin
    • magnet baseplate
    • screw baseplate
    • L shaped default units ( x1, x2, y1, y2)
  • Individual Feature Defaults

    • Magnet and Screw Holes
    • Label Shelf
    • dividers
  • Gridfinity Standard (unlikely for user to change to keep compatibility)

    • Text warning that changing values might break compatibility
    • Grid Size
    • Grid height (name Height Unit instead)
    • clearance
    • bin base
    • stacking lip dimensions
    • baseplate dimensions
    • Global (bin outer radius, and magnet hold distance from edge)
  • Printer Values

    • Sequential Bridging height

This creates a separation from what is the gridfinity standard for compatibility and what simply user preference.

There could potentially be a further breakdown between advanced and simple properties.

I also created a script to translate .ui files to python code. It also comes with a GitHub workflow to make sure the generated code is up to date with these files. I know this is a complex approach, but it is nice to have the parameters checked by the IDE. I tried my best to make the script as user friendly as possible. If you have any ideas on how to improve it I'd be happy to implement them.

My knowledge in this area is just about zero so I will not be much help here.

@greg19
Copy link
Contributor Author

greg19 commented Feb 27, 2025

I have added the placeholder images. I thought that the values that are on the drawings could be named just $l_1, l_2, \ldots$ (for lengths), $r_1, r_2, \ldots$ (for radii), etc. – it will be easier to fit them on the drawing (with the limited space that there is) and match them to values (shorter names are easier to pattern match).

I also rearranged the parameters in the way you suggested, please double check if everything is in its proper place (especially if all standard-breaking parameters are in Standard page, and nothing that doesn't break compatibility is there).

@Stu142
Copy link
Owner

Stu142 commented Mar 18, 2025

I spent some time playing around with what these images might look like. Is this along the lines of what you were thinking.
image

Needs some work with scaling and readability but I think the general idea is there.

My process was freeCAD tech draw > export as SVG > open in Inkscape> export as PGN
I don't know if this is ideal but seems to work fine.

I also think it might be good to also include the actual property name so it is relatable to what the property is called in the bin properties as well. Something similar to this:

l1 = Label Shelf Width = 12 mm

@greg19
Copy link
Contributor Author

greg19 commented Mar 18, 2025

Yes, it's really good!

Now that I look at it, I agree that a property name is a good idea, I will add it back in a free time.

@Stu142
Copy link
Owner

Stu142 commented Mar 18, 2025

No rush it will take a while to put these together, I could probably do it as well if needed.

@greg19
Copy link
Contributor Author

greg19 commented Apr 21, 2025

I added the names. By the way, you can check if it's possible to use SVGs directly in the .ui. It would be better looking and easier to edit.

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.

Add a way to set default parameters
3 participants