On 5/26/12 1:12 PM, Andrea Gavana wrote:
> On 26 May 2012 21:37, Andrea Gavana wrote:
>> Robin,
>>
>> On 26 May 2012 00:31, Robin Dunn wrote:
>>> Andrea,
>>>
>>> I noticed that classes and functions from the wx.adv module are showing up
>>> in the main part of the docs as ClassName instead of in a adv section like
>>> what is happening for dataview. What do we need to do to set things up so
>>> wx.adv items are separated from the core and such?
>>
>> I don't expect it to be very complicated, I'll take a look at it right
>> now.
>
> I didn't initially implement it as "adv" in the docs for two reasons:
> we have never had a "wx.adv" sub-package before and there is nothing
> really "advanced" about wx.SplashScreen or wx.TaskBarIcon.
"Advanced" really isn't a very good name for it. It's actually used for
things that depend on core but that are used less frequently and so are
good candidates for excluding in applications that do not need them, in
order to save memory, installer size, etc. There is a section in the
MigrationGuide about this and the reasons for basically following the
structure of the wx libraries. I'll paste it[1] below.
> Uhm, no, I'll backtrack here. It is going to get complicated and, most
> importantly, ugly in the sphinxgenerator code. One things I do not
> understand: is wx.SplashScreen (or any other "adv" stuff) going to be
> defined as wx.adv.SplashScreen in the documentation?
It would be nice if we could. Or at least have some notation in the
SplashScreen's class documentation that this class is located in the
wx.adv module. For example either using "wx.adv.SplashScreen" for the
title at the top of the page, or having something like "Module: wx.adv"
line near the top.
> How about
> parameter kind (i.e., is "wxGridSelectionModes" going to be defined as
> wx.adv.GridSelectionModes or wx.adv.grid.GridSelectionModes or
> something else?).
That is not a good example since it is an enum (and so from Python it is
really just an integer) and also because it's defined inside the Grid
class so the enum values will always be referenced via the class.
However I do understand the gist of your question. I think if we're
able to show the module where the class or enum is located on its page
then it is probably okay to use just the base name when referring to it
elsewhere.
>
> I believe the Sphinx documentation should follow the wxPython module
> structure, not an unspecified (and flawed) wxWidgets definition of
> what "wxAdvanced" should be.
The point is that the Classic wxPython module structure was flawed, and
the wxPython Phoenix module structure is going to more or less follow
the wx DLL organization. So having the Sphinx documentation follow the
wxPython (phoenix) module structure is essentially the same as following
the wxWidgets definition.
> If you're telling me that from now on
> wx.grid.Grid and wx.calendar.CalendarCtrl will be addressed as
> "wx.adv.Grid" and "wx.adv.CalendarCtrl", then we may have a problem
> :-)
>
I think Grid will still have its own module since it is so big, but yes
CalendarCtrl is in wx.adv already.
BTW, you can use the ModulfDef.module attribute while the
sphinx_generator is running to get the name of the extension module
where the items in that etg script are being put. The current
possibilities are "_core", "_adv" and "_dataview" but there are going to
be more, (I currently have plans for _grid, _html, _html2, _richtext,
_stc, _propgrid, _xrc, _gl, and _msw). Using that attribute when the
generator is running you should be able to record which module each of
the items will be located in and then either use that in the source .txt
files and/or while post-processing before running sphinx. Does that
make sense or am I missing something?
The wx/__init__.py is essentially just "from wx.core import *", and then
the wx.core Python module imports everything from the _core extension
module. The others will follow the same pattern, but only wx.core will
be loaded into the wx namespace.
[1]
"""
The 'wx' namespace and submodules reorganized
---------------------------------------------
Some reorganization of what classes and functions goes in which internal
wx extension module has been done. In Classic the organization of the
extension modules was somewhat haphazard and chaotic. For example there
were 5 separate modules whose contents were loaded into the main "wx"
package namespace and several others that needed to be imported
separately. However since there was not much organization of the core
the C++ wxadv and wxhtml DLLs would need to be distributed with any
applications built with a bundling tool even if the application did not
use any of those classes.
For Phoenix the location of the wrapper code for the classes and
functions will attempt to follow the same organization that wxWidgets
uses for putting those same classes and functions into DLLs or shared
libraries. This means that some things that were formerly in the core wx
package namespace are no longer there. They will have to be used by
importing a wx sumbodule. Most of them will be in the wx.adv module.
Once nice advantage of doing this is that if your application is not
using any of these lesser used classes then you will not have to bundle
the new modules (nor the associated wx DLLs) with your application when
you use py2exe or other executable builder.