Sphinxed Phoenix documentation

Hi All,

    as a (possibly early) Christmas present, I would like to offer you
the very first, *very* pre-alpha version of the Phoenix documentation.
For those of you who don't know what Phoenix is, it is simply the code
name for the new version of wxPython.

The documentation is built using Sphinx, in a completely automated way
through Python scripts parsing the Doxygen-generated XML help files
for wxWidgets, properly "Pythonized" by Robin's/Kevin's utilities
before being parsed and ReST-ified by my routines.

A few notes before diving into the docs:

1) The docs are incomplete, the pure-Python classes and functions in
the main wx namespace (like wx.CallAfter, wx.FrozenWindow etc...) are
still missing;
2) The only wxWidgets "sub-package" that has been ported to Phoenix is
wx.dataview, so you won't find the docs for wx.grid, wx.html and
friends;
3) There is no modules index and the gallery page contains the AGW
stuff (I'll fix that soon).

Regardless of the immense hostility of the Doxygen docstrings, I
managed to build everything with Sphinx with only 15 warnings. I have
uploaded the latest revision of the docs here:

http://xoomer.virgilio.it/infinity77/Phoenix/main.html

Please peruse it and report back any issue you may find. The
documentation is not perfect and it may still seem a bit C++ish, and
there are complications in properly handling XML tags containing
description and C++ code together (oh boy...) and other difficulties.
There are a couple of examples where things went seriously bad, like
the FindWindowByName function here:

http://xoomer.virgilio.it/infinity77/Phoenix/functions.html#FindWindowByName

Where the function description starts at the middle of a sentence.
This is just because the C++/XML docstrings are f****d up (in this
case, they put the function description inside the deprecated tag tail
(!!!)). See the @Robin for various other issues.

What remains to be done:

- Add the pure-Python classes, methods and functions (i.e., wx.CallAfter);

- Find a way to link snippets of code to (almost) every class. I could
relatively easily do that by grabbing the code from the wxPython demo
and pasting it inside the Sphinx doc, but some of the demos are
relatively big (8-10 kb) so it may be too much to display in an inline
code snippet. However, the same code snippet coule be made available
via the :download: field list of Sphinx as a separate, downloadable
file;

- Link the documentation to the wxPython Wiki. We may need a web
crawler or some sort of index of the Wiki pages, in order to be able
to map Wiki pages against class names. I am open to any idea in this
sense;

- Add wx.lib and the various other pure-Python third party libraries.
This is relatively easier as we can directly use the :autodoc: feature
of Sphinx instead of parsing XML (oh boy**2).

@Robin:

- The generators/extractors contain stuff related also to
globals/defines (GlobalVarDef and DefineDef classes). These contain
mostly the wx.UPPERCASE_SOMETHING, without a value and without a
description. Should we include them somewhere? Where? What is the
point if there is no description?

- Stuff like the wxWidgets "overviews" documentation is very hard to
convert to something sensible for Python users, as they are full of
C++ code. What should we do with that? At the moment I am simply
skipping those docs;

- I don't think there is anything we can do, but very, very often the
wxWidgets docs contain the function/method parameter description
*inside* the function/method description text. Nononono, parameter
descriptions should go in their nicely assigned <parameterlist> /
<parametername> tags. The current wxWidgets approach is a terrible way
to document function/method parameters;

- Some of the XML docstrings are seriously f****d up, i.e. lists split
into many paragraphs (!) and descriptions inside xrefsect tags.
Should I submit documentation bug reports for that? (it's a joke, of
course);

- Is there any other way you may be able to output the pure-Python
stuff from the extractors/generators? Something like (class name,
class docstrings, [methods], [methods docstrings]) instead of the full
source code for wx.CallLater and wx.PySimpleApp? I am specifically
talking about the generatePyCode method.

I am surely forgetting something at the moment but I'll write to you
privately if anything comes to my mind.

Enjoy, wxPython rules.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

import PyQt4.QtGui

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui

import pygtk

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk

···

import wx

Wow! It's looking very awesome Andrea! (I especially like the Phoenix image you used, I may have to steal that for use on the Phoenix wiki pages :wink: )

I'll take a closer look later today at the docs and the issues you raise and get back to you with my thoughts.

···

On 12/13/11 12:09 PM, Andrea Gavana wrote:

Hi All,

     as a (possibly early) Christmas present, I would like to offer you
the very first, *very* pre-alpha version of the Phoenix documentation.

--
Robin Dunn
Software Craftsman

Hi Andrea,

...

http://xoomer.virgilio.it/infinity77/Phoenix/main.html

How many hours do you have per day, 48, 96;-) ?

Even as Alpha it looks already very good!

I would only like to see one change, have the "search" easier accessible, currently it is in the left side bar. I much more like the theme (with the exception of the colors) on the TurboGear docs.

- the search at the top, and always accessible
- left sidebar can be shrunk and it stays in view

http://www.turbogears.org/2.1/docs/gettingstarted.html#getting-started

I also have a question, how are you doing the "Property summary", i.e. how do you detect it is a property and get to the "get/set" stuff and do the "see also"? I guess you generate the .rst using "autodoc" stuff and then adding these references, but I don't see how one detects if something is a property and how one gets the "get" or "set" reference.

I am trying to generate a Sphinx doc for some of my stuff and would like to include things like this too.

Werner

···

On 12/13/2011 09:09 PM, Andrea Gavana wrote:

Hi Werner,

Hi Andrea,

...

http://xoomer.virgilio.it/infinity77/Phoenix/main.html

How many hours do you have per day, 48, 96;-) ?

I wish I had some more, but unfortunately it's just 24 for me as well :wink:

Even as Alpha it looks already very good!

Thank you, and thank you for taking a look at it.

I would only like to see one change, have the "search" easier accessible,
currently it is in the left side bar. I much more like the theme (with the
exception of the colors) on the TurboGear docs.

- the search at the top, and always accessible
- left sidebar can be shrunk and it stays in view

Getting Started — TurboGears 2.1 documentation

I'll take a look at the theming as well, I dont expect it to be
particularly complicated as it should be just a tweak of the Sphinx
_templates and CSS stuff.

I also have a question, how are you doing the "Property summary", i.e. how
do you detect it is a property and get to the "get/set" stuff and do the
"see also"? I guess you generate the .rst using "autodoc" stuff and then
adding these references, but I don't see how one detects if something is a
property and how one gets the "get" or "set" reference.

There is no autodoc involved, everything is picked up from XML
documents representing the wxWidgets C++ docs and brutally reformatted
into restructuredText and put into the Sphinx input files (txt) as
plain restructuredText. To be clearer, you will not see this in the
ReST sources:

.. autoclass:: Window
   :members:
   :undoc-members:

But this:

.. class:: Window(WindowBase)

   Blah blah blah

   .. method:: __init__(self, *args, **kw)

      Blah blah blah

   .. method:: AcceptsFocus(self)

      Blah blah blah

Currently there is no way to use autodoc as the docstrings are not
outputted into the Python code, but simply reformatted from the
Doxygen ones.

I am trying to generate a Sphinx doc for some of my stuff and would like to
include things like this too.

If you are using autodoc, it should be able to pull properties
docstrings out of your class variables and generate the HTML docs.
Unfortunately, as far as I remember Sphinx will not generate a
"Property Summary" by itself, even if you use the ``.. autosummary::``
directive.

In this case, my suggestion would be to use the inspect module to
parse your code to distinguish which variable is a property, and then
you can construct your own Property Summary table like this (view it
with monospace font):

===================== =================================================
:attr:`~Class.Prop_1` See :meth:`~Class.Get_1` and :meth:`~Class.Set_1`
:attr:`~Class.Prop_1` See :meth:`~Class.Get_2` and :meth:`~Class.Set_2`
===================== =================================================

To retrieve its getter/setter, you just do something like this:

if item.fget:
    getter = item.fget.__name__

Where "item" is a live object retrieved using the inspect module.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 14 December 2011 10:49, werner wrote:

On 12/13/2011 09:09 PM, Andrea Gavana wrote:

Hi Andrea,

Thanks for the tips.

Will send you info of the TG theme off-list so you don't have to search.

Werner

Congrats Andrea. Impressive as always!

···

Mike Driscoll

Blog: http://blog.pythonlibrary.org

[ Redirected to wxpython-dev... ]

Where the function description starts at the middle of a sentence.
This is just because the C++/XML docstrings are f****d up (in this
case, they put the function description inside the deprecated tag tail
(!!!)). See the @Robin for various other issues.

Which version of Doxygen are you using? I've noticed differences in the xml output due to different doxygen versions (on different computers) in some of the briefDocs. (They would stop in the middle of the first sentence for some items, while the other computer would continue to the end of the sentence for the same item.) Maybe this is a similar issue. I've just installed 1.7.4 on all my dev machines and that is also the version that the wxWidgets folks have just standardized on as well.

What remains to be done:

- Add the pure-Python classes, methods and functions (i.e., wx.CallAfter);

- Find a way to link snippets of code to (almost) every class. I could
relatively easily do that by grabbing the code from the wxPython demo
and pasting it inside the Sphinx doc, but some of the demos are
relatively big (8-10 kb) so it may be too much to display in an inline
code snippet. However, the same code snippet coule be made available
via the :download: field list of Sphinx as a separate, downloadable
file;

The samples in the demo are not always the best looking and are often used for more than just showing a simple use of some widget but for testing and debugging various things. That could end up being more confusing than helpful in some situations. But I do agree that it would be nice to have something in the docs for at least the widget classes that shows how to use them. So how about if we have the sphinx generator look for a file in some folder in the documentation subtree that matches the class name, and if found it will add a :download: link for it. Then we can write those small simple samples (or copy/paste from the demo in some cases) as there is time available and they will automatically be there the next time the documentation is generated. Perhaps if the sample is less than some N lines long then it could just be shown inline rather than as a download link.

This brings up another point about code snippets, and that is replacing the little C++ snippets already in the docs. A similar approach can be used to auto-replace the C++ snippets that are already there. For example in wx.Window.Fit the C++ doc has this text:

     ...to call:

         window->SetClientSize(child->GetSize());

     instead of calling Fit().

Your current doc is omitting the C++ code snippet but that means that the text now looks like this:

     ...to call: instead of calling Fit().

So my idea is that there could be a folder in the source tree, say sphinx/snippets, that contains a file such as Window.Fit.py that contains the Python code snippet that can be used in place of that C++ code, so the generated doc would then look like this:

     ...to call:

         window.SetClientSize(child.GetSize())

     instead of calling Fit().

If the generator does not find a matching snippet when it runs into that C++ code then we could have it print a WARNING about it so we can easily find those things that need to have a Python snippet created for it.

- Link the documentation to the wxPython Wiki. We may need a web
crawler or some sort of index of the Wiki pages, in order to be able
to map Wiki pages against class names. I am open to any idea in this
sense;

Or just standardize on a naming scheme to use in the docs for the wiki links, like SomePrefix/ClassName/MethodName. Then we can either do something to automate the creation of those pages or just let people create them when the first person goes to that link to add a comment. This can be put on the back-burner for now however to see if any better ideas come up. There are other things that have a higher priority IMO.

- Add wx.lib and the various other pure-Python third party libraries.
This is relatively easier as we can directly use the :autodoc: feature
of Sphinx instead of parsing XML (oh boy**2).

@Robin:

- The generators/extractors contain stuff related also to
globals/defines (GlobalVarDef and DefineDef classes). These contain
mostly the wx.UPPERCASE_SOMETHING, without a value and without a
description. Should we include them somewhere? Where? What is the
point if there is no description?

I think in most cases the items are documented (or at least listed) with the classes that they are to be used with, so I think it is okay to omit them.

- Stuff like the wxWidgets "overviews" documentation is very hard to
convert to something sensible for Python users, as they are full of
C++ code. What should we do with that? At the moment I am simply
skipping those docs;

It's okay to defer these until later too. Eventually we may want to rewrite some of them to have a Python-specific version of the doc, some we may decide to not include at all, some may be able to be used as-is.

In the meantime I noticed a few places where there is a dangling comma due to not including the link to an overview doc. For example, the "See also" list for Window.Close.

- I don't think there is anything we can do, but very, very often the
wxWidgets docs contain the function/method parameter description
*inside* the function/method description text. Nononono, parameter
descriptions should go in their nicely assigned<parameterlist> /
<parametername> tags. The current wxWidgets approach is a terrible way
to document function/method parameters;

There isn't any reason I can see that should prevent us from rewriting the C++ interface docs for an item if it is currently producing malformed or otherwise unusable xml.

- Some of the XML docstrings are seriously f****d up, i.e. lists split
into many paragraphs (!) and descriptions inside xrefsect tags.
Should I submit documentation bug reports for that? (it's a joke, of
course);

- Is there any other way you may be able to output the pure-Python
stuff from the extractors/generators? Something like (class name,
class docstrings, [methods], [methods docstrings]) instead of the full
source code for wx.CallLater and wx.PySimpleApp? I am specifically
talking about the generatePyCode method.

Yes. It is the way it is currently because I was lazy and wanted to be able to include large blocks of copy/pasted Python code in a hurry. The plan has been to go back and turn at least some of those into extractor objects like PyMethodDef (or similar for standalone functions) so you can have attributes like function/method name, args string, docstring and body. That should give you what you need for being able to generate the docs for those items.

I am surely forgetting something at the moment but I'll write to you
privately if anything comes to my mind.

It looks like you are not doing anything about overloaded functions, methods or constructors yet. In case you haven't seen it the extractor objects for functions and methods have an "overloads" attribute that is a list of other functions/method objects that have the same name. For example Window.SetSize has 4 overloads:

         SetSize(x, y, width, height, sizeFlags=SIZE_AUTO)
         SetSize(rect)
         SetSize(size)
         SetSize(width, height)

but it appears that only the first one is showing up in the docs currently.

If you have a better idea of how to deal with this feel free to go that way, but the idea that pops into my mind is to group them all together in a single block under the method signature ("SetSize(self, *args, **kw)" in this example) and then for each of the overloads write the description, parameters, notes or etc. and then after all the overloads put the things that apply to all such as the "See also" section.

···

On 12/13/11 12:09 PM, Andrea Gavana wrote:

--
Robin Dunn
Software Craftsman

Ok, I've just committed some changes that add new extractor class types for defining pure Python functions and classes that should give you the info you need. I've reimplemented wx.CallAfter and wx.CallLater using these classes instead of plain text to be the initial test cases. You'll need to add some code to the sphinx_generator to handle these types of objects, but it should be similar to what you've done already for other types.

In addition to adding the new handlers for PyFunctionDef and PyClassDef in the sip_generator I also tweaked the handlers for PyPropertyDef and PyCodeDef so it's possible to use them for members of a PyClassDef too. You can probably ignore any PyCodeDef objects in this context however.

http://trac.wxwidgets.org/changeset/70010

···

On 12/13/11 2:32 PM, Robin Dunn wrote:

[ Redirected to wxpython-dev... ]

On 12/13/11 12:09 PM, Andrea Gavana wrote:

- Is there any other way you may be able to output the pure-Python
stuff from the extractors/generators? Something like (class name,
class docstrings, [methods], [methods docstrings]) instead of the full
source code for wx.CallLater and wx.PySimpleApp? I am specifically
talking about the generatePyCode method.

Yes. It is the way it is currently because I was lazy and wanted to be
able to include large blocks of copy/pasted Python code in a hurry. The
plan has been to go back and turn at least some of those into extractor
objects like PyMethodDef (or similar for standalone functions) so you
can have attributes like function/method name, args string, docstring
and body. That should give you what you need for being able to generate
the docs for those items.

--
Robin Dunn
Software Craftsman

Looks very pretty.

Love the logo too. I hope you have permission to use it if it's not
yours. Or I hope Robin or whomever has protection against such issues.
Although the wxPython is an accurate name for our beloved package, the
Pheonix logo and concept is just so nice on so many levels. Perhaps
you can keep a sub-project called Pheonix where it is an ongoing
Version Control, Documentation, and Distribution mechanism for the
wxwidget/wxPython package for (new versions of) OS platforms (like
andriod and stuff).

The wxPyWiki seems documentation for a snapshot of the latest wxPython version.

If I remember right about what was said about the goal of Pheonix
project was to automate alot of the documentation so our developer(s)
of wxPython can concentrate on other things. I like that most about
Pheonix.

The major question then remains; "Will wxwidgets move forward in a
Python friendly manner?"

Hi Robin & All,

I have expanded, extended and largely fixed the docs (always
automatically, by tweaking a bit my code). Regarding previous issues:

[ Redirected to wxpython-dev... ]

Where the function description starts at the middle of a sentence.
This is just because the C++/XML docstrings are f****d up (in this
case, they put the function description inside the deprecated tag tail
(!!!)). See the @Robin for various other issues.

Which version of Doxygen are you using? I've noticed differences in the xml
output due to different doxygen versions (on different computers) in some of
the briefDocs. (They would stop in the middle of the first sentence for some
items, while the other computer would continue to the end of the sentence
for the same item.) Maybe this is a similar issue. I've just installed
1.7.4 on all my dev machines and that is also the version that the wxWidgets
folks have just standardized on as well.

I was using 1.6 as you first suggested a couple of months back, but
installing 1.7.4.1 solved almost all the problems (although few issues
still remain).

What remains to be done:

- Add the pure-Python classes, methods and functions (i.e., wx.CallAfter);

- Find a way to link snippets of code to (almost) every class. I could
relatively easily do that by grabbing the code from the wxPython demo
and pasting it inside the Sphinx doc, but some of the demos are
relatively big (8-10 kb) so it may be too much to display in an inline
code snippet. However, the same code snippet coule be made available
via the :download: field list of Sphinx as a separate, downloadable
file;

The samples in the demo are not always the best looking and are often used
for more than just showing a simple use of some widget but for testing and
debugging various things. That could end up being more confusing than
helpful in some situations. But I do agree that it would be nice to have
something in the docs for at least the widget classes that shows how to use
them. So how about if we have the sphinx generator look for a file in some
folder in the documentation subtree that matches the class name, and if
found it will add a :download: link for it. Then we can write those small
simple samples (or copy/paste from the demo in some cases) as there is time
available and they will automatically be there the next time the
documentation is generated. Perhaps if the sample is less than some N lines
long then it could just be shown inline rather than as a download link.

This brings up another point about code snippets, and that is replacing the
little C++ snippets already in the docs. A similar approach can be used to
auto-replace the C++ snippets that are already there. For example in
wx.Window.Fit the C++ doc has this text:

...to call:

   window\-&gt;SetClientSize\(child\-&gt;GetSize\(\)\);

instead of calling Fit().

Your current doc is omitting the C++ code snippet but that means that the
text now looks like this:

...to call: instead of calling Fit().

So my idea is that there could be a folder in the source tree, say
sphinx/snippets, that contains a file such as Window.Fit.py that contains
the Python code snippet that can be used in place of that C++ code, so the
generated doc would then look like this:

...to call:

   window\.SetClientSize\(child\.GetSize\(\)\)

instead of calling Fit().

If the generator does not find a matching snippet when it runs into that C++
code then we could have it print a WARNING about it so we can easily find
those things that need to have a Python snippet created for it.

I am implementing this part at the moment, as the tweaking/extraction
of the XML docs is in a relatively good state. Obviously I will need
some help in translating all the snippets, if possible... I'll send
along a list of things we should include and maybe some helpful soul
will jump in and help me translate them from C++ to Python.

@Robin:

- Stuff like the wxWidgets "overviews" documentation is very hard to
convert to something sensible for Python users, as they are full of
C++ code. What should we do with that? At the moment I am simply
skipping those docs;

It's okay to defer these until later too. Eventually we may want to rewrite
some of them to have a Python-specific version of the doc, some we may
decide to not include at all, some may be able to be used as-is.

In the meantime I noticed a few places where there is a dangling comma due
to not including the link to an overview doc. For example, the "See also"
list for Window.Close.

Thanks, fixed there and (hopefully) everywhere else.

- I don't think there is anything we can do, but very, very often the
wxWidgets docs contain the function/method parameter description
*inside* the function/method description text. Nononono, parameter
descriptions should go in their nicely assigned<parameterlist> /
<parametername> tags. The current wxWidgets approach is a terrible way
to document function/method parameters;

There isn't any reason I can see that should prevent us from rewriting the
C++ interface docs for an item if it is currently producing malformed or
otherwise unusable xml.

I guess the problem is not malformed/unusable XML items. They are
perfectly usable as they are, my objection is that, even in the C++
docs, the parameter description is put into the method description
(i.e., the main first few lines of the C++ docstrings) instead that in
its correct place, which is the <parameterlist> assigned tag.

It's like doing this in Python (wrong IMHO):

def Hello(my_string, your_number):
"""
This function greets you and tells you a number. my_string
is normally "Hello" and your_number is a random number.
"""

Instead of (correct IMHO):

def Hello(my_string, your_number):
"""
This function greets you and tells you a number.

:param string `my_string`: normally set to "Hello";
:param int `your_number`: a random number.
"""

- Is there any other way you may be able to output the pure-Python
stuff from the extractors/generators? Something like (class name,
class docstrings, [methods], [methods docstrings]) instead of the full
source code for wx.CallLater and wx.PySimpleApp? I am specifically
talking about the generatePyCode method.

Yes. It is the way it is currently because I was lazy and wanted to be able
to include large blocks of copy/pasted Python code in a hurry. The plan has
been to go back and turn at least some of those into extractor objects like
PyMethodDef (or similar for standalone functions) so you can have attributes
like function/method name, args string, docstring and body. That should
give you what you need for being able to generate the docs for those items.

Thank you for that, I have integrated your methodology and you can see
the results in the newly uploaded docs.

I am surely forgetting something at the moment but I'll write to you
privately if anything comes to my mind.

It looks like you are not doing anything about overloaded functions, methods
or constructors yet. In case you haven't seen it the extractor objects for
functions and methods have an "overloads" attribute that is a list of other
functions/method objects that have the same name. For example
Window.SetSize has 4 overloads:

   SetSize\(x, y, width, height, sizeFlags=SIZE\_AUTO\)
   SetSize\(rect\)
   SetSize\(size\)
   SetSize\(width, height\)

but it appears that only the first one is showing up in the docs currently.

If you have a better idea of how to deal with this feel free to go that way,
but the idea that pops into my mind is to group them all together in a
single block under the method signature ("SetSize(self, *args, **kw)" in
this example) and then for each of the overloads write the description,
parameters, notes or etc. and then after all the overloads put the things
that apply to all such as the "See also" section.

I think I have managed to get this issue solved in an acceptable
state, but please let me know if you see anything strange about my
implementation. There are a few instances where it seems that the
overloaded methods are a bit wrong, see for example:

http://xoomer.virgilio.it/infinity77/Phoenix/RadioBox.html#RadioBox

The constructor is described as:

__init__(self)

But then there is a bunch of parameters description below it... I am
not sure if it is a bug in my code (highly probable) or an issue in
yours (less probable).

The documentation is now much more complete, with Window styles/extra
styles, event processing, return type for some of the
methods/functions and also a few more hidden goodies :smiley:

Please let me know if you see anything strange.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 13 December 2011 23:32, Robin Dunn wrote:

On 12/13/11 12:09 PM, Andrea Gavana wrote:

- I don't think there is anything we can do, but very, very often the
wxWidgets docs contain the function/method parameter description
*inside* the function/method description text. Nononono, parameter
descriptions should go in their nicely assigned<parameterlist> /
<parametername> tags. The current wxWidgets approach is a terrible way
to document function/method parameters;

There isn't any reason I can see that should prevent us from rewriting the
C++ interface docs for an item if it is currently producing malformed or
otherwise unusable xml.

I guess the problem is not malformed/unusable XML items. They are
perfectly usable as they are, my objection is that, even in the C++
docs, the parameter description is put into the method description
(i.e., the main first few lines of the C++ docstrings) instead that in
its correct place, which is the<parameterlist> assigned tag.

Ah, okay I get it now. I'm guilty of doing that myself. :-/ I expect that this is something that will evolve and be improved over time.

- Is there any other way you may be able to output the pure-Python
stuff from the extractors/generators? Something like (class name,
class docstrings, [methods], [methods docstrings]) instead of the full
source code for wx.CallLater and wx.PySimpleApp? I am specifically
talking about the generatePyCode method.

Yes. It is the way it is currently because I was lazy and wanted to be able
to include large blocks of copy/pasted Python code in a hurry. The plan has
been to go back and turn at least some of those into extractor objects like
PyMethodDef (or similar for standalone functions) so you can have attributes
like function/method name, args string, docstring and body. That should
give you what you need for being able to generate the docs for those items.

Thank you for that, I have integrated your methodology and you can see
the results in the newly uploaded docs.

I saw the CallLater class (and see how bare it looks without good docstrings!) but I don't see the CallAfter function on the functions page. http://xoomer.virgilio.it/infinity77/Phoenix/functions.html

I am surely forgetting something at the moment but I'll write to you
privately if anything comes to my mind.

It looks like you are not doing anything about overloaded functions, methods
or constructors yet. In case you haven't seen it the extractor objects for
functions and methods have an "overloads" attribute that is a list of other
functions/method objects that have the same name. For example
Window.SetSize has 4 overloads:

        SetSize(x, y, width, height, sizeFlags=SIZE_AUTO)
        SetSize(rect)
        SetSize(size)
        SetSize(width, height)

but it appears that only the first one is showing up in the docs currently.

If you have a better idea of how to deal with this feel free to go that way,
but the idea that pops into my mind is to group them all together in a
single block under the method signature ("SetSize(self, *args, **kw)" in
this example) and then for each of the overloads write the description,
parameters, notes or etc. and then after all the overloads put the things
that apply to all such as the "See also" section.

I think I have managed to get this issue solved in an acceptable
state, but please let me know if you see anything strange about my
implementation. There are a few instances where it seems that the
overloaded methods are a bit wrong, see for example:

http://xoomer.virgilio.it/infinity77/Phoenix/RadioBox.html#RadioBox

The constructor is described as:

__init__(self)

But then there is a bunch of parameters description below it... I am
not sure if it is a bug in my code (highly probable) or an issue in
yours (less probable).

It looks like that is coming from an overloaded constructor that has been ignored. The ETG script has this:

     c.find('wxRadioBox').findOverload('wxString choices').ignore()

so the C++ overload that takes a count and a plain C array will be ignored and not wrapped. (We use the overload that takes a wxArrayString instead because there is a %MappedType defined that will automatically convert a Python list of strings to a wxArrayString.)

I don't see anything that might be clobbering those nodes, and the sip_generator seems to be doing the right things there. Maybe you are not checking the ignored flag everyplace it should be?

Also, I noticed that there is not an entry for either of the Create methods in the RadioBox page. Again one of them is ignored and the other is tweaked a little just like the constructors.

The documentation is now much more complete, with Window styles/extra
styles, event processing, return type for some of the
methods/functions and also a few more hidden goodies :smiley:

Please let me know if you see anything strange.

* It looks like there are some cases of overloaded methods sharing a single (or identical) docstring. See wx.Colour.Set for example. If you're able to detect that situation then it would be nice to write the text for that method appropriately, perhaps list each of the method signatures and parameter lists first, and then write the text just once after that.

* Are you doing anything about output parameters yet? It looks like they are just being ignored currently, see the wx.ClientDisplayRect function for example. It would be nice to have the normal "Return type: tuple" and "Returns:" section for it. My preference would be to list the parameter names there, like "(x, y, width, height)". Keep in mind that if the C++ function has a return value as well as output parameters then the return value will be the first item in the tuple. There are also some cases of parameters that are marked as both input and output, such as in wx.Colour.ChangeLightness.

I've got some code in extractors.FunctionDef.makePyArgsString that I use to build a string showing the parameters and return value(s) that you can probably borrow some code from. (And if your generator is being run after the sip_generator then that string should already be in the .pyArgsString attribute of function and method nodes.)

* I'd like to do something different about the enums, but I'm not sure what yet...

* For PyMethodDefs where the .deprecated attribute is true I would be inclined to just leave them out of the docs. In most cases they are only there for backwards compatibility and are very simple wrappers around some other method that is documented. I expect that there can always be exceptions to this rule so maybe they should be omitted unless the briefDoc or detailedDoc attributes are set.

And I've got a few (hopefully) minor usability and style requests:

* Can we use the big Phoenix + wxPython image only on the "Home" and main "Documentation" pages of the docs and not on the rest of the pages?

* When clicking on a cross-reference link to a class, say Size, the URI jumped to is .../Size.html#Size and the additional anchor takes you to the "class Size" in the "Class API" section. Can we instead have them just go to the top of the page instead? I expect that most of the time people are going to be more interested in seeing the class description or other items at the top of the page to start with.

* In the Events tables there is some stock text generated by a doxygen macro that looks like "The following event handler macros redirect the events to member function handlers 'func' with prototypes like:..." and then it shows a code snippet of what the C++ event handler method should look like. IMO the only important part of that is what is the type of the event object passed to the handler. So for it to make more sense for Python people I'd like to change all of those to something like, "Handlers bound for the following event types will receive a CommandEvent parameter." (Using the correct event class type of course.)

* In the Events tables we should drop the "(id, func)" after the EVT_ items, or anything else that may appear in ()'s there. They are almost never used as callable objects anymore in wxPython.

* Let's change "Events Processing" to "Events emitted by this class"

···

On 12/15/11 2:33 PM, Andrea Gavana wrote:

--
Robin Dunn
Software Craftsman

Ok, here's my thoughts on documenting the enum types.

Currently you've got Notes in some of the class docs like, "This class may make extensive use of the enumeration outlined in control Enumeration." And the linked-to page appears to have all the enums that are defined in the 'control' etg module, listing the enum values and descriptions if they have them.

Instead I would like the named enums to be documented similarly to classes. IOW each should get their own page, and any references to the enum name should link to that page. For example in the docs for the Control.Ellipsize method each of the "EllipsizeMode" segments would link to a page titled "EllipsizeMode" or perhaps "EllipsizeMode Enumeration" that contains something like:

"""
The EllipsizeMode enumeration provides the following values

   Value Description
   ELLIPSIZE_NONE Don�t ellipsize the text at all.
   ELLIPSIZE_START Put the ellipsis at the start of the string, if
                    the string needs ellipsization.

   etc.
"""

An example of where I think this will be a big improvement is in the Bitmap doc. The BitmapType enumeration is actually declared in a different module so there is currently no link to it at all in the Bitmap page. But when BitmapType is treated like other types and has its own page then the doc for Bitmap.__init__ will link to it when documenting the type of the 'type' arg, and that is exactly where the reader needs to be able to get to it to see what values can be used.

For the enums that do not have a name the values will typically be used like #define'd constants and so will usually be documented in the methods where they can be used. We can also put them (and the defines) on a page similarly to what you are doing now if you want, but let's change the Note text to just a simple link, something like "Related constants"

···

On 12/15/11 5:50 PM, Robin Dunn wrote:

On 12/15/11 2:33 PM, Andrea Gavana wrote:

* I'd like to do something different about the enums, but I'm not sure
what yet...

--
Robin Dunn
Software Craftsman

Hi Robin & All,

Yes. It is the way it is currently because I was lazy and wanted to be
able
to include large blocks of copy/pasted Python code in a hurry. The plan
has
been to go back and turn at least some of those into extractor objects
like
PyMethodDef (or similar for standalone functions) so you can have
attributes
like function/method name, args string, docstring and body. That should
give you what you need for being able to generate the docs for those
items.

Thank you for that, I have integrated your methodology and you can see
the results in the newly uploaded docs.

I saw the CallLater class (and see how bare it looks without good
docstrings!) but I don't see the CallAfter function on the functions page.
http://xoomer.virgilio.it/infinity77/Phoenix/functions.html

Thanks, I had forgot to write down the docstrings. Fixed now.

I am surely forgetting something at the moment but I'll write to you
privately if anything comes to my mind.

It looks like you are not doing anything about overloaded functions,
methods
or constructors yet. In case you haven't seen it the extractor objects
for
functions and methods have an "overloads" attribute that is a list of
other
functions/method objects that have the same name. For example
Window.SetSize has 4 overloads:

   SetSize\(x, y, width, height, sizeFlags=SIZE\_AUTO\)
   SetSize\(rect\)
   SetSize\(size\)
   SetSize\(width, height\)

but it appears that only the first one is showing up in the docs
currently.

If you have a better idea of how to deal with this feel free to go that
way,
but the idea that pops into my mind is to group them all together in a
single block under the method signature ("SetSize(self, *args, **kw)" in
this example) and then for each of the overloads write the description,
parameters, notes or etc. and then after all the overloads put the things
that apply to all such as the "See also" section.

I think I have managed to get this issue solved in an acceptable
state, but please let me know if you see anything strange about my
implementation. There are a few instances where it seems that the
overloaded methods are a bit wrong, see for example:

http://xoomer.virgilio.it/infinity77/Phoenix/RadioBox.html#RadioBox

The constructor is described as:

__init__(self)

But then there is a bunch of parameters description below it... I am
not sure if it is a bug in my code (highly probable) or an issue in
yours (less probable).

It looks like that is coming from an overloaded constructor that has been
ignored. The ETG script has this:

c.find('wxRadioBox').findOverload('wxString choices').ignore()

so the C++ overload that takes a count and a plain C array will be ignored
and not wrapped. (We use the overload that takes a wxArrayString instead
because there is a %MappedType defined that will automatically convert a
Python list of strings to a wxArrayString.)

I don't see anything that might be clobbering those nodes, and the
sip_generator seems to be doing the right things there. Maybe you are not
checking the ignored flag everyplace it should be?

Thank you, that was the right suggestion. I wasn't checking the
ignored flag indeed, it should be fixed now.

Also, I noticed that there is not an entry for either of the Create methods
in the RadioBox page. Again one of them is ignored and the other is tweaked
a little just like the constructors.

This is because you are setting the "ignored" flag to True for the
main method (i.e., the one which has the overloads as children). This
requires a huge workaround to make the docstrings generation work, and
I haven't actually finished implementing it. It is the only issue
remaining on your list that hasn't been fixed.

To explain it better, I print this out from my generateClass method
(for wx.RadioBox):

for meth in klass:
    if isinstance(meth, methods):
        print meth.name, meth.ignored, len(meth.overloads) > 0

And I get this:

Method Name Ignored Has_Overloads

wxRadioBox False True
~wxRadioBox False False

Create True True <----

Enable False False
FindString False False
GetColumnCount False False
GetItemFromPoint False False
GetItemHelpText False False
GetItemToolTip False False
GetRowCount False False
IsItemEnabled False False
IsItemShown False False
SetItemHelpText False False
SetItemToolTip False False
Show False False
GetCount False False
GetString False False
SetString False False
SetSelection False False
GetSelection False False
GetItemLabel False False
SetItemLabel False False

As you can see, the main Create method has overloads but it is marked
as ignored. This is a nono at the moment. Put it in another way, the
main method should never have the ignored flag set to true if any of
its single overloads should not be ignored.

Let's assume that Create has 3 overloads. 1 should not be ignored, the
other 2 should be ignored. Then, irrespectively of their order in the
XML docs, the one that should not be ignored needs to be the main one
and the other two should go into the "overloads" list as "children" of
the main one.

I can probably work around this thing but I believe it should be
handled by the original sip/pi/whatever generators/extractors stuff.

The documentation is now much more complete, with Window styles/extra
styles, event processing, return type for some of the
methods/functions and also a few more hidden goodies :smiley:

Please let me know if you see anything strange.

* It looks like there are some cases of overloaded methods sharing a single
(or identical) docstring. See wx.Colour.Set for example. If you're able to
detect that situation then it would be nice to write the text for that
method appropriately, perhaps list each of the method signatures and
parameter lists first, and then write the text just once after that.

Done. There is stil some space optimization to be done there, for
example: do all the overloaded methods have *always* the same return
type? If this is the case, I could put the return type at the end of
the description.

* Are you doing anything about output parameters yet? It looks like they
are just being ignored currently, see the wx.ClientDisplayRect function for
example. It would be nice to have the normal "Return type: tuple" and
"Returns:" section for it. My preference would be to list the parameter
names there, like "(x, y, width, height)". Keep in mind that if the C++
function has a return value as well as output parameters then the return
value will be the first item in the tuple. There are also some cases of
parameters that are marked as both input and output, such as in
wx.Colour.ChangeLightness.

I've got some code in extractors.FunctionDef.makePyArgsString that I use to
build a string showing the parameters and return value(s) that you can
probably borrow some code from. (And if your generator is being run after
the sip_generator then that string should already be in the .pyArgsString
attribute of function and method nodes.)

The "return" stuff was just incomplete up to yesterday. I have tweaked
it and now you should see a much better representation of what you
were expecting.

* I'd like to do something different about the enums, but I'm not sure what
yet...

I have seen your other message about the enum, I'll implement it by
Monday, it should be relatively easy. Do you still want the "Note"
inside the widgets classes referring to the enum or not?

* For PyMethodDefs where the .deprecated attribute is true I would be
inclined to just leave them out of the docs. In most cases they are only
there for backwards compatibility and are very simple wrappers around some
other method that is documented. I expect that there can always be
exceptions to this rule so maybe they should be omitted unless the briefDoc
or detailedDoc attributes are set.

Done.

And I've got a few (hopefully) minor usability and style requests:

* Can we use the big Phoenix + wxPython image only on the "Home" and main
"Documentation" pages of the docs and not on the rest of the pages?

Not directly via Sphinx, I made it work by (automatically)
post-processing the HTML files generated by Sphinx.

* When clicking on a cross-reference link to a class, say Size, the URI
jumped to is .../Size.html#Size and the additional anchor takes you to the
"class Size" in the "Class API" section. Can we instead have them just go
to the top of the page instead? I expect that most of the time people are
going to be more interested in seeing the class description or other items
at the top of the page to start with.

That was a hard one, and the fix is a terrible hack. The reason why
the URI jumped to the class definition is because I was using the very
convenient Sphinx :class: role. I had to switch back to the :ref:
role, but this has a couple of disadvantages:

1) :class: doesn't complain when it doesn't find a valid class
definition (i.e., :class:Grid doesn't emit a warning, :ref:Grid does),
and there are many, many classes not yet wrapped (and there will be
some that will never be wrapped in wxPython, as they are purely C++
classes for which the Python lib already provides good alternatives).
This means that my clean, beautiful Sphinx build went from 3 harmless
warnings to 444 missing ":ref:" when built.

2) The :ref: trick above can be applied only for inline docs and
return types, not to parameters, because in ReST you can not write
this:

:param :ref:`GCDC` `hello`: some description

As the :param: roles uses the ":" to correctly generate the HTML docs.
If you write this:

:param `GCDC` `hello`: some description

Then you get the correct HTML stuff *but* clicking on the GCDC link
will bring you to the class definition, not to the top of the page.
The only solution to this is to post-process the HTML docs, which I
did and which is a terrible, terrible hack.

* In the Events tables there is some stock text generated by a doxygen macro
that looks like "The following event handler macros redirect the events to
member function handlers 'func' with prototypes like:..." and then it shows
a code snippet of what the C++ event handler method should look like. IMO
the only important part of that is what is the type of the event object
passed to the handler. So for it to make more sense for Python people I'd
like to change all of those to something like, "Handlers bound for the
following event types will receive a CommandEvent parameter." (Using the
correct event class type of course.)

Done.

* In the Events tables we should drop the "(id, func)" after the EVT_ items,
or anything else that may appear in ()'s there. They are almost never used
as callable objects anymore in wxPython.

Done.

* Let's change "Events Processing" to "Events emitted by this class"

Done, although you forgot to capitalize the sentence (Events Emitted
by this Class) :smiley:

On a completely unrelated note, I got (yet another) message telling me
that some internet security firm (!), M86 or similar, has black-listed
the xoomer*.*it domain and it appears quite a few people have problem
accessing the docs just to take a peek. Now, I have tried to generate
a PDF file out of the docs to upload it somewhere for those people to
take a look, but rst2pdf is completely useless with Sphinx 1.X. I
could either:

1) Create a CHM and upload it somewhere;
2) Get a new domain and re-upload the docs. I am no web expert so I
welcome any suggestion for a free, free-of-trouble web space
somewhere.

Please let me know what you think and what still needs to be adjusted
in the docs.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 16 December 2011 02:50, Robin Dunn wrote:

Hi Robin& All,

Also, I noticed that there is not an entry for either of the Create methods
in the RadioBox page. Again one of them is ignored and the other is tweaked
a little just like the constructors.

This is because you are setting the "ignored" flag to True for the
main method (i.e., the one which has the overloads as children).

I wondered if that might be the problem. I ran into similar issues for the sip generator too. IIRC I got around it by looping over the overloads list outside of the 'if not method.ignored:' test. However other than dealing with the docstring for SIP I don't have to care too much about the context of the group as much as you probably do, so I can understand that it would be trickier.

As you can see, the main Create method has overloads but it is marked
as ignored. This is a nono at the moment. Put it in another way, the
main method should never have the ignored flag set to true if any of
its single overloads should not be ignored.

Let's assume that Create has 3 overloads. 1 should not be ignored, the
other 2 should be ignored. Then, irrespectively of their order in the
XML docs, the one that should not be ignored needs to be the main one
and the other two should go into the "overloads" list as "children" of
the main one.

I can probably work around this thing but I believe it should be
handled by the original sip/pi/whatever generators/extractors stuff.

I have an idea of a good way to deal with it, I'll try to implement it this evening.

The documentation is now much more complete, with Window styles/extra
styles, event processing, return type for some of the
methods/functions and also a few more hidden goodies :smiley:

Please let me know if you see anything strange.

* It looks like there are some cases of overloaded methods sharing a single
(or identical) docstring. See wx.Colour.Set for example. If you're able to
detect that situation then it would be nice to write the text for that
method appropriately, perhaps list each of the method signatures and
parameter lists first, and then write the text just once after that.

Done. There is stil some space optimization to be done there, for
example: do all the overloaded methods have *always* the same return
type? If this is the case, I could put the return type at the end of
the description.

No, again Colour.Set is an example where there are different returns (one returns bool, the others don't return anything.)

* I'd like to do something different about the enums, but I'm not sure what
yet...

I have seen your other message about the enum, I'll implement it by
Monday, it should be relatively easy. Do you still want the "Note"
inside the widgets classes referring to the enum or not?

If we're able to get to the named enum pages through links where the types are used, and since most of the time the others are at least mentioned where they can be used then I'm not sure Note and link are really needed.

* For PyMethodDefs where the .deprecated attribute is true I would be
inclined to just leave them out of the docs. In most cases they are only
there for backwards compatibility and are very simple wrappers around some
other method that is documented. I expect that there can always be
exceptions to this rule so maybe they should be omitted unless the briefDoc
or detailedDoc attributes are set.

Done.

And I've got a few (hopefully) minor usability and style requests:

* Can we use the big Phoenix + wxPython image only on the "Home" and main
"Documentation" pages of the docs and not on the rest of the pages?

Not directly via Sphinx, I made it work by (automatically)
post-processing the HTML files generated by Sphinx.

* When clicking on a cross-reference link to a class, say Size, the URI
jumped to is .../Size.html#Size and the additional anchor takes you to the
"class Size" in the "Class API" section. Can we instead have them just go
to the top of the page instead? I expect that most of the time people are
going to be more interested in seeing the class description or other items
at the top of the page to start with.

That was a hard one, and the fix is a terrible hack. The reason why
the URI jumped to the class definition is because I was using the very
convenient Sphinx :class: role. I had to switch back to the :ref:
role, but this has a couple of disadvantages:

1) :class: doesn't complain when it doesn't find a valid class
definition (i.e., :class:Grid doesn't emit a warning, :ref:Grid does),
and there are many, many classes not yet wrapped (and there will be
some that will never be wrapped in wxPython, as they are purely C++
classes for which the Python lib already provides good alternatives).
This means that my clean, beautiful Sphinx build went from 3 harmless
warnings to 444 missing ":ref:" when built.

2) The :ref: trick above can be applied only for inline docs and
return types, not to parameters, because in ReST you can not write
this:

:param :ref:`GCDC` `hello`: some description

As the :param: roles uses the ":" to correctly generate the HTML docs.
If you write this:

:param `GCDC` `hello`: some description

Then you get the correct HTML stuff *but* clicking on the GCDC link
will bring you to the class definition, not to the top of the page.
The only solution to this is to post-process the HTML docs, which I
did and which is a terrible, terrible hack.

Although a post processing step sounds less problematic than the disadvantages above. And the post processing step can always be turned off with little impact if other problems come up in the future.

On a completely unrelated note, I got (yet another) message telling me
that some internet security firm (!), M86 or similar, has black-listed
the xoomer*.*it domain and it appears quite a few people have problem
accessing the docs just to take a peek. Now, I have tried to generate
a PDF file out of the docs to upload it somewhere for those people to
take a look, but rst2pdf is completely useless with Sphinx 1.X. I
could either:

1) Create a CHM and upload it somewhere;
2) Get a new domain and re-upload the docs. I am no web expert so I
welcome any suggestion for a free, free-of-trouble web space
somewhere.

Well, once your code is committed (hint, hint!) then I can add a command to build.py that builds the docs and uploads to wxPython.org, and eventually that can probably be automated and done from a buildbot or something.

Please let me know what you think and what still needs to be adjusted
in the docs.

I'll take a close look this evening.

Thanks!

···

On 12/16/11 2:14 PM, Andrea Gavana wrote:

On 16 December 2011 02:50, Robin Dunn wrote:

--
Robin Dunn
Software Craftsman

Hi Robin & All,

* I'd like to do something different about the enums, but I'm not sure
what yet...

Ok, here's my thoughts on documenting the enum types.

Currently you've got Notes in some of the class docs like, "This class may
make extensive use of the enumeration outlined in control Enumeration." And
the linked-to page appears to have all the enums that are defined in the
'control' etg module, listing the enum values and descriptions if they have
them.

Instead I would like the named enums to be documented similarly to classes.
IOW each should get their own page, and any references to the enum name
should link to that page. For example in the docs for the Control.Ellipsize
method each of the "EllipsizeMode" segments would link to a page titled
"EllipsizeMode" or perhaps "EllipsizeMode Enumeration" that contains
something like:

"""
The EllipsizeMode enumeration provides the following values

Value Description
ELLIPSIZE_NONE Don’t ellipsize the text at all.
ELLIPSIZE_START Put the ellipsis at the start of the string, if
the string needs ellipsization.

etc.
"""

An example of where I think this will be a big improvement is in the Bitmap
doc. The BitmapType enumeration is actually declared in a different module
so there is currently no link to it at all in the Bitmap page. But when
BitmapType is treated like other types and has its own page then the doc for
Bitmap.__init__ will link to it when documenting the type of the 'type' arg,
and that is exactly where the reader needs to be able to get to it to see
what values can be used.

For the enums that do not have a name the values will typically be used like
#define'd constants and so will usually be documented in the methods where
they can be used. We can also put them (and the defines) on a page
similarly to what you are doing now if you want, but let's change the Note
text to just a simple link, something like "Related constants"

Done with the Enums, please let me know what you think. There are a
few funnily-named enums (like @2, @3 and so on up to 23), and I am not
sure what to do about them??

I have currently removed the Note text altogether, but I can easily
put it back if needed.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 16 December 2011 20:56, Robin Dunn wrote:

On 12/15/11 5:50 PM, Robin Dunn wrote:

On 12/15/11 2:33 PM, Andrea Gavana wrote:

Hi Andrea,

Just amazing!

Browsing around it I noticed an issue for wx.Button, in the intro text (explanation on top) it talks about the bitmap functionality which is there as of 2.9.1 and mentions "SetBitmap" and co but they are not listed in the Method Summary.

Werner

Hi Werner,

Hi Andrea,

Just amazing!

Thank you, I am happy you like it.

Browsing around it I noticed an issue for wx.Button, in the intro text
(explanation on top) it talks about the bitmap functionality which is there
as of 2.9.1 and mentions "SetBitmap" and co but they are not listed in the
Method Summary.

Unfortunately these methods are inherited from the AnyButton class (a
super class of wx.Button), and the wxWidgets docs in this respect are
completely inconsistent in terms of linking to inherited method.

First of all, they often break the second rule of a good docstring:
"if you are referencing an inherited method from a subclass, you
should use the full reference TheClass.TheMethod".

Secondly, sometimes they actually respect the previous rule (see, for
instance, the Button.SetDefault method, where there is a correct full
reference to Window.SetFocus, despite wx.Window being a super class of
wx.Button).

I can probably work-around this thing by listing all the methods for
all the classes and then trying to pair them up for the unconverted
links, but this is a major pain. I'll try and think about a better
strategy, although I'll leave it as it is for the moment as the code I
have written is not really suitable for doing what I have just said.

Not being able to use introspection is a huge setback, as
Sphinx+docutils would have figured it out by themselves automagically
that SetBitmap is an inherited method from AnyButton.

By the way, thank you for the hint on the Gallery. I have managed to
put it together, although the wxWidgets screenshots are all of
different sizes and the gallery itself doesn't look very nice. In any
case, my idea of a gallery was more of a collection of screenshots
taken from apps written in wxPython instead of a boring set of
controls.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 18 December 2011 20:17, werner wrote:

Hi Andrea,

Hi Werner,

Hi Andrea,

Just amazing!

Thank you, I am happy you like it.

Browsing around it I noticed an issue for wx.Button, in the intro text
(explanation on top) it talks about the bitmap functionality which is there
as of 2.9.1 and mentions "SetBitmap" and co but they are not listed in the
Method Summary.

Unfortunately these methods are inherited from the AnyButton class (a
super class of wx.Button), and the wxWidgets docs in this respect are
completely inconsistent in terms of linking to inherited method.

First of all, they often break the second rule of a good docstring:
"if you are referencing an inherited method from a subclass, you
should use the full reference TheClass.TheMethod".

Secondly, sometimes they actually respect the previous rule (see, for
instance, the Button.SetDefault method, where there is a correct full
reference to Window.SetFocus, despite wx.Window being a super class of
wx.Button).

Maybe the documentation guide on wxWidgets needs updating with the above?
http://www.wxwidgets.org/develop/standard.htm

Looking at the 2.9.3 wxWidget docs, it looks like they might have caught this one - not sure as I didn't look at the source.

http://docs.wxwidgets.org/trunk/classwx_button.html

If not could you generate a list of failing references and then people could start doing some doc patches to get these things fixed on the wxWidgets side.

I can probably work-around this thing by listing all the methods for
all the classes and then trying to pair them up for the unconverted
links, but this is a major pain. I'll try and think about a better
strategy, although I'll leave it as it is for the moment as the code I
have written is not really suitable for doing what I have just said.

I think these things should get fixed at the "source"

Not being able to use introspection is a huge setback, as
Sphinx+docutils would have figured it out by themselves automagically
that SetBitmap is an inherited method from AnyButton.

By the way, thank you for the hint on the Gallery. I have managed to
put it together, although the wxWidgets screenshots are all of
different sizes and the gallery itself doesn't look very nice. In any
case, my idea of a gallery was more of a collection of screenshots
taken from apps written in wxPython instead of a boring set of
controls.

I think the application gallery is a very nice idea, but I think the "boring set" is something which should stay, I think it is very handy to get an overview of what widgets exists. When I have done it for Dabo (temp still sitting on my site), I made three gallery pages which are accessible via the following:

http://thewinecellarbook.com/daboDocTestAlt/#
clicking on the window one you gets this.
http://thewinecellarbook.com/daboDocTestAlt/gallery_win.html

I kept the sizes very similar which makes things like the button control look very odd, as many of them contain to many details one can see a larger version of the image by clicking the image and see the doc by clicking the caption.

Currently this uses dynamically sized cells, is there maybe some css magic one could do and size the cells based on the largest widget image or have some fixed value.

Maybe the documentation guide should state how the images should be sized.

The sample images is probably another thing "people" could help with. Suggestions on how we could organize this so not everyone is starting to do images - maybe have a wiki page referenced from the the Phoenix wiki which hands out tasks like this and people can put there name/email next to a task if they plan to work on it.

Werner

···

On 12/18/2011 10:35 PM, Andrea Gavana wrote:

On 18 December 2011 20:17, werner wrote:

Hi Werner & All,

Hi Andrea,

Hi Werner,

Hi Andrea,

Just amazing!

Thank you, I am happy you like it.

Browsing around it I noticed an issue for wx.Button, in the intro text
(explanation on top) it talks about the bitmap functionality which is
there
as of 2.9.1 and mentions "SetBitmap" and co but they are not listed in
the
Method Summary.

Unfortunately these methods are inherited from the AnyButton class (a
super class of wx.Button), and the wxWidgets docs in this respect are
completely inconsistent in terms of linking to inherited method.

First of all, they often break the second rule of a good docstring:
"if you are referencing an inherited method from a subclass, you
should use the full reference TheClass.TheMethod".

Secondly, sometimes they actually respect the previous rule (see, for
instance, the Button.SetDefault method, where there is a correct full
reference to Window.SetFocus, despite wx.Window being a super class of
wx.Button).

Maybe the documentation guide on wxWidgets needs updating with the above?
Coding Guidelines - wxWidgets

Looking at the 2.9.3 wxWidget docs, it looks like they might have caught
this one - not sure as I didn't look at the source.

wxWidgets: wxButton Class Reference

If not could you generate a list of failing references and then people could
start doing some doc patches to get these things fixed on the wxWidgets
side.

I managed to fix it on the Sphinx side, by post-hacking the ReST files
via Python. Please let me know if it looks better.

I can probably work-around this thing by listing all the methods for
all the classes and then trying to pair them up for the unconverted
links, but this is a major pain. I'll try and think about a better
strategy, although I'll leave it as it is for the moment as the code I
have written is not really suitable for doing what I have just said.

I think these things should get fixed at the "source"

Not being able to use introspection is a huge setback, as
Sphinx+docutils would have figured it out by themselves automagically
that SetBitmap is an inherited method from AnyButton.

By the way, thank you for the hint on the Gallery. I have managed to
put it together, although the wxWidgets screenshots are all of
different sizes and the gallery itself doesn't look very nice. In any
case, my idea of a gallery was more of a collection of screenshots
taken from apps written in wxPython instead of a boring set of
controls.

I think the application gallery is a very nice idea, but I think the "boring
set" is something which should stay, I think it is very handy to get an
overview of what widgets exists. When I have done it for Dabo (temp still
sitting on my site), I made three gallery pages which are accessible via the
following:

http://thewinecellarbook.com/daboDocTestAlt/#
clicking on the window one you gets this.
http://thewinecellarbook.com/daboDocTestAlt/gallery_win.html

I kept the sizes very similar which makes things like the button control
look very odd, as many of them contain to many details one can see a larger
version of the image by clicking the image and see the doc by clicking the
caption.

Currently this uses dynamically sized cells, is there maybe some css magic
one could do and size the cells based on the largest widget image or have
some fixed value.

Maybe the documentation guide should state how the images should be sized.

The sample images is probably another thing "people" could help with.
Suggestions on how we could organize this so not everyone is starting to do
images - maybe have a wiki page referenced from the the Phoenix wiki which
hands out tasks like this and people can put there name/email next to a task
if they plan to work on it.

This is a very good idea; at the moment I am piggybacking on the
wxWidgets screenshots, but it would be nice to create a wxPython-only
set of images for all the 3 platforms (also because wxPython has many
more controls than wxWidgets itself).
Ideally, there should be a full-size image and a thumbnail one, with a
reasonable size so that the gallery doesn't get messed up when all the
thumbnails get put together.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 19 December 2011 10:20, werner wrote:

On 12/18/2011 10:35 PM, Andrea Gavana wrote:

On 18 December 2011 20:17, werner wrote:

Hi Andrea,

...

I managed to fix it on the Sphinx side, by post-hacking the ReST files
via Python. Please let me know if it looks better.

You must be working in multiple dimensions if you still only have 24 hours like we do:), looks great!
...

I kept the sizes very similar which makes things like the button control
look very odd, as many of them contain to many details one can see a larger
version of the image by clicking the image and see the doc by clicking the
caption.

Currently this uses dynamically sized cells, is there maybe some css magic
one could do and size the cells based on the largest widget image or have
some fixed value.

Maybe the documentation guide should state how the images should be sized.

The sample images is probably another thing "people" could help with.
  Suggestions on how we could organize this so not everyone is starting to do
images - maybe have a wiki page referenced from the the Phoenix wiki which
hands out tasks like this and people can put there name/email next to a task
if they plan to work on it.

This is a very good idea; at the moment I am piggybacking on the
wxWidgets screenshots, but it would be nice to create a wxPython-only
set of images for all the 3 platforms (also because wxPython has many
more controls than wxWidgets itself).
Ideally, there should be a full-size image and a thumbnail one, with a
reasonable size so that the gallery doesn't get messed up when all the
thumbnails get put together.

With the Dabo doc I had used something like 400 x "n" and 128 x "n" and "n" is whatever to keep the proportion equal, used a little script to generate the _thumbs using PIL.

Any idea on how one could generate the full size in some automatic or semi-automatic way? If not I could do e.g. the ones for Windows 7 based on the wxPython 2.9.2 demo or wait for the 2.9.3.

Werner

···

On 12/19/2011 08:00 PM, Andrea Gavana wrote: