I’ve been using Oliver’s latest version (3.1.1b1) of pubsub for a while now. In that version this import works:
from pubsub.pub import AUTO_TOPIC
Attempting to use the version in 2.9.3.1 this import fails:
from wx.lib.pubsub.pub import AUTO_TOPIC
Any suggestions for getting this working?
Michael,
The pubsub in wx still defaults to old (and I wish, deprecated) API, where AUTO_TOPIC is not available. To make use of the new pubsub API in wx.lib.pubsub, you must first import the setupkwargs:
from wx.lib.pubsub import setupkwargs
from wx.lib.pubsub.pub import AUTO_TOPIC
This is the default in stock pubsub, of course, so the first import is not necessary:
If you would like to add a version check and default to the new API if running in wx 2.9 then I would be open to that change. The 2.9 release series is a good time to introduce a change for the better default behavior.
···
On 1/5/12 5:01 AM, oliver wrote:
The pubsub in wx still defaults to old (and I wish, deprecated) API,
where AUTO_TOPIC is not available. To make use of the new pubsub API in
wx.lib.pubsub, you must first import the setupkwargs:
from wx.lib.pubsub import setupkwargs
from wx.lib.pubsub.pub import AUTO_TOPIC
Sounds good, I will do that. Where should I put instructions for users who will be upgrading an app from wx 2.8 to 2.9, as they will have to add one line to use previous API.
The pubsub in wx still defaults to old (and I wish, deprecated) API,
where AUTO_TOPIC is not available. To make use of the new pubsub API in
wx.lib.pubsub, you must first import the setupkwargs:
from wx.lib.pubsub import setupkwargs
from wx.lib.pubsub.pub import AUTO_TOPIC
Oliver,
If you would like to add a version check and default to the new API if running in wx 2.9 then I would be open to that change. The 2.9 release series is a good time to introduce a change for the better default behavior.
Put it in at least the package's docstring, and you can also give me a few sentences to put into the CHANGES document.
···
On 1/6/12 5:20 AM, oliver wrote:
On Thu, Jan 5, 2012 at 1:32 PM, Robin Dunn <robin@alldunn.com > <mailto:robin@alldunn.com>> wrote:
On 1/5/12 5:01 AM, oliver wrote:
The pubsub in wx still defaults to old (and I wish, deprecated) API,
where AUTO_TOPIC is not available. To make use of the new pubsub
API in
wx.lib.pubsub, you must first import the setupkwargs:
from wx.lib.pubsub import setupkwargs
from wx.lib.pubsub.pub import AUTO_TOPIC
Oliver,
If you would like to add a version check and default to the new API
if running in wx 2.9 then I would be open to that change. The 2.9
release series is a good time to introduce a change for the better
default behavior.
Sounds good, I will do that. Where should I put instructions for users
who will be upgrading an app from wx 2.8 to 2.9, as they will have to
add one line to use previous API.
I have added (to SVN) some code in autosetuppubsubv1.py which only activates v1 API if wx < 2.9. However, doing this portably and such that it doesn’t break the standalone pubsub was tricky. Tested on Windows XP with py 2.6 and wx 2.8, and tested also by changing the wx major and minor release # in version.py file to test 2.9 and 3.7; correctly selected latest pubsub API.
Did not test on Linux but I used fnmatch which should take care of any os-dependent path separator issues. Let me know what you think.
The pubsub in wx still defaults to old (and I wish, deprecated) API,
where AUTO_TOPIC is not available. To make use of the new pubsub API in
wx.lib.pubsub, you must first import the setupkwargs:
from wx.lib.pubsub import setupkwargs
from wx.lib.pubsub.pub import AUTO_TOPIC
Oliver,
If you would like to add a version check and default to the new API if running in wx 2.9 then I would be open to that change. The 2.9 release series is a good time to introduce a change for the better default behavior.