-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
make wx backends compatible with wxPython-Phoenix #3421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make wx backends compatible with wxPython-Phoenix #3421
Conversation
@@ -667,8 +665,6 @@ class FigureCanvasWx(FigureCanvasBase, wx.Panel): | |||
wx.WXK_DELETE : 'delete', | |||
wx.WXK_HOME : 'home', | |||
wx.WXK_END : 'end', | |||
wx.WXK_PRIOR : 'pageup', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did these get removed? (sorry if this was already covered)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have been deprecated a long time ago.
On a quick scheme, it looks like all of the changes are simple re-naming of functions. The logic to pick which one should be centralized in one place, probably at the top of
And then
We should also do enough compatibility munging that the user-code does not care which version of wx is being used. |
Sorry, don't understand the last comment. |
That was just the first example I hit when scrolling down the code. The point is to centralize all of the version logic in one place, instead of scattered through out the code where it is used (see what we do with qt_compat which smooths over the differences between pyqt4, pysides and pyqt5). It will make the code more readable and easier to fully deprecate the old api in the future. |
I had a quick look at qt_compat and I am not sure that I am the right person to make such a change. |
Why? You have already done the hard part. I am just asking that centralize it to improve readability and maintainability. |
O.K., I actually started on it and I am making progress. On the backend_wx and backend_wxagg files I get the following warning when I commit, but not on e.g. the sample files, is this a problem on my side or?: |
Did the wx_compat.py changes in a new branch locally. What do you prefer that I update this PR or close it and create a new one? |
I wouldn't worry too much about line endings at this point. It is probably a mixture of windows vs. unix line endings in the codebase. We can always feed the files through a converter when we are done. As for the wx_compat.py changes, just keep making them in this same branch and push them up to your repo. GitHub will track the branch and update this PR automatically. "PRs are the beginning of the conversation!" |
I don't understand the failure report on Travis. The failure seems to be in the test and not the backend_wxagg.py file. |
You need to remove the file from the black list. It is complaining a file that should fail is passing. |
I only use the wxagg backend, so just noticed while testing that the wx backend is broken when I use wxPython 2.9+, it seems to work with 2.8.12. |
The wx backend works for me with wxPython 3.0 and (wxWidgets 3.01) i.e. doing:
In IPython works as expected. |
I use embedding_in_wx2 for testing and activate these lines (and commend the WXAgg lines): matplotlib.use('WX') If this works for you too then I must have messed something up. |
embedding_in_wx2 works for me with both the WX and WXAgg backend but the toolbar is missing unless I remove the OSX workaround. (Im on a mac with OSX 10.9), Perhaps that is no longer relevant. It mentions OS X 10.3 |
I am on Windows (8.1), so it is a specific to that platform. BTW, just tested with MPL 1.3.1 and I see the same issues. Will concentrate on more wxAgg testing and later come back to this issue. I suspect some issues with sizer handling as that is something which has changed in 2.9+. |
I can still not find a solution for the wxPython 2.9+ issue (no graph shown) when using the 'WX' backend. This only seems to happen on Windows as Jens doesn't see it on OSX. In 2.9.0 the DC code was reorganized in wxWidgets - http://wxpython.org/Phoenix/docs/html/DC.html, but searching the mail lists and googling didn't help me finding a solution. Hopefully someone with better wxPython know how will find a solution. |
I found the reason for the 'wx' backend not showing the graph on windows. The MemoryDC is held due to the _cache in GraphicsContextWx a hack is to do this in gui_repaint: dc, gc = self.renderer.gc._cache.pop(self.bitmap) before calling DrawBitmap. Why are we caching the GC, in my tests there is always only one Bitmap and therefore only one entry in the cache. |
58d4c2c
to
970c774
Compare
With these latest changes the 'WX' and 'WXAgg' backends work for me on Windows with wxPython 2.8.12.1, 2.9, 3.0.1.1 and 3.0.2 Phoenix with Python 2.7.8 Would be great if this could be tested on Mac and Linux. Hope to test it soon on Windows with Py3.4 |
Great to hear! |
Did an initial test with embedding_in_wx2 using Python 3.4 with Phoenix build 3.0.2.dev77889 both on Windows and Linux Mint 17 and they worked for both 'WX' and 'WXAgg' backends. |
Do I need to do anything more on this? |
Any change of getting it into 1.4.3? |
At a mimimum his needs a re-base |
9eafca6
to
758f826
Compare
The failure in 3.4 is: Can someone help me figure this one out? |
@wernerfb That's most likely a random test fail. I have restarted the travis instance. |
You can ammend a commit message this way, if you wish: On Thu, Apr 23, 2015 at 4:29 AM, Jens Hedegaard Nielsen <
|
great job squashing! One thing I just noticed. Could you please put back the |
Great! @tacaswell this probably needs a whats_new entry in the documentation, right? After that, I think we are all good. |
Yes. I think you can look at the entry for qt5 from the 1.4 release cycle for a template. |
@wernerfb Thank you for bearing with us through what has ended up being a very long process! |
@tacaswell no problem. Re entry for what's new, you want me to do that? If yes, is the correct file 'whats_new.rst'? |
Please create a new file in On Fri, Apr 24, 2015 at 12:41 PM Werner F Bruhin [email protected]
|
wxPython Phoenix needs a current snapshot and works on Python 2.7 and 3.4+. | ||
|
||
User code is responsible to set the wxPython version you want to use, see for | ||
example the `examples\user_interfaces\embedding_in_wx2.py`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused by this statement. Nowhere do I see in that example a line of code that sets a version of wxPython. In fact, such a line that could be construed as doing that is commented out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hhm, the comment explains the two methods I know on how to select a specific version of wxPython. Either set the version in wx.pth in site-packages or uncomment the two lines to use wxversion.
Would this be better?
"User code is responsible to set the wxPython version you want to use, how to do this
is explained at the beginning of examples\user_interfaces\embedding_in_wx2.py
."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"to set" --> "for setting". I would also make it clear that the user
doesn't have to set anything if they want just the default. The language
here could spook some people into thinking that they may have to specify
this, and/or that they have to update existing code.
On Tue, Apr 28, 2015 at 10:56 AM, Werner F Bruhin [email protected]
wrote:
In doc/users/whats_new/updated_backend_wx.rst
#3421 (comment):@@ -0,0 +1,10 @@
+wx backend has been updated
+---------------------------
+The wx backend can now be used with both wxPython classic and
+Phoenix <http://wxpython.org/Phoenix/docs/html/main.html>
__.
+
+wxPython classic has to be at least version 2.8.12 and works on Python 2.x,
+wxPython Phoenix needs a current snapshot and works on Python 2.7 and 3.4+.
+
+User code is responsible to set the wxPython version you want to use, see for
+example theexamples\user_interfaces\embedding_in_wx2.py
.Hhm, the comment explains the two methods I know on how to select a
specific version of wxPython. Either set the version in wx.pth in
site-packages or uncomment the line two lines to use wxversion.Would this be better?
"User code is responsible to set the wxPython version you want to use, how
to do this
is explained at the beginning of
examples\user_interfaces\embedding_in_wx2.py."—
Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/3421/files#r29250782.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should say something like
"If you have multiple versions of WX (python ) installed the users is responsible for setting ..."
wxPython Phoenix needs a current snapshot and works on Python 2.7 and 3.4+. | ||
|
||
If you have multiple versions of wxPython installed, then the user code is | ||
responsible to set the wxPython version you want to use. How to do this is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"to set" --> "for setting". Nix "you want".
ping @wernerfb ? Looks like we only have one little typo, "to set" --> "for setting", and a little bit more clarification in the whats_new doc. If you have run out of time for this, let me know and I will see what I can do to wrap this up. |
@WeatherGod will get to it in the coming week, was away on vacation. |
make wx backends compatible with wxPython-Phoenix
@wernerfb Great job! Thank you for your patience. I think the extra attention to detail here will really pay off! Cheers! |
@tacaswell could you please maybe have a look on my issue too? this seems to be more than my knowledge (as beginner) |
This is based on the comments made to my previous PR for this.
Note that wxPython Phoenix snapshots can now be installed with pip:
pip install -U --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix