.comment-link {margin-left:.6em;}

Thursday, May 17, 2007

 

theft and programming

because theft is part of programming... zooming isn't a big deal but I might do it because I can, if it works... I will delete this post later\\

I have an ogl app which has zooming. I override GetDC and PrepareDC like
this:

def GetDC(self):
dc = wx.ClientDC(self)
self.PrepareDC(dc)
return dc

def PrepareDC(self, dc):
ogl.ShapeCanvas.PrepareDC(self, dc)
dc.SetUserScale( self.zoom, self.zoom )

I did the project some months ago, so I am not sure about the caveats. I
think you need to redraw the shapes + lines after you've set the zoom
factor.
With a bit of work ogl can do a lot of nice things. Reading the source in
wx.lib helps tremendously when messing with ogl.
In my project the shapes are not self-drawn, but wx.Panels (or other wx.
objects). This allows me to reuse a lot of widgets. Maybe you want to look
at a similar approach. If you have lots and lots of shapes you might want
to optimize this approach a bit to save window resources.
My wx.Panels hold a wx.PropertyGrid and I can attach lines to each
property. You can achieve behaviour like this by hooking into the
connection point stuff. There are probably many more possibilities to
extend ogl.
You are right though, the docs are not beautiful, the source code isn't
too cleanly structured because of it's C++ ancestry and it's difficult to
hook into several things.
I never dealt with FloatCanvas, so it might be the better choice for you.
I just wanted to say that ogl can do what you want although you might have
to put a bit of effort into it.

Labels:


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?