AnimationFreeCAD icon indicating copy to clipboard operation
AnimationFreeCAD copied to clipboard

A FreeCAD fork for PyFlow (since original project is abandoned)

Open luzpaz opened this issue 3 years ago • 54 comments

Maybe it's worth thinking about a fork for PyFlow since it has been abandoned by the original devs https://github.com/wonderworks-software/PyFlow/issues/106 ?

luzpaz avatar Apr 10 '22 16:04 luzpaz

Yes, we agree, we had created our project based on the original PyFlow because the Microelly Node Editor has bugs. This seems to be a good idea, especially since we could add packages like modules to PyFlow.

AndreasCottet avatar Apr 10 '22 16:04 AndreasCottet

It should also be noted that PyFlow is not finished and some features do not work so the software can sometimes bug without reason.

AndreasCottet avatar Apr 10 '22 16:04 AndreasCottet

Indeed.

It would be good to research if there are active forks of PyFlow as well. Did y'all check for that?

luzpaz avatar Apr 10 '22 17:04 luzpaz

Yes, unfortunately there are none

AndreasCottet avatar Apr 10 '22 17:04 AndreasCottet

I know, it is a pain to switch frameworks, but I wonder if you have had a look at Ryven, which is actively maintained and has a very responsive developer?

sphh avatar Apr 10 '22 17:04 sphh

We agree with you. But we haven't tested your module yet and we couldn't see how to create buttons and packages under your module. If these two options are fulfilled then we can do it.

AndreasCottet avatar Apr 12 '22 17:04 AndreasCottet

First I would like to point out, that Ryven is not my module. You have to kudos to the original author.

You certainly can produce packages: https://ryven.org/guide#/?id=programming-nodes

It is also possible to add any Qt widget to the graphical representation of a node: https://ryven.org/guide#/?id=custom-widgets

There is a node with a button included:

  • https://github.com/leon-thomm/Ryven/blob/4d8af8025c88c96dcee6248e38658e3f8a112795/ryven/example_nodes/std/special_nodes.py#L183
  • https://github.com/leon-thomm/Ryven/blob/4d8af8025c88c96dcee6248e38658e3f8a112795/ryven/example_nodes/std/widgets.py#L10

And there is a clock node included, which has a start/stop button:

  • https://github.com/leon-thomm/Ryven/blob/4d8af8025c88c96dcee6248e38658e3f8a112795/ryven/example_nodes/std/special_nodes.py#L275
  • https://github.com/leon-thomm/Ryven/blob/4d8af8025c88c96dcee6248e38658e3f8a112795/ryven/example_nodes/std/widgets.py#L19

Does that suffice or would you need anything else?

sphh avatar Apr 12 '22 21:04 sphh

Please notice the integrated PyFlow is now FreeCAD-tuned with PySide2 dependency instead of Qt.py.

FlachyJoe avatar Apr 12 '22 21:04 FlachyJoe

Good point. I am neither the developer of Ryven, nor a Qt developer. I only know, that I had to install PySide2 to get it working …

sphh avatar Apr 12 '22 21:04 sphh

This weekend we are going to test Ryven and see if it could be suitable for FreeCAD.

AndreasCottet avatar Apr 15 '22 06:04 AndreasCottet

@SHaiZen25, I do not know, how you embed the flow editor into AnimatinFreeCAD, but you might want to use PR https://github.com/leon-thomm/Ryven/pull/96 (that's my involvement with Ryven), because it makes this process configurable. You can also always contact Ryven's author with any question – or me regarding the PR mentioned above.

Good luck!

sphh avatar Apr 15 '22 10:04 sphh

We have tested your module and for the moment we find it difficult to project ourselves in it, so we prefer to stay with PyFlow

AndreasCottet avatar Apr 18 '22 13:04 AndreasCottet

No problem. As I already said, it is not my module. I just thought, it might help.

Out of curiosity, may I ask, what the difficulties were you encountered?

sphh avatar Apr 19 '22 09:04 sphh

As we said, we would like to have this package window containing all the blocks in categories, subcategories, etc. The arrangement of the blocks in the lower left window does not satisfy us. Also there are no buttons available. We also did not understand how to type (e.g. int, string, etc.) a variable. We find that the buttons of the nodes are not very pretty. But your strong point is that the pin values are visible directly and not on a property block. It is much more visible. Concerning getvar, setvar it's a pity not to have a dropdown list with all the variables on the right instead of having to write it. Finally we are less fan of the aesthetics of your module. You should mix PyFlow and Ryven.

AndreasCottet avatar Apr 19 '22 11:04 AndreasCottet

Thanks for taking the time to reply.

Again I want to point out, that I am not the author of this library/module, so it cannot be called my module. I became only involved, because I desperately wanted command line arguments …

I find your insight very interesting:

As we said, we would like to have this package window containing all the blocks in categories, subcategories, etc. The arrangement of the blocks in the lower left window does not satisfy us.

That is exactly how I see it. It would be great, if it would be able to have at least categories. On the other hand, the tag system is really handy to just display a certain category.

Also there are no buttons available.

What do you mean, that there are no buttons available? I was always of the impression, that you could include a button in a node.

Or do you mean toolbar buttons? – That is also something, I am missing.

We also did not understand how to type (e.g. int, string, etc.) a variable.

You can use dtypes

We find that the buttons of the nodes are not very pretty.

You are absolutely right. But how I understand it, you can write your own stylesheet and make everything in the flow window looking like you want it.

I also always use the plain windows style, which is not yet in the main branch, because I do not like the styled windows at all.

Concerning getvar, setvar it's a pity not to have a dropdown list with all the variables on the right instead of having to write it.

Can you please explain that in a bit more detail?

Finally we are less fan of the aesthetics of your module.

You are absolutely right here!! PyFlow looks really pretty. As said previously, I always use the plain window style (coming hopefully in the next release) and one of the nicer flow themes. I believe both can be changed to your liking with stylesheets, which you can adapt yourself.

You should mix PyFlow and Ryven.

Absolutely!

Myself, I was looking for a flow based ‘programming’ interface and first found VisTrail. When that stopped to be supported, I found PyFlow. Unfortunately this was also not maintained anymore, so I switched to Ryven. It would be really great, if those two packages could be merged!

sphh avatar Apr 19 '22 12:04 sphh

Hello, excuse me for responding so long after the fact. I meant a toolbar for buttons.

Regarding types, I don't know if we are talking about the same thing but basically allowing the user to use types. For example in freecad, there is the object type. This will reduce the error cases to be made in the code. In addition, it would help the user to understand what he can assign to this variable

When using a setVar or getVar block we must provide it with a variable name to be written in string. If we offer the user only the variables he has created he cannot make mistakes in the get or set var

Translated with www.DeepL.com/Translator (free version)

AndreasCottet avatar Apr 26 '22 11:04 AndreasCottet

Thanks for taking your time!

Regarding types, I don't know if we are talking about the same thing but basically allowing the user to use types. For example in freecad, there is the object type. This will reduce the error cases to be made in the code. In addition, it would help the user to understand what he can assign to this variable

If I understand your correctly, you want to restrict the connection to the input of a node to a certain type, e.g. the user cannot connect a float output to a FreeCAD object type input?

Well, I can see the point here. On the other hand this is controversy to Python's ducktyping philosophy. Honestly, I do not know, which approach is better! (Which makes it a classical candidate for a configuration option.)

When using a setVar or getVar block we must provide it with a variable name to be written in string. If we offer the user only the variables he has created he cannot make mistakes in the get or set var

I think, that is a valid point and an issue should be opened!

sphh avatar May 02 '22 10:05 sphh

looks like PyFlow is active again?

luzpaz avatar Jul 21 '22 20:07 luzpaz

@j8sr0230 are you planning on consolidating your changes to AnimationWB and PyFlow?

luzpaz avatar Jul 21 '22 21:07 luzpaz

@luzpaz I would be happy to contribute. So far, I have only fixed a few bugs that I noticed while using PyFlow. In parallel, I am working on FreeCAD nodes for modeling (cf. Grasshopper or Sverchok). I'm not sure if it makes sense to revive the PyFlow repository (my pull request apparently fizzled out), or if it's time for a higher-level community-driven FreeCAD node repository with a FreeCAD version of PyFlow. What are your thoughts on this? By the way, many thanks to the excellent preliminary work from the developers of the AnimationFreeCAD-WB and microelly2!

j8sr0230 avatar Jul 22 '22 13:07 j8sr0230

May I jump in here again: As you know, I had big hopes for Ryven, mainly because it looked to be actively maintained. So I made some pull requests, but in the end the original author went quiet for a long time and unfortunately some copyright issues are still not resolved. So I had a fresh look at PyFlow despite being unmaintained. Nevertheless I implemented some changes, such as:

  • command line parameters + killing PyFlow with Ctrl+C
  • high DPI scaling (this one is a PR already)
  • plain theme + splitting of UI and graph themes
  • better (I hope so) templating for stylesheets
  • reworked configuration system
  • bug fix to watch pin
  • tooltips added
  • proper temporary files
  • improved wizard to create packages
  • and all PRs from main repository and selected changes from some forks

I am currently working on the ability to enter a pin's value directly in the node instead of opening the Properties toolbox and editing the value there. (I plan to include @luzpaz PR after I have finished this.)

These changes are not published yet, because I am not yet sure how to proceed:

  • Make PR's to the main repository? (Will they ever be merged?)
  • Starting my own repository? (Will I have the time to properly maintain it, because of PyFlow's complexity?)
  • Joining forces to make a community maintained repository? (That would actually be my preferred solution)

If AnimationFreeCAD relies on the PyFlow framework, it might be a good idea to set up a common repository (I would suggest codeberg.org, which I use for some other projects – I could do the administrative work). What do you think?

sphh avatar Jul 22 '22 14:07 sphh

This is great..looks like things are coalescing around PyFlow for FreeCAD. Thank you to all the devs that have contributed their time.

If AnimationFreeCAD relies on the PyFlow framework, it might be a good idea to set up a common repository (I would suggest codeberg.org, which I use for some other projects – I could do the administrative work). What do you think?

@sphh can we have a mirror on github as well that accepts PRs ? Issues + PRs can also be managed on codeberg simultaneously?

luzpaz avatar Jul 22 '22 14:07 luzpaz

I believe it's possible to mirror repositories between github/gitlab/codeberg/… I myself prefer codeberg, because of privacy issues with the other servers.

sphh avatar Jul 22 '22 15:07 sphh

Do we want to start with the original PyFlow or with the AnimationFreeCADWB?

j8sr0230 avatar Jul 22 '22 15:07 j8sr0230

Good point! Both have quite a lot of commits, so I would expect quite some manual merging :confounded:

What are the main changes/addition of the AnimationFreeCADWB compared to the original PyFlow?

sphh avatar Jul 22 '22 15:07 sphh

As far as I can see, the AnimationFreeCAD WB uses the original PyFlow, at least I find the same errors e.g. regarding the Drop On Wire functionality. All additional nodes and functions belong to the animation package. In my opinion we could use the original PyFlow as a starting point.

j8sr0230 avatar Jul 22 '22 16:07 j8sr0230

In my opinion we could use the original PyFlow as a starting point.

This makes sense to me

luzpaz avatar Jul 22 '22 16:07 luzpaz

Ah, if the only commits are related to the animation package, then it should be easy: Starting with the original PyFlow both of us could commit our changes without interfering! That would be easy.

sphh avatar Jul 22 '22 16:07 sphh

So I continued my work in my fork of the original PyFlow, so I can shoot everything upstream when we have a collaborative repo?

j8sr0230 avatar Jul 23 '22 08:07 j8sr0230

Yes, that is the idea!

It is also always possible to mirror it to this repository.

sphh avatar Jul 23 '22 11:07 sphh