Skip to content
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

Example images code #197

Open
OceanWolf opened this issue Dec 6, 2020 · 7 comments
Open

Example images code #197

OceanWolf opened this issue Dec 6, 2020 · 7 comments

Comments

@OceanWolf
Copy link

Maybe this exists as a stupid question because I don't know how the docs get built...

I notice that some of the doc pages have images as examples, and so I was wondering if the code used to create that example could go on the doc page as well. I don't know where the images come from, if they get auto-generated from code, but if so, then I thin it makes sense to put the code there as well, whether by clicking on the image, or just having it next to it, or something.

@lazka
Copy link
Member

lazka commented Dec 6, 2020

@OceanWolf
Copy link
Author

Damn it! I was hoping the image generation was done on your end. Okay, I guess I will file a bug with Gnome... :)

@OceanWolf
Copy link
Author

Okay, I think I closed this issue a bit prematurely. I have just been doing some digging on how to make a file an issue with Gnome, discovered it was all on GitLab, and so that allowed to me to do some digging which led me to this file which appears to contain the code to create the example graphics.

https://gitlab.gnome.org/GNOME/gtk/-/blob/master/docs/tools/widgets.c

The code looks fairly straightforward to pass for individual code snippets as the snippets take the form of:

static WidgetInfo * create_<widget_name> (void)
{
...
}

where <widget_name> is the name of the widget that it creates but with a CamelCase widget name rewritten as camel_case for the function name.

Could the doc build script check this file for the example code when it incorporates the example image into the example section?

@OceanWolf OceanWolf reopened this Dec 6, 2020
@lazka
Copy link
Member

lazka commented Dec 6, 2020

I think that's a bit out of scope for this project.

Also it would be C code, and we generate docs for Python

@OceanWolf
Copy link
Author

Fair enough, I thought you might have some translation code in the project to rewrite the basic C code as python.

Should i contact Gnome and see about them including the C code on their docs page. While I don't like C, others might find it helpful. It seems silly to have the code their in the repository and not include it in their docs.

@lazka
Copy link
Member

lazka commented Dec 6, 2020

Can't hurt to ask I guess.

We have extra docs which go into actually using the API, like https://python-gtk-3-tutorial.readthedocs.io/en/latest/

@OceanWolf
Copy link
Author

Yes, I went back to that last night! I love your docs as I find them so easy to read.

I got stuck with ListBoxes as they seem easier to use for a very simple GUI when you have your own complicated python model class structure built up, but I couldn't figure out how they made that nice header for the ListBox example. Looking at the example code creator it turns out they cheated by using a button as the first entry in the list. Grrr. I think it will works nicely, just a shame that such a nice thing wasn't documented and took me a while to exhaust my ideas.

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

No branches or pull requests

2 participants