[wxPython-mac] Re: OGL doesn't interactively drag shapes in 2.9.4.0

Hi,

forward this to wxPython-users in case someone here is willing to

help to update OGL and is not reading the mac list.

Werner
···

-------- Original Message --------
– You received this message because you are subscribed to the Google
Groups “wxPython-mac” group.
To unsubscribe from this group and stop receiving emails from it,
send an email to .
For more options, visit .

Subject:
Re: [wxPython-mac] Re: OGL doesn’t interactively drag
shapes in 2.9.4.0
Date:
Wed, 11 Jun 2014 13:29:50 +0200
From:
Werner
Reply-To:
To:
wernerfbd@gmx.chwxpython-mac@googlegroups.comwxpython-mac@googlegroups.com

Hi Andy,

    Wanted to have a look how this behaves in Phoenix and got all

encouraged when I saw it basically work, but then looked at this
again and I see that you are having the problems on Mac and I am
on Windows.

    I did a PR ()

to get OGL at least to run under Phoenix on both Py2.7 and
Py3.3.
If I read Robin’s comment correctly the problem with OGL is that
it used wxClientDC all over the place and if I look at Chris’
“DrawingWhileMouseMoves” he is using wxMemoryDC and wxPaintDC.
How this all works is over my head, but anyhow I can’t leave it, in other
words would be tempted of giving it a go with some heavy hand
holding. Am I too naive in thinking that all the wxClientDC stuff should
be replaced with wxMemoryDC and a buffer and then use wxPaintDC
in the OnPaint event.
Anyone to ready to do some hand holding and/or taking the lead
on getting OGL modernized?
Werner
On 6/2/2014 10:02, Andy Bulka wrote:

https://github.com/RobinD42/Phoenix/pull/85

:wink:

Hi Chris,

Yes its mac specific.

        Werner encouraged me to file a ticket - so that's been

done, see

        Re the proposal that "the correct solution is to handle

everything in OnPaint handlers, wxClientDC is not the
correct way to handle updates in these situations" - this
sounds like a change to the underlying ogl library.

Gulp - I had a bit of a look and what I see is:

wx/lib/ogl/_basic.py has class Shape which has a
method:

def OnBeginDragLeft (self, x, y, keys = 0,
attachment = 0):

dc = wx.ClientDC(self.GetCanvas())

self.GetCanvas().PrepareDC(dc)

dc.SetBrush(wx.TRANSPARENT_BRUSH)

w, h = self.GetBoundingBoxMax()

        self.GetEventHandler().OnDrawOutline(dc, xx, yy,

w, h)

self._canvas.CaptureMouse()

and the method:

def OnDragLeft (self, draw, x, y, keys = 0,
attachment = 0):

dc = wx.ClientDC(self.GetCanvas())

self.GetCanvas().PrepareDC(dc)

dc.SetBrush(wx.TRANSPARENT_BRUSH)

w, h = self.GetBoundingBoxMax()

          self.GetEventHandler().OnDrawOutline(dc, xx,

yy, w, h)

        Perhaps the above code fragment will provoke some

thoughts as to a fix?

thanks,

Andy

        On Thursday, January 16, 2014 3:19:00 AM UTC+11, Chris

Barker - NOAA Federal wrote:

What platform(s) are you seeing this issue on?

              I have seen similar issues on wxMac with

floatcanvas. I’m site they are fixable, but haven’t
taken the time to fix it. I think it’s a difference in
how ClientDC is(not) implemented under Cocoa.

              It's probably worth digging in to OGL code to

figure this out, if OFL suits your needs well
otherwise.

              I'm sure you'll get help with the details here once

you isolate the code that isn’t working.

-CHB

              On Jan 15, 2014, at 4:52 AM, Andy Bulka <abu...@gmail.com
              >

wrote:

                    Sorry to come back to this issue, but I just

ran my pynsource with wxpython 3.0 and the
same issue with OGL is still there, the outline
of dragged shapes does not render.

The suggestion to run DrawingWhileMouseMoves.py
under
wxpython 2.8 doesn’t help because everything
works fine under wxpython 2.8. Even my
pynsource UML app works fine.

                    I'll try to run that particular example under

wxpython 3.0 tomorrow.

                    The problem is wxpython 3.0 - and the

suggestion that it would take a monumental
update to a 20 year old OGL library to make my
outlines work whilst dragging - well that’s
disappointing. Understandable, but so
tantalisingly frustrating. Everything except
that feature already works ok. I don’t really
want to port pynsource to another
graphing/diagramming library because of this
issue, but ultimately this is what I might have
to do.

                    As I've mentioned, the official OGL demo

under wxpython 3.0 suffers from this same
problem, so the problem is out in the open.

                    So annoying.  I've spent so much time

investing in wxpython and now my project is at
risk because OGL within wxpython is broken in
wxpython 3.0 and seemingly into the future.

                    I don't mean to complain, but I don't have

enough of an understanding of the underlying OGL
library to fix things. I’m just a consumer of
the OGL library.

Does anybody have any further suggestions?

                    Sorry for the long time between posts, and

thanks to all those who have posted so far in
this thread.

                You received this message because you are subscribed

to the Google Groups “wxPython-mac” group.

                To unsubscribe from this group and stop receiving

emails from it, send an email to wxpython-mac...@googlegroups.com.

                For more options, visit [https://groups.google.com/groups/opt_out](https://groups.google.com/groups/opt_out).

    You received this message because you are subscribed to the

Google Groups “wxPython-mac” group.

    To unsubscribe from this group and stop receiving emails from

it, send an email to wxpython-mac+unsubscribe@googlegroups.com.

    For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

http://trac.wxwidgets.org/ticket/16311

wxpython-mac+unsubscribe@googlegroups.com
https://groups.google.com/d/optout

I’d try downloading a directory compare application like ‘Beyond Compare’… then compare OGL directories for each version, and try to see if their was a simple change to the relevant areas of code.

Have you tried adding ‘print’ statements in the pieces of code you highlighted? That’s what I’ve been doing to debug, just make sure all the print statements are unique so you can see the order of processing!

···

On Thursday, June 12, 2014 2:06:58 AM UTC-7, werner wrote:

Hi,

forward this to wxPython-users in case someone here is willing to

help to update OGL and is not reading the mac list.

Werner




  -------- Original Message --------

Subject:
Re: [wxPython-mac] Re: OGL doesn’t interactively drag
shapes in 2.9.4.0
Date:
Wed, 11 Jun 2014 13:29:50 +0200
From:
Werner wern...@gmx.ch
Reply-To:
wxpyth...@googlegroups.com
To:
wxpyth...@googlegroups.com

Hi Andy,

    Wanted to have a look how this behaves in Phoenix and got all

encouraged when I saw it basically work, but then looked at this
again and I see that you are having the problems on Mac and I am
on Windows.

    I did a PR ([https://github.com/RobinD42/Phoenix/pull/85](https://github.com/RobinD42/Phoenix/pull/85)        )

to get OGL at least to run under Phoenix on both Py2.7 and
Py3.3.

    If I read Robin's comment correctly the problem with OGL is that

it used wxClientDC all over the place and if I look at Chris’
“DrawingWhileMouseMoves” he is using wxMemoryDC and wxPaintDC.
How this all works is over my head, but anyhow I can’t leave it :wink: , in other
words would be tempted of giving it a go with some heavy hand
holding.

    Am I too naive in thinking that all the wxClientDC stuff should

be replaced with wxMemoryDC and a buffer and then use wxPaintDC
in the OnPaint event.

    Anyone to ready to do some hand holding and/or taking the lead

on getting OGL modernized?

    Werner





    On 6/2/2014 10:02, Andy Bulka wrote:

Hi Chris,

Yes its mac specific.

        Werner encouraged me to file a ticket - so that's been

done, see http://trac.wxwidgets.org/ticket/16311

        Re the proposal that "the correct solution is to handle

everything in OnPaint handlers, wxClientDC is not the
correct way to handle updates in these situations" - this
sounds like a change to the underlying ogl library.

Gulp - I had a bit of a look and what I see is:

wx/lib/ogl/_basic.py has class Shape which has a
method:

def OnBeginDragLeft (self, x, y, keys = 0,
attachment = 0):

dc = wx.ClientDC(self.GetCanvas())

self.GetCanvas().PrepareDC(dc)

dc.SetBrush(wx.TRANSPARENT_BRUSH)

w, h = self.GetBoundingBoxMax()

self.GetEventHandler(). OnDrawOutline(dc, xx, yy,
w, h)

self._canvas.CaptureMouse()

and the method:

def OnDragLeft (self, draw, x, y, keys = 0,
attachment = 0):

dc = wx.ClientDC(self.GetCanvas())

self.GetCanvas().PrepareDC(dc)

dc.SetBrush(wx.TRANSPARENT_BRUSH)

w, h = self.GetBoundingBoxMax()

self.GetEventHandler(). OnDrawOutline(dc, xx,
yy, w, h)

        Perhaps the above code fragment will provoke some

thoughts as to a fix?

thanks,

Andy

        On Thursday, January 16, 2014 3:19:00 AM UTC+11, Chris > > Barker - NOAA Federal wrote:

What platform(s) are you seeing this issue on?

              I have seen similar issues on wxMac with

floatcanvas. I’m site they are fixable, but haven’t
taken the time to fix it. I think it’s a difference in
how ClientDC is(not) implemented under Cocoa.

              It's probably worth digging in to OGL code to

figure this out, if OFL suits your needs well
otherwise.

              I'm sure you'll get help with the details here once

you isolate the code that isn’t working.

-CHB

              On Jan 15, 2014, at 4:52 AM, Andy Bulka <abu...@gmail.com > > >                   > > > > wrote:
                    Sorry to come back to this issue, but I just

ran my pynsource with wxpython 3.0 and the
same issue with OGL is still there, the outline
of dragged shapes does not render.

The suggestion to run DrawingWhileMouseMoves.py
under
wxpython 2.8 doesn’t help because everything
works fine under wxpython 2.8. Even my
pynsource UML app works fine.

                    I'll try to run that particular example under

wxpython 3.0 tomorrow.

                    The problem is wxpython 3.0 - and the

suggestion that it would take a monumental
update to a 20 year old OGL library to make my
outlines work whilst dragging - well that’s
disappointing. Understandable, but so
tantalisingly frustrating. Everything except
that feature already works ok. I don’t really
want to port pynsource to another
graphing/diagramming library because of this
issue, but ultimately this is what I might have
to do.

                    As I've mentioned, the official OGL demo

under wxpython 3.0 suffers from this same
problem, so the problem is out in the open.

                    So annoying.  I've spent so much time

investing in wxpython and now my project is at
risk because OGL within wxpython is broken in
wxpython 3.0 and seemingly into the future.

                    I don't mean to complain, but I don't have

enough of an understanding of the underlying OGL
library to fix things. I’m just a consumer of
the OGL library.

Does anybody have any further suggestions?

                    Sorry for the long time between posts, and

thanks to all those who have posted so far in
this thread.

                You received this message because you are subscribed

to the Google Groups “wxPython-mac” group.

                To unsubscribe from this group and stop receiving

emails from it, send an email to wxpython-mac...@googlegroups.com.

                For more options, visit [https://groups.google.com/groups/opt_out](https://groups.google.com/groups/opt_out).

    You received this message because you are subscribed to the

Google Groups “wxPython-mac” group.

    To unsubscribe from this group and stop receiving emails from

it, send an email to wxpython-mac...@googlegroups.com.

    For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
  --

  You received this message because you are subscribed to the Google

Groups “wxPython-mac” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to wxpython-mac...@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

Hi,

I posted the latest development on this to the wxPython-dev list as I started the work (in wxPython Phoenix) to change from wx.ClientDC to wx.MemoryDC and wx.DCOverlay as suggested by Robin, Chris and Kevin.

Werner