Discussion:
Phoenix - OGL rework to not use ClientDC all over the place
Werner
2014-06-12 16:33:37 UTC
Permalink
Hi,

I had a go at this.

- replace all the wx.ClientDC with wx.MemoryDC and a buffer
- in ShapeCanvas.OnSize the buffer is created based on window size
- a ShapeCanvas.Draw was added which updates the buffer with the current
diagram
- in ShapeCanvas.OnPaint a BufferedPaintDC is used to draw the buffer to
the screen

Problems I could not solve yet:
- outline when moving doesn't show or I get tons of them if change
Shape.OnDrawOutline to draw to ClientDC (I know I shouldn't but ..)
- when moving an object it only moves after another click

Anyone has some hints on where I should look for the above two problems?

Will tomorrow clean up the code changes and do a PR for all this, even
if I have not resolved the two problems.

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kevin Ollivier
2014-06-12 17:00:49 UTC
Permalink
Hi Werner,
Post by Werner
Hi,
I had a go at this.
- replace all the wx.ClientDC with wx.MemoryDC and a buffer
- in ShapeCanvas.OnSize the buffer is created based on window size
- a ShapeCanvas.Draw was added which updates the buffer with the current diagram
- in ShapeCanvas.OnPaint a BufferedPaintDC is used to draw the buffer to the screen
- outline when moving doesn't show or I get tons of them if change Shape.OnDrawOutline to draw to ClientDC (I know I shouldn't but ..)
- when moving an object it only moves after another click
I think wx.OverlayDC was the wx.ClientDC replacement for these cases where you truly do want to draw "above" the UI. Not sure if it was ever fully working cross-platform though.

Thanks,

Kevin
Post by Werner
Anyone has some hints on where I should look for the above two problems?
Will tomorrow clean up the code changes and do a PR for all this, even if I have not resolved the two problems.
Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Chris Barker
2014-06-12 17:40:22 UTC
Permalink
On Thu, Jun 12, 2014 at 10:00 AM, Kevin Ollivier <
Post by Werner
Post by Werner
- outline when moving doesn't show or I get tons of them if change
Shape.OnDrawOutline to draw to ClientDC (I know I shouldn't but ..)
Post by Werner
- when moving an object it only moves after another click
indeed -- in FloatCanvas, and other experiments, I couldn't get the
recommended "draw everything in a paintDC" method to work for really
responsive updating as the mouse moved.

So I still use a ClientDC for that -- though there is a bug on Mac now....
Post by Werner
I think wx.OverlayDC was the wx.ClientDC replacement for these cases
where you truly do want to draw "above" the UI. Not sure if it was ever
fully working cross-platform though.
Yup -- I"ve been intending to use that in FC for years.

It doe swork cross-platform, though it works a bit differently on each
platform, and it's uglier than (I think) it should be. You can't just
create one, and draw to it an be done...

But it can work.

There are two Overlay tests/demos here:

https://github.com/PythonCHB/wxPythonDemos

Overlaytest.py
Overlaytest2.py

They are a couple years old, and I'm not entirely sure I ever got them
workign really properly, but its a starting place.

-Chris
--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

***@noaa.gov
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-06-12 17:44:46 UTC
Permalink
Hi Chris and Kevin,

I'll look into this and see how far I get.

Thanks
Werner
Post by Chris Barker
On Thu, Jun 12, 2014 at 10:00 AM, Kevin Ollivier
Post by Werner
- outline when moving doesn't show or I get tons of them if
change Shape.OnDrawOutline to draw to ClientDC (I know I shouldn't
but ..)
Post by Werner
- when moving an object it only moves after another click
indeed -- in FloatCanvas, and other experiments, I couldn't get the
recommended "draw everything in a paintDC" method to work for really
responsive updating as the mouse moved.
So I still use a ClientDC for that -- though there is a bug on Mac now....
I think wx.OverlayDC was the wx.ClientDC replacement for these
cases where you truly do want to draw "above" the UI. Not sure if
it was ever fully working cross-platform though.
Yup -- I"ve been intending to use that in FC for years.
It doe swork cross-platform, though it works a bit differently on each
platform, and it's uglier than (I think) it should be. You can't just
create one, and draw to it an be done...
But it can work.
https://github.com/PythonCHB/wxPythonDemos
Overlaytest.py
Overlaytest2.py
They are a couple years old, and I'm not entirely sure I ever got them
workign really properly, but its a starting place.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
--
You received this message because you are subscribed to the Google
Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-06-12 18:36:55 UTC
Permalink
Hi,

The DCOverlay did the trick.

I did a PR for my current version, not fully working. After moving more
then one object the previously moved objects move to their original
position and it needs another mouse click to get the positions all
correct again.

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

Will continue on this over the next few days, but if someone on a Mac
(Andy;-) ) could give this try to see if it goes in the right direction.

Werner

P.S.
I am working on Python 3.3 and Phoenix, but I think it will work against
wxPython Classic too.
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-06-13 07:38:25 UTC
Permalink
Hi,

Just updated the PR (https://github.com/RobinD42/Phoenix/pull/87).

- don't clear the DCOverlay as this resets it to its last initialized
state which was the cause of the moved shapes showing up in the old
position.

Have to take back that the code would work in Classic, things like
EmptyBitmap are now just Bitmap in Phoenix.

But using Phoenix to test shouldn't be too difficult, to install just
run pip from your Python version (2.7, 3.3 or 3.4), previous to 3.4 you
have to install pip yourself:

pip install -U --pre -f http://wxpython.org/Phoenix/snapshot-builds/
wxPython_Phoenix


Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-06-13 09:21:11 UTC
Permalink
Hi,

I am stumped on the following.

- move an object, all works fine, click the moved object again to get
rid of the handles
- move another object, all works fine, but do not click it again, it
still shows the handles
- move a third object, the outline shows, but when one releases the
mouse the object shows in the old position, have to click any object
again to have it move.

In the old version the handles of the previously selected object cleared
when one selected another object, but I just can't figure out why this
is not the case now.

Any ideas are very welcome:-) .

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-06-13 10:18:54 UTC
Permalink
Post by Werner
Hi,
I am stumped on the following.
- move an object, all works fine, click the moved object again to get
rid of the handles
- move another object, all works fine, but do not click it again, it
still shows the handles
- move a third object, the outline shows, but when one releases the
mouse the object shows in the old position, have to click any object
again to have it move.
In the old version the handles of the previously selected object
cleared when one selected another object, but I just can't figure out
why this is not the case now.
I had added a self.Draw in the canvas.OnMouseEvent at the wrong
indentation level.

So, on Windows at least I see the same behaviour as in the old version,
hopefully it fixes also the issue on outline not showing on mac.

But it will be good if someone who uses it currently does more testing
with this.

In the mean time I will work on updating the documentation to the Sphinx
format and try to improve it a bit.

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...