Ok, Let's go for javascript highlighting.
In my mind, a simple copy/paste of the python code to an html page is > enough. regexp are certainly very powerful, but I never understood anything > and am completely unable to read regexp python code! The solution must be > easy to use and, most important, be robust since the samples often change > (new ones, deleted deprecated ones, modifications etc.). To be pragmatic, > here is what I want: > - a script, for instance 'convert_samples_to_html.py' that I launch once, > - the script finds all the .py files in the /src/samples/* directory, > - run each sample to get the screenshot, > - create one html page for each sample, > After thinking of it a little I realized things are not always that simple. Indeed some samples (don't know how many) don't fit. Indeed those scripts (like geometry_demo.py) illustrate many capabilities. Thus they are based on a GUI with menus which call a specific function (associated with a given capability). Therefore, there are many screenshots to take, and it's not possible to get them by simply importing the sample. > - at the end, a kind of 'index.html' shows all the available samples with > hyperlinks to each one. > Ok. After a few experiments, the off-screen rendering feature seems not > available for OCC (see this thread on the OCC forum: > http://www.opencascade.org/org/forum/thread_17706/). But I'm still waiting > for other advices that may help. > I think that on Linux, one can use virtual X servers (Xvfb) to hijack offscreen rendering. I never tried it myself, but here is an example http://semicomplete.com/blog/geekery/xvfb-firefox.html. But obviously, this is not the perfect solution. > As a consequence, the sample window has to be displayed. Getting the > screenshot from the sample can be done from a ipython session (which is wx > thread safe). You can for instance: > ipython -wthread > >> import sample > >> sample.start_display() > >>sample.display.View.Dump("the_file") > > I can be done from a pipe. > I tried this and it works (a part from the fact that I can only dump xwd files). Of course, this is can't be used directly in a scripts. How do you intend to use pipe exactly? Loïc
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users