Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add icon to macosx backend #14851

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

Closed
dstansby wants to merge 1 commit into matplotlib:master from dstansby:osx-icon
Closed

Conversation

Copy link
Member

@dstansby dstansby commented Jul 18, 2019

Will fix #14850.

@@ -281,6 +281,9 @@ static void lazy_init(void) {
NSApp = [NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];

NSImage* icon = [[NSImage alloc]initWithContentsOfFile:@"/Users/dstansby/github/matplotlib/lib/matplotlib/mpl-data/images/matplotlib_large.png"];
Copy link
Member Author

Choose a reason for hiding this comment

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

The next thing is to work out how to get this absolute path properly instead of hardcoding it for my laptop! Does anyone have any ideas?

Copy link
Contributor

@anntzer anntzer Jul 18, 2019
edited
Loading

Choose a reason for hiding this comment

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

Perhaps something like (untested)

PyObject* mpl = NULL, * data_path_str = NULL, * data_path_bytes = NULL;
char* data_path;
if (!(mpl = PyImport_ImportModule("matplotlib")) ||
 !(data_path_str = PyObject_CallMethod(mpl, "get_data_path", NULL)) ||
 !(data_path_bytes = PyUnicode_EncodeFSDefault(data_path_str)) ||
 !(data_path = PyBytes_AsString(data_path_bytes))) {
 goto exit;
}
// at that point data_path contains everything up to mpl-data,
// then you need to concatenate whatever e.g. with strcat.
exit:
Py_XDECREF(mpl);
Py_XDECREF(data_path_str);
Py_XDECREF(data_path_bytes);

Copy link
Member

Choose a reason for hiding this comment

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

Can we not pass it in somehow, like done with navigation toolbar icons?

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

Marking as request changes to make sure the hard-coded path does not get merged!

dstansby reacted with thumbs up emoji
Copy link
Member Author

I think this will be superseeded by #14930

@QuLogic QuLogic modified the milestones: v3.3.0, v3.4.0 May 2, 2020
Copy link
Member Author

Going to close in favour of #14930.

@QuLogic QuLogic modified the milestones: v3.4.0, unassigned Jun 26, 2020
@dstansby dstansby deleted the osx-icon branch December 28, 2021 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@QuLogic QuLogic QuLogic left review comments

@anntzer anntzer anntzer left review comments

@tacaswell tacaswell tacaswell requested changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

No icon showing up with macosx backend

AltStyle によって変換されたページ (->オリジナル) /