-
Notifications
You must be signed in to change notification settings - Fork 34
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
FABulous API #150
Comments
I am currently working on a project that would benefit of the programmatic generation of fabrics. Therefore, I would like to work on these points. But first I wanted to ask for your feedback :) |
Since most of the things you want to do are related to generation, I recommend you look at the |
Great to hear that an API for FABulous is something that is wanted! Thanks for all the feedback, I'll try to get started on these points. Once I have some results, I'll open a PR so everyone can view and comment on it. |
Just for your information, I have currently paused work on this, but I will soon pick it up again in a month or two as I'm going to need this for my masters thesis ✌️ |
It would be great if FABulous could be used directly from a Python script to programmatically generate fabrics in different sizes/configurations. I know there is the option to load a tcl script, but I think this would allow for more functionality.
It seems like the framework is actually fairly well separated from the CLI. Still, there are some changes I would suggest to make the usage from a Python context easier/smoother.
Separate the CLI and the
FABulous
class into two filesPass fabric description as a Python variable
The fabric description should be passed to
FABulous
as a Python variable, e.g a dictionary. The CLI can still readfabric.csv
, but has to convert it first before passing it on toFABulous
. This allows the generation of variable sized fabrics without having to write afabric.csv
each time.I think Separate Fabric and Tile description #149 would help here.
Move some functions from CLI to
FABulous
For example
do_gen_tile
/do_gen_all_tile
is a rather large function that should be moved toFABulous
. This function is used in the CLI and is also be needed when building the fabric programmatically, thus preventing code duplicationCreate a tile manager class and separate it from
FABulous
Since tiles are mostly independent of the fabric and can be used by multiple fabrics, I think it might make sense to move the tile management to a separate class.
Imagine you want like to programmatically generate differently sized fabrics that uses the same tiles. Currently, you would create three times a
FABulous
object pointing to the same tiles. The firstFABulous
object generates the tiles and writes the fabric. The other twoFABulous
objects only write the fabric without regenerating the tiles.With this approach, one tile manager would be created that generates the tiles. This tile manager is passed on to the three
FABulous
objects, generating three differently sized fabrics.Document the API usage
Provide an example of how to use the API and generate a fabric programmatically.
The text was updated successfully, but these errors were encountered: