Josiah Carlson ([info]chouyu_31) wrote,
@ 2008-03-03 09:26:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Entry tags:software

PyPE
At some point in the future, I presume I will have some free time. There are a few things I would like to do with PyPE so as to help support the tasks that I have been doing recently.


Among the changes that I'm planning on is to replace the hodge-podge of events/notifications with a unified architecture. Basically using wx.lib.pubsub (a publish/subscribe architecture) to handle event notifications and plugin callback processing.

I'm also looking to switch to a better scheduling system to handle little things like auto-refreshes (parsing/spell checking/etc.). Currently I use a wx.Timer() instance, but it seems as though over long periods of time, timers leak, and the Python process begins to take up more and more processor time. Because there are easy ways around wx.Timer() instances, I may as well exploit those.

I'm also looking to change the way I do widget layout. Some of you may be thinking, "finally, he's going to use XRC to define layout". No, I'm not. I'm going to be using an idea I had when Python 2.5's context managers were just being thought up; in-code hierarchy-based layout...

with Panel(name='toplevel') as p:
    with HorizontalSizer:
        add(Label('entry 1:'))
        add(SPACE)
        add(Text(name='entry'))


Only the plan is to do it without context managers (so it's Python 2.3+ compatible). Basically, you use all of the same stuff, but instead of using 'with', you use 'for'. The effect is that by using for p in Panel(name='toplevel'), p will leak into the surrounding scope. I'm not worried.

What's even better is that if I write the wrapper objects correctly, I get an automatic object hierarchy created (toplevel.entry in the above for the text box), as well as simple event bindings ( pub.subscribe('toplevel.entry.event', myfcn) ).


Some will say, but Josiah, that sounds *a lot* like MVC/MVP design! To that I say somewhat, only without the code ugly that typically follows MVC/MVP design. If I ever get around to actually making it happen, the code will actually be visually appealing.


Now all I need is a month of down time to make it happen.


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…