Upstreaming Python based UX functionality to FreeCAD

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Upstreaming Python based UX functionality to FreeCAD

Post by triplus »

I created some UX related modules/functionality for FreeCAD in the past. Occasionally i get asked if upstreaming the work done will be done at some point in the future. I am currently in transition phase where this pieces of functionality are ironed out, code simplification is being pursued and missing pieces of functionality are being added based on the user feedback gathered in the past. Once that process will be done i am guessing up to 10 standalone UX related pieces of functionalities will be the result. Things like NavigationIndicator, PieMenu, ShortCuts ...

Now as for the original question. This pieces of functionality (once finished from my point of view) can continue to have a place on my GitHub or they can in addition be upstreamed to FreeCAD. If upstreamed i see 2 possibilities.

1.) Upstream individual piece of functionality as an individual module:

Likely slightly easier to maintain as everything is basically included in a self contained module. Code duplication is possible and module count inflation would happen.

2.) Creating a single new UX related module with some name and put everything in there:

In FreeCAD terms this comes down to UX related module/workbench. But instead of listed in workbench selector it provides UX related commands/functionality. Likely slightly harder to maintain and to figure out (other developers) due to code de-duplication. As changing one function can affect multiple pieces of functionality.

This can serve as a reference piece of functionality. As only some further UI related work is needed to finish the work:

https://github.com/triplus/NavigationIndicator

Opinions?
User avatar
agryson
Posts: 463
Joined: Wed Nov 23, 2016 8:30 am
Location: Bordeaux, France
Contact:

Re: Upstreaming Python based UX functionality to FreeCAD

Post by agryson »

triplus wrote:Upstream individual piece of functionality as an individual module:
My instinct would be to go with this option - keep modules mapped to functionality.

But this seems to be a software architecture question better answered by a more experienced dev than me.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Upstreaming Python based UX functionality to FreeCAD

Post by triplus »

I did some further tests and i am now leaning towards the idea of creating a new single module with some arbitrary name. As for example having NavigationIndicator.py, PieMenu.py (PieMenuGui.py)... in it should work out OK. Mixing code functionality won't happen beyond some basic functions like getting workbench icon or unique commands and things like that. Where it makes sense to do it in that way instead of duplicating the code.

Therefore the main question is does anybody have any objections to upstream some UX work i have done in the past in such way in the future?

P.S. And any other suggestions and thoughts are welcomed.
User avatar
agryson
Posts: 463
Joined: Wed Nov 23, 2016 8:30 am
Location: Bordeaux, France
Contact:

Re: Upstreaming Python based UX functionality to FreeCAD

Post by agryson »

Do you mean putting it in /src/Gui ?
Given the generic (applies to all workbenches) nature of your projects, that seems to make some sense to me. (Though as I said I'm no expert on software architecture)
User avatar
kkremitzki
Veteran
Posts: 2517
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Upstreaming Python based UX functionality to FreeCAD

Post by kkremitzki »

I just made a PR on FreeCAD/FreeCAD-addons here to add NavigationIndicator "workbench" to the addon manager. Assuming that tool will be included in master soon, it's a good way to make it easy and optional for people to install. I tested it and it worked great!
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Upstreaming Python based UX functionality to FreeCAD

Post by triplus »

kkremitzki wrote:I just made a PR on FreeCAD/FreeCAD-addons here to add NavigationIndicator "workbench" to the addon manager. Assuming that tool will be included in master soon, it's a good way to make it easy and optional for people to install. I tested it and it worked great!
Thanks for testing.

If navigation indicator module will be upstreamed i will likely make the one on my GitHub to support FreeCAD 0.16 only. Therefore it won't start in FreeCAD 0.17 if installed manually and the default one should start instead. Indeed it can always be installed from my GitHub but some users expressed the desire for such UX functionality to be provided by default in FreeCAD. And in the past the same question was asked for some other modules. All in all things happened and i said i will ask for more feedback and will think about the possible strategy and provide one for upstreming the work. That is what this thread is about.
agryson wrote:Do you mean putting it in /src/Gui ?
Given the generic (applies to all workbenches) nature of your projects, that seems to make some sense to me. (Though as I said I'm no expert on software architecture)
The place is src/Mod/ and in it a list of FreeCAD modules can be located:

https://github.com/FreeCAD/FreeCAD/tree/master/src/Mod

If there won't be any objections i will add a new module in it and the module will contain some Python based UX related functionality for FreeCAD. Like for example mentioned navigation indicator. And that i guess should be it.
User avatar
agryson
Posts: 463
Joined: Wed Nov 23, 2016 8:30 am
Location: Bordeaux, France
Contact:

Re: Upstreaming Python based UX functionality to FreeCAD

Post by agryson »

triplus wrote:The place is src/Mod/ and in it a list of FreeCAD modules can be located
OK, looking forward to pulling!
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Upstreaming Python based UX functionality to FreeCAD

Post by bejant »

triplus wrote:Things like NavigationIndicator, PieMenu, ShortCuts ...
My first thought was that many of these should be Preferences that each individual user could enable.

IMO Navigation Indicator in particular should be in master (with default = On).
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: Upstreaming Python based UX functionality to FreeCAD

Post by cox »

bejant wrote:IMO Navigation Indicator in particular should be in master (with default = On).
+1
Need help? Feel free to ask, but please read the guidelines first
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Upstreaming Python based UX functionality to FreeCAD

Post by triplus »

OK therefore when the work will be finished i will test the waters with the navigation indicator.

P.S. Providing choice to use something or not to use it makes sense. I will try to achieve and provide to user the ability to do that in a straightforward fashion!
Post Reply