Pubsub Users
Several users have donated a bit of their time to describe how they use
pubsub in their Python projects.
- Steven Sproat, for Whyteboard, since Feb 2010:
- I’ve been using PyPubSub for around 2 months in my cross-platform
drawing application, Whyteboard (http://launchpad.net/whyteboard). My
Shape models (rectangle, polygons etc) use pubsub to notify the GUI of
any changes to themselves or to request actions be performed on the
canvas (e.g capture user’s mouse), and the GUI responds by updating
various dialogs with this information. This means that my shapes no
longer need to maintain references to the canvas in order to perform
operations on it, and can instead send a message saying “do something”
without caring how it’s done.
- Josh English, for WMS, since 2008:
- I use it in my Writing Management System (joshua.r.english
.googlepages.com/wms). I’m using it to control interfaces, such
as telling the frame to change the status bar, or a notebook to
change a panel. PyPubSub enables me to focus on what data
to pass around my application, rather than how to pass it around.
This makes it easy to put in the finer details of my application.
- Phil Mayes, for Listomax, since 2007:
- Listomax (http://www.listomax.com/) uses version 1 of pubsub for MVC:
multiple View (UI) components may need to change when the Model
changes; simpler than direct calls, lower coupling.
- Mike Driscoll, for PyTimesheet and Zimbra Alerts, since 2007:
- I use wx.lib.pubsub in two internal projects at my employer’s business,
“PyTimesheet” and the “Zimbra Alerts”. I use it to send information
between various frames, such as an options menu back to the main
application that launched it. The main application I use it for though
is a Timesheet program where I use it to tell my program which frame to
display when. Basically when one closes, I need another one to open and
I found that pubsub made this quite trivial. The other program is used
in conjunction with our Zimbra web mail and will pop-up an alert when we
receive an email and it also has an Outlook-like Reminder dialog for
appointments... And thanks for providing such a nice tool for my
arsenal!
- Anthony Floyd, RAVEN, since 200?:
Our project is called “RAVEN”, it’s an analytical and finite-element
analysis program for simulating and analyzing the processing of
composite materials in the aerospace industry. We use pubsub as
the communications backbone. We essentially have a MVC
framework, and use pubsub to have the UI respond to things happening in
the data. However, we also use it to have data objects respond to
changes in other data objects.
We’re quite enamoured with pubsub! It’s proven to be an effective way
to keep the UI out of the backend, and an effective way to keep the
backend modularized.
- Sebastian Zurek, OpenSynergy, since 2007:
- I’m using wx.lib.pubsub module as part of the OpenSynergy framework
(www.opensynergy.pl, temporarily offline) that I am developing,
and I found it VERY usefull. Pubsub is used as the communication layer
betteen the extensions components and the framework, between the Model
and Visual, and between the Visual elements.
- Geoff Gilmour-Taylor, since April 2008:
I use wx.lib.pubsub for a suite of in-house batch conversion tools for
DAISY talking books, called Garden Tools (in-house software for the CNIB
Library, http://www.cnib.ca/en/Services/library/). For MVC,
communication in a wxPython app.
Loose coupling of business logic and GUI. It allows me to trigger
multiple actions on a single message without having to locate and modify
all the places where the message is sent. I was able to add a logging
module that reads the same status messages that are sent to the GUI
without having to modify any of my other code.
- Mike Rooney, for wxBanker, since 2006:
- I use pubsub as the crucial event handling mechanism for wxBanker
(https://launchpad.net/wxbanker). It works well for implementing design
patterns such as MVC where you want to eliminate coupling, since it
doesn’t require that you know specific method names or implementation
details of other classes, modules, or libraries. Pubsub is also great
when you want to make an announcement without requiring that anything
(or how many things) is listening to or acting upon that announcement.
In short, pubsub makes intra-process communication a dream come true.
- QVI (http://www.qvii.com/) for several applications, since 2006:
Here at QVI we use pubsub for most of our wxPython applications (notably
SmartTree), to achieve very lightweight, simple, and readable
communication between classes and modules. One of the nice aspects of
pubsub is how easy it is to incorporate into existing code, and how
well-suited it is for pluggable/modular designs which want to make
announcements about events, but don’t require that or care if any other
module is listening. It makes handling “events” easy, whatever we define
them to be, and removes the need for the handlers to have any specific
knowledge of how the announcements are made or where they came from.
After discovering we could use pubsub independently of wxPython, we also
use it in an application or two that doesn’t use wxPython at all, but
where we still desire a lightweight event handling mechanism (when don’t
you?).
- Oliver, for several applications, since 2004:
We have been using it on several client projects:
- Two applications that show property trees and selected node’s
associated panel
- An application that has several panels in a wizard-like layout
With PubSub, one event occurs due to a mouse click on an icon, and
and all parts of the code that need updating get called with the new
data. This means automatic update of menu items (adding, removing etc),
state in various panels, etc. Gone are the long sequences of calls
through the code.