Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improving the Subplots Tool #4

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

Conversation

OceanWolf
Copy link

Okay, I have now basically achieved what I wanted to, but I have dirtied the lib/matplotlib/backends/backend_gtk3.py a bit, but I guess the not so nice bits will get tidied up by the Backend Plt/Gcf refactor.

Anyway, what do you think? I see a lot of the code in ToolConfigureSubplots getting refactored out into a separate dialog class; also I see the separation of the two tasks of FigureManager, the window logic, and the figure logic into two separate class (and thus undirty it), but I guess that will happen as part of the Gcf refactor...

@@ -464,6 +469,7 @@ def destroy(self, *args):
def show(self):
# show the figure window
self.window.show()
self.window.present()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only real change in functionality that I can see I have made, but logically this feels right to me, that show should always bring the window to the front, whether or not it had already been opened or not. Though feel free to disagree.

@fariza
Copy link
Owner

fariza commented Jan 28, 2015

I like the idea, but I think it would be better to do it after the Plt/GFC refactor.
If the refactoring is well done, we will have a nice window stuff separated from the rest, then this will be easier to implement.

I'm sorry but I will have to pass on this one, it is tempting to do it now, but the more changes we do, the less probable for the PR to be accepted.
I really want the PR to be accepted so I can move on with my multi figure manager, that is my real objective.

@OceanWolf
Copy link
Author

I understand and agree with your comments, I had those concerns also, but the large number of deletions (and very few insertions) to the backend (gtk3) swayed me, together with the comment by @tacaswell matplotlib#2624 (comment)

Do you have any idea how long until the Ptt/Gcf refactor will come out? I.e. do you think it will make it out before more backends get converted?

And yes, I really want to see your navigation thing go through (though I do have a few more suggestions to make).

One last thing, if in the future this does go though, I have one more modification to this PR to commit.

@fariza
Copy link
Owner

fariza commented Jan 29, 2015

I have no idea when the Plt/Gfc refactor will come out.
Other idea that crossed my mind, was to implement the https://github.com/matplotlib/matplotlib/wiki/Mep23 as a new set of separated elements (kind of the refactor). That way, there is no backwards incompatibilities, and a "smooth" migration for the users would be possible.

@fariza
Copy link
Owner

fariza commented Jan 29, 2015

If you want, just make the change to his PR, so the idea is not lost.

@fariza fariza force-pushed the navigation-by-events branch from 1ce296c to aa76457 Compare February 4, 2015 18:02
@fariza
Copy link
Owner

fariza commented Feb 11, 2015

@OceanWolf do you mind rebasing this PR? I want to take another look

@OceanWolf
Copy link
Author

Ooh, sure thing :)! Not right now though, just decided to travel long distance tonight, so busy packing.

In the mean time could you take a look over my most recent PR #9? Then I can rebase and finish #6 :).

@OceanWolf
Copy link
Author

I don't get this rebase, it says I have merge errors in files I haven't touched, i.e. lib/matplotlib/backends/backend_tkagg.py. Confused...

@fariza
Copy link
Owner

fariza commented Feb 13, 2015

Are you rebasing against my branch? or against master?
In my case, in the last rebase I had the same problem, because in upstream (matplotlib/master) there was a conflict with an early modification to that file, from the time I was trying to carry both backends at the same time.

Actually what I was trying to do to resolve the problem was to remove my modifications to that file from the repository, but messing with history is dark magic.

So, what I recommend is just open the file, and resolve the conflict removing my part that is in conflict

@OceanWolf
Copy link
Author

Yes, against your branch.

git checkout navigation-by-events
git fetch upstream
git merge --ff-only navigation-by-events
git checkout navigation-by-events-subplots-tool
git rebase navigation-by-events

It gives me warnings about 5 lines containing whitespace errors and fails to merge Patch failed at 0001 tk backend. I think this happens because I rebase from a rebase, which means that your history has changed, and thus the diff looks to the wrong commits to compare with... when you look above to what github now sees as the files changed, you see it thinks that I want to add the entirety of navigation... very bizarre, it seems unable to a diff and see that no differences exist...

Should I try and delete my branch locally and rebranch from navigation-by-events? I could then do a git push --force.

And remove the Tk work? Updating the Tk work comes as the next task on my hit list of PRs, i.e. after my internal meddlings.

@fariza
Copy link
Owner

fariza commented Feb 13, 2015

I wanted to remove the Tk work and leave it for when the main PR is accepted, but honestly I didn't know how to do it.
I don't want to maintain two different backends while developping the mechanics

@fariza
Copy link
Owner

fariza commented Feb 13, 2015

Regarding the rebase, I find that sometimes it is easier to just create a new branch, instead of trying to keep up with conflicts like this.

@OceanWolf
Copy link
Author

Yes, I think I will make a new branch, while the commits/files changed looks a mess on github, naturally as I haven't rebased, it looks fine locally. I wonder if I should do the following (even wondering if it will work):

git checkout navigation-by-events-subplots-tool
git checkout -b navigation-by-events-subplots-tool-backup
git checkout navigation-by-events
git branch -d navigation-by-events-subplots-tool
git checkout -b navigation-by-events-subplots-tool
code code code
git commit -a
git push origin --force

i.e. the aim of pushing back to this PR, but with a new fresh history.

And yes, I completely agree with you on not working on Tk while developing internal mechanics, it makes no sense with it all in flux, though as I say, I see that stage as almost over, then I see no reason why not to get Tk patched up. Both because of external mechanics, i.e. with specific tools, I want to see if they will work on both backends; and because it feels nice to have a fully polished PR to show to the owners, the (i.e. not a, it works, but don't look there, or there thing).

@fariza
Copy link
Owner

fariza commented Feb 27, 2015

@OceanWolf Do you mind to give it a try to rebase or recreate this PR? I am interested in your work on the window stuff, I am pretty sure I will need this for my multifiguremanager

@OceanWolf
Copy link
Author

Sure, I really want to give this a rebase ASAP, but first I want to get the window stuff redone, as this subtool basically added some nasty hacks because of the lack of a WindowBase, so I want to get that work done first. It shouldn't take too much longer to get it to a finished state with all the backends. The more backends I upgrade the faster it will go.

I haven't done anything weird with the code, all fully backwards compatible, just like MEP22. But unlike MEP22, a pure refactor, no change in behaviour, no extra features, so I think/hope it will get accepted quite easily. Interested in your comments, but please put them into that PR, I would like to keep comments as concentrated as possible. Also note that the closer the code lies to the backends, the more likely it will change as I refactor more backends. Hoping to get Tk finished today, very nearly done :).

@OceanWolf
Copy link
Author

Naturally once I have completed this refactor, if it looks like it will take a while to get the thumbs up, then I shall move on to this regardless, but I would like to get refactored window code sitting there first.

@fariza fariza force-pushed the navigation-by-events branch 2 times, most recently from a88dc2d to 5eae4e1 Compare April 7, 2015 19:14
@fariza fariza closed this Apr 13, 2015
@OceanWolf OceanWolf deleted the navigation-by-events-subplots-tool branch July 25, 2015 20:21
fariza pushed a commit that referenced this pull request Nov 19, 2015
MNT: use IPython's signature if needed + available
fariza added a commit that referenced this pull request Sep 22, 2016
fariza pushed a commit that referenced this pull request Dec 5, 2017
This fixes some possible heap buffer overflows, such as the following
triggered by our cmmi10.ttf:

```
ERROR: AddressSanitizer: heap-buffer-overflow on address 0x617000235709 at pc 0x7f95efd3c48a bp 0x7ffe41b6ecc0 sp 0x7ffe41b6ecb0
READ of size 1 at 0x617000235709 thread T0
    #0 0x7f95efd3c489 in utf16be_to_ascii extern/ttconv/pprdrv_tt.cpp:178
    #1 0x7f95efd3c489 in Read_name(TTFONT*) extern/ttconv/pprdrv_tt.cpp:339
    #2 0x7f95efd499ef in read_font(...) extern/ttconv/pprdrv_tt.cpp:1325
    #3 0x7f95efd4c602 in get_pdf_charprocs(...) extern/ttconv/pprdrv_tt.cpp:1420
    #4 0x7f95efd35c22 in py_get_pdf_charprocs src/_ttconv.cpp:217

0x617000235709 is located 1 bytes to the right of 648-byte region [0x617000235480,0x617000235708)
allocated by thread T0 here:
    #0 0x7f9612262a38 in __interceptor_calloc (/usr/lib64/libasan.so.4+0xdea38)
    #1 0x7f95efd3b261 in GetTable(TTFONT*, char const*) extern/ttconv/pprdrv_tt.cpp:140
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants