Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

use Qt window title as default savefig filename #908

Merged
merged 9 commits into from

4 participants

@mspacek

When in IPython, I tend to set my figure window title to the last command entered in IPython, ostensibly the command used to generate the figure. When I save the figure, I like to use the same string for the filename, but I've always had to punch that in manually. This patch automates this, but only for the Qt backend, since I'm not familiar with any others. For the typical figure where the user doesn't change the window title, the default filename is now the slightly more descriptive "Figure_x" instead of just "image".

@pelson
Collaborator

A very pertinent mailinglist post: http://old.nabble.com/How-to-give-a-name-to-a-figure--td19498850.html .

I think this pull request should include the definition of an interface to get the window title (as suggested in the mailing list) in a general way in the backend_bases.py, and that your changes make qt the first implementer of the new interface (hence, other backends could then follow suit in time).

lib/matplotlib/backends/backend_qt.py
@@ -431,8 +431,10 @@ def save_figure(self, *args):
sorted_filetypes = filetypes.items()
sorted_filetypes.sort()
default_filetype = self.canvas.get_default_filetype()
+ default_filename = self.canvas.window().windowTitle() or 'image'
+ default_filename.replace(' ', '_')
@pelson Collaborator
pelson added a note

Careful here. Replace is not done in place:

>>> a = 'foo bar'
>>> a.replace(' ', '_')
'foo_bar'
>>> a
'foo bar'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
lib/matplotlib/backends/backend_qt4.py
@@ -555,8 +555,10 @@ def save_figure(self, *args):
sorted_filetypes = filetypes.items()
sorted_filetypes.sort()
default_filetype = self.canvas.get_default_filetype()
+ default_filename = self.canvas.window().windowTitle() or 'image'
+ default_filename.replace(' ', '_')
@pelson Collaborator
pelson added a note

Ditto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mspacek

Whoops, I've made that string in-place error before. Strange thing was it didn't show up in testing. That was because it was actually a QString, for which replace() is in-place apparently :)

I agree, there should be a canvas.get_window_title() method. Should be easy enough to add, at least for qt. I'll get to it shortly.

@pelson
Collaborator

That was because it was actually a QString, for which replace() is in-place apparently :)

Ouch. Thanks for the clarification.

@mspacek

OK, FigureCanvasBase and FigureManagerBase now both have a get_window_title() method. The qt4 backend's FigureCanvasQT overrides it. I've left it undefined for the qt backend, since I don't really know how to get the window title (I presume the qt backend is for qt3), and a quick google search didn't bring up a caption() or getCaption() method analogous to qt3's setCaption() method.

My only concern is that perhaps get_window_title() and set_window_title() should raise NotImplementedErrors in FigureCanvasBase, instead of just using pass. That way, users won't be confused by silent errors on backends for which these methods aren't defined.

@mdboom
Owner

Yes -- I think the base class should raise NotImplementedError. It would be great to implement this in at least the major GUI backends (wx, gtk, gtk3, tk, qt4) if possible -- historically, the backends tended to lose feature parity when we don't take care of these things right away. I can probably find some time in the next few days to look at that and extend this PR if you don't have a chance.

@mspacek

OK, done. Sure, if you (or anyone else) with access to the other backends could implement them, that would be great.

@pelson
Collaborator

@mspacek I have sent you a pull request, against this branch, which implements the title in the remaining backends. I have been able to test on a Linux (standard Ubuntu 12.04) machine.

lib/matplotlib/backend_bases.py
@@ -2077,6 +2088,15 @@ def set_window_title(self, title):
if hasattr(self, "manager"):
self.manager.set_window_title(title)
+ def get_default_filename(self):
+ """
+ Return a string, which includes extension, suitable for use as
+ a default filename.
+ """
+ default_filename = self.get_window_title() or 'image'
+ default_filename = default_filename.replace(' ', '_')
@pelson Collaborator
pelson added a note

As you probably guessed, I would prefer the filename to be lower case for the same reason that the spaces have been removed. Having said that, I'm not overly fussed if you would prefer to keep mixed case.

@mdboom Owner
mdboom added a note

I think I agree with the lowercase thing. It's more of a gut feeling though -- and part of me feels like it should be lower case on Unix and mixed case on Windows, but that's probably a bad idea ;)

@mspacek
mspacek added a note

I guess I disagree with going lowercase because it's a loss of information, but I'm outnumbered, so I'll change it back :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mdboom
Owner

This looks great. Just tested all GUI backends on Linux and seems to work as advertised.

lib/matplotlib/backend_bases.py
((11 lines not shown))
def set_window_title(self, title):
"""
Set the title text of the window containing the figure. Note that
this has no effect if there is no window (eg, a PS backend).
"""
- pass
+ raise NotImplementedError
@pelson Collaborator
pelson added a note

One thing I am not able to test is the impact of this line. For instance, does the MacOS backend blow up now before any plot is produced? Are there other backends which we don't have sight of which will have this method called, with the obvious impact of having an unexpected exception raised?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mspacek

@pelson, I guess the point is we want an exception to be raised, so that it doesn't fail silently. And then if reports of failure come back, they can be dealt with as needed?

It seems there isn't a get_window_title or set_window_title in FigureManagerMac. Maybe I should add them both and print a warning? I suppose set_window_title was never implemented, and I don't see it hidden anywhere in _macosx.FigureManager in _macosx.m.

@mdboom
Owner

I think @pelson raises a good point about raising NotImplementedError. Maybe get_window_title should instead return some reasonable default in the base class so backends don't add them will continue to work -- with effort of course being put into bringing all the backends in line. I'm unfortunately not a regular Mac user (I have a shared work machine I can fire up on occasion). We should try to get the Mac OS-X backend updated if possible. (It's always a tricky one to get done, since it's the only non-cross-platform backend).

@mspacek

OK. What would be a reasonable default in the base class? A warning? Or should I just restore it to pass?

@mdboom
Owner

I think get_window_title should return "image" to maintain the old behavior, which was to use "image.png" as the default filename. set_window_title should probably emit a warning, but otherwise do nothing. That's just my 2c -- there might be an even better way.

@mspacek

Returning "image" on get_window_title in the base class seems reasonable to me.

The other thing to consider is that we probably want to keep the previous behaviour of nothing happening when set_window_title is called on a non-GUI backend, which is sort of a vote for calling pass instead of raising a warning. I suppose there should really be a subclass for non-GUI backends that would override the warning in the base class with a pass.

@mdboom
Owner

Good point about the warning. Let's just make it "pass".

Anyone have OS-X and want to tackle implementing this in the mac osx backend?

@jkseppan
Collaborator

There's a (very lightly tested) attempt for OSX in jkseppan:default_filename: jkseppan@8046c39

@pelson
Collaborator

@jkseppan: Great stuff! What setup have you been able to test it on?

@jkseppan
Collaborator

(I updated the commit: jkseppan@08dd29. I submitted it as a pull request to your branch, so you can pull it and this request should automatically update.)

Mac OS X version 10.6.8, Python 2.7 installed from a python.org package:

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

As a test, I run:

from matplotlib import pyplot
fig=pyplot.figure()
fig.canvas.set_window_title(u'Hääyöaie')
pyplot.show()

and then click on the save icon. The save window now defaults to "hääyöaie.png" as the filename (though the extension is hidden by default).

@mspacek

Great, thanks for that! I don't understand much in the .m file, but trust that it works.

@mdboom
Owner

Great! As this now includes all of the major backends, I think this is probably ready to merge. @mspacek: Any remaining issues you're aware of? Can you do a fresh rebase on master?

@pelson
Collaborator

@mdboom: We've not had any confirmation that this works on windows yet - but we might just have to bite the bullet and merge.
@jkseppan: Were you able to test any of the other backends on your Mac?

@jkseppan
Collaborator

Not so far, because I had trouble installing the various backend requirements on a Mac - but I'm installing some of them via MacPorts now, so I should get to testing the backends soon.

@jkseppan
Collaborator

I was able to test with TkAgg and GtkAgg (Python 2.7.3 installed via MacPorts). Both work; in GtkAgg I can't set the title to a unicode string.

MacPorts is still installing the dependencies for Qt, but I couldn't get WxPython to work via MacPorts.

@jkseppan
Collaborator

With the Qt4Agg backend, the save dialog simply does not appear (Python 2.7.3 via MacPorts).

@mdboom
Owner

@jkseppan: Interesting. Is the Qt4Agg problem specific to this branch, or is that true on master as well?

@mspacek

@mdboom, nope, no issues that I know of, at least on Qt4Agg in Linux. I hope I've rebased correctly.

@jkseppan
Collaborator

@mdboom: The same problem occurs on latest master without this change. Getting the dependencies right on OSX is notoriously difficult, so I suspect I have some problem with how I've installed Qt.

@pelson
Collaborator

@jkseppan: Thanks for all your work on this, its been really valuable to test at least one other OS. The Qt issue sounds like a separate issue to this PR, so unless we can get a windows tester on board, this change has my +1.

@pelson
Collaborator

@mdboom & @jkseppan: What do you think? Shall we go for the merge?

@mdboom: I assume there is no current means of writing a unit test for this functionality?

@jkseppan
Collaborator

I agree, go ahead and merge.

@jkseppan
Collaborator

Update: using homebrew, I have been able to test on OSX 10.6, Python 2.7.3, with the following backends:

try_gtk.py:matplotlib.use('GtkAgg')
try_osx.py:matplotlib.use('MacOSX')
try_qt.py:matplotlib.use('Qt4Agg')
try_tk.py:matplotlib.use('TkAgg')
try_wx.py:matplotlib.use('Wx')

Out of these, only Wx fails (so does WxAgg). I don't see a toolbar, and when I press the s key to save, I get a NotImplementedError. I wonder if I'm doing something wrong?

In any case, I'm still in favor of merging.

backend WX version 2.9.3.1
/opt/homebrew/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/backends/backend_wx.py:1412: wxPyDeprecationWarning: Using deprecated class. 
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/backends/backend_wx.py", line 1264, in _onKeyDown
    FigureCanvasBase.key_press_event(self, key, guiEvent=evt)
  File "/opt/homebrew/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/backend_bases.py", line 1608, in key_press_event
    self.callbacks.process(s, event)
  File "/opt/homebrew/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/cbook.py", line 312, in process
    proxy(*args, **kwargs)
  File "/opt/homebrew/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/cbook.py", line 239, in __call__
    return mtd(*args, **kwargs)
  File "/opt/homebrew/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/backend_bases.py", line 2418, in key_press
    key_press_handler(event, self.canvas, self.canvas.toolbar)
  File "/opt/homebrew/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/backend_bases.py", line 2336, in key_press_handler
    toolbar.save_figure()
  File "/opt/homebrew/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/backend_bases.py", line 2921, in save_figure
    raise NotImplementedError
@pelson
Collaborator

@mspacek: Would you mind re-basing this PR, then I will merge.

@mspacek

OK, done. Again, I hope I've rebased correctly. For my own reference, this is roughly what I did:

git co default_filename
git pull origin/master
git rebase origin/master
git push mspacek --force

I noticed that there are two save figure buttons on the figure toolbar now. This must be something new from master.

@pelson
Collaborator

OK, done. Again, I hope I've rebased correctly.

Thanks @mspacek. This is a nice feature. Thanks for all your work on it. Will merge in 24 hrs.

@mspacek

You're welcome!

@pelson pelson merged commit 4f75af3 into matplotlib:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 5, 2012
  1. @mspacek
  2. @mspacek
  3. @mspacek

    in qt4 backend, define get_window_title and call it for default savef…

    mspacek authored
    …ig filename
    
    revert prior changes to qt backend, since I can't test them
  4. @mspacek
  5. @mspacek

    Supported & tested on wx, gtk, gtk3, qt3, tk.

    pelson authored mspacek committed
  6. @mspacek

    removed lower() on the filename

    Phil Elson authored mspacek committed
  7. @mspacek

    fix qt4 not using get_default_filename in save_figure

    mspacek authored
    restore enforcing lowercase in get_default_filename
  8. @mspacek
  9. @jkseppan @mspacek

    Add window title management to MacOSX backend

    jkseppan authored mspacek committed
This page is out of date. Refresh to see the latest.
View
26 lib/matplotlib/backend_bases.py
@@ -2092,6 +2092,14 @@ def get_default_filetype(self):
"""
return rcParams['savefig.format']
+ def get_window_title(self):
+ """
+ Get the title text of the window containing the figure.
+ Return None if there is no window (eg, a PS backend).
+ """
+ if hasattr(self, "manager"):
+ return self.manager.get_window_title()
+
def set_window_title(self, title):
"""
Set the title text of the window containing the figure. Note that
@@ -2100,6 +2108,15 @@ def set_window_title(self, title):
if hasattr(self, "manager"):
self.manager.set_window_title(title)
+ def get_default_filename(self):
+ """
+ Return a string, which includes extension, suitable for use as
+ a default filename.
+ """
+ default_filename = self.get_window_title() or 'image'
+ default_filename = default_filename.lower().replace(' ', '_')
+ return default_filename + '.' + self.get_default_filetype()
+
def switch_backends(self, FigureCanvasClass):
"""
Instantiate an instance of FigureCanvasClass
@@ -2413,10 +2430,17 @@ def show_popup(self, msg):
"""
pass
+ def get_window_title(self):
+ """
+ Get the title text of the window containing the figure.
+ Return None for non-GUI backends (eg, a PS backend).
+ """
+ return 'image'
+
def set_window_title(self, title):
"""
Set the title text of the window containing the figure. Note that
- this has no effect if there is no window (eg, a PS backend).
+ this has no effect for non-GUI backends (eg, a PS backend).
"""
pass
View
9 lib/matplotlib/backends/backend_gtk.py
@@ -529,7 +529,7 @@ def __init__(self, canvas, num):
FigureManagerBase.__init__(self, canvas, num)
self.window = gtk.Window()
- self.window.set_title("Figure %d" % num)
+ self.set_window_title("Figure %d" % num)
if (window_icon):
try:
self.window.set_icon_from_file(window_icon)
@@ -620,6 +620,9 @@ def _get_toolbar(self, canvas):
toolbar = None
return toolbar
+ def get_window_title(self):
+ return self.window.get_title()
+
def set_window_title(self, title):
self.window.set_title(title)
@@ -725,11 +728,13 @@ def _init_toolbar2_4(self):
self.show_all()
def get_filechooser(self):
- return FileChooserDialog(
+ fc = FileChooserDialog(
title='Save the figure',
parent=self.win,
filetypes=self.canvas.get_supported_filetypes(),
default_filetype=self.canvas.get_default_filetype())
+ fc.set_current_name(self.canvas.get_default_filename())
+ return fc
def save_figure(self, *args):
fname, format = self.get_filechooser().get_filename_from_user()
View
9 lib/matplotlib/backends/backend_gtk3.py
@@ -358,7 +358,7 @@ def __init__(self, canvas, num):
FigureManagerBase.__init__(self, canvas, num)
self.window = Gtk.Window()
- self.window.set_title("Figure %d" % num)
+ self.set_window_title("Figure %d" % num)
if (window_icon):
try:
self.window.set_icon_from_file(window_icon)
@@ -447,6 +447,9 @@ def _get_toolbar(self, canvas):
toolbar = None
return toolbar
+ def get_window_title(self):
+ return self.window.get_title()
+
def set_window_title(self, title):
self.window.set_title(title)
@@ -532,11 +535,13 @@ def _init_toolbar(self):
self.show_all()
def get_filechooser(self):
- return FileChooserDialog(
+ fc = FileChooserDialog(
title='Save the figure',
parent=self.win,
filetypes=self.canvas.get_supported_filetypes(),
default_filetype=self.canvas.get_default_filetype())
+ fc.set_current_name(self.canvas.get_default_filename())
+ return fc
def save_figure(self, *args):
fname, format = self.get_filechooser().get_filename_from_user()
View
6 lib/matplotlib/backends/backend_macosx.py
@@ -444,7 +444,8 @@ def zoomy(self, direction):
self.canvas.invalidate()
def save_figure(self, *args):
- filename = _macosx.choose_save_file('Save the figure')
+ filename = _macosx.choose_save_file('Save the figure',
+ self.canvas.get_default_filename())
if filename is None: # Cancel
return
self.canvas.print_figure(filename)
@@ -469,7 +470,8 @@ def set_cursor(self, cursor):
_macosx.set_cursor(cursor)
def save_figure(self, *args):
- filename = _macosx.choose_save_file('Save the figure')
+ filename = _macosx.choose_save_file('Save the figure',
+ self.canvas.get_default_filename())
if filename is None: # Cancel
return
self.canvas.print_figure(filename)
View
7 lib/matplotlib/backends/backend_qt.py
@@ -219,7 +219,7 @@ def __init__( self, canvas, num ):
# Give the keyboard focus to the figure instead of the manager
self.canvas.setFocusPolicy( qt.QWidget.ClickFocus )
self.canvas.setFocus()
- self.window.setCaption( "Figure %d" % num )
+ self.set_window_title( "Figure %d" % num )
self.window._destroying = False
@@ -293,6 +293,9 @@ def destroy( self, *args ):
if DEBUG: print("destroy figure manager")
self.window.close(True)
+ def get_window_title(self):
+ return str(self.window.caption())
+
def set_window_title(self, title):
self.window.setCaption(title)
@@ -420,7 +423,7 @@ def save_figure(self, *args):
sorted_filetypes.sort()
default_filetype = self.canvas.get_default_filetype()
- start = "image." + default_filetype
+ start = self.canvas.get_default_filename()
filters = []
selectedFilter = None
for name, exts in sorted_filetypes:
View
5 lib/matplotlib/backends/backend_qt4.py
@@ -481,6 +481,9 @@ def destroy( self, *args ):
if DEBUG: print("destroy figure manager")
self.window.close()
+ def get_window_title(self):
+ return str(self.window.windowTitle())
+
def set_window_title(self, title):
self.window.setWindowTitle(title)
@@ -615,7 +618,7 @@ def save_figure(self, *args):
sorted_filetypes.sort()
default_filetype = self.canvas.get_default_filetype()
- start = "image." + default_filetype
+ start = self.canvas.get_default_filename()
filters = []
selectedFilter = None
for name, exts in sorted_filetypes:
View
8 lib/matplotlib/backends/backend_tkagg.py
@@ -494,7 +494,7 @@ def __init__(self, canvas, num, window):
FigureManagerBase.__init__(self, canvas, num)
self.window = window
self.window.withdraw()
- self.window.wm_title("Figure %d" % num)
+ self.set_window_title("Figure %d" % num)
self.canvas = canvas
self._num = num
_, _, w, h = canvas.figure.bbox.bounds
@@ -565,6 +565,9 @@ def destroy(self, *args):
self.window.quit()
self.window = None
+ def get_window_title(self):
+ return self.window.wm_title()
+
def set_window_title(self, title):
self.window.wm_title(title)
@@ -874,7 +877,8 @@ def save_figure(self, *args):
master=self.window,
title='Save the figure',
filetypes = tk_filetypes,
- defaultextension = defaultextension
+ defaultextension = defaultextension,
+ initialfile=self.canvas.get_default_filename(),
)
if fname == "" or fname == ():
View
5 lib/matplotlib/backends/backend_wx.py
@@ -1603,6 +1603,9 @@ def destroy(self, *args):
#wx.GetApp().ProcessIdle()
wx.WakeUpIdle()
+ def get_window_title(self):
+ return self.window.GetTitle()
+
def set_window_title(self, title):
self.window.SetTitle(title)
@@ -1840,7 +1843,7 @@ def configure_subplots(self, evt):
def save_figure(self, *args):
# Fetch the required filename and file type.
filetypes, exts, filter_index = self.canvas._get_imagesave_wildcards()
- default_file = "image." + self.canvas.get_default_filetype()
+ default_file = self.canvas.get_default_filename()
dlg = wx.FileDialog(self._parent, "Save to file", "", default_file,
filetypes,
wx.SAVE|wx.OVERWRITE_PROMPT)
View
70 src/_macosx.m
@@ -3827,6 +3827,56 @@ static void _data_provider_release(void* info, const void* data, size_t size)
return Py_None;
}
+static PyObject*
+FigureManager_set_window_title(FigureManager* self,
+ PyObject *args, PyObject *kwds)
+{
+ char* title;
+ if(!PyArg_ParseTuple(args, "es", "UTF-8", &title))
+ return NULL;
+
+ Window* window = self->window;
+ if(window)
+ {
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ NSString* ns_title = [[NSString alloc]
+ initWithCString: title
+ encoding: NSUTF8StringEncoding];
+ [window setTitle: ns_title];
+ [pool release];
+ }
+ PyMem_Free(title);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject*
+FigureManager_get_window_title(FigureManager* self)
+{
+ Window* window = self->window;
+ PyObject* result = NULL;
+ if(window)
+ {
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ NSString* title = [window title];
+ if (title) {
+ const char* cTitle = [title UTF8String];
+#if PY3K || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 6)
+ result = PyUnicode_FromString(cTitle);
+#else
+ result = PyString_FromString(cTitle);
+#endif
+ }
+ [pool release];
+ }
+ if (result) {
+ return result;
+ } else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+
static PyMethodDef FigureManager_methods[] = {
{"show",
(PyCFunction)FigureManager_show,
@@ -3838,6 +3888,16 @@ static void _data_provider_release(void* info, const void* data, size_t size)
METH_NOARGS,
"Closes the window associated with the figure manager."
},
+ {"set_window_title",
+ (PyCFunction)FigureManager_set_window_title,
+ METH_VARARGS,
+ "Sets the title of the window associated with the figure manager."
+ },
+ {"get_window_title",
+ (PyCFunction)FigureManager_get_window_title,
+ METH_NOARGS,
+ "Returns the title of the window associated with the figure manager."
+ },
{NULL} /* Sentinel */
};
@@ -4806,11 +4866,19 @@ -(void)save_figure:(id)sender
{
int result;
const char* title;
- if(!PyArg_ParseTuple(args, "s", &title)) return NULL;
+ char* default_filename;
+ if(!PyArg_ParseTuple(args, "ses", &title, "UTF-8", &default_filename))
+ return NULL;
NSSavePanel* panel = [NSSavePanel savePanel];
[panel setTitle: [NSString stringWithCString: title
encoding: NSASCIIStringEncoding]];
+ NSString* ns_default_filename =
+ [[NSString alloc]
+ initWithCString: default_filename
+ encoding: NSUTF8StringEncoding];
+ PyMem_Free(default_filename);
+ [panel setNameFieldStringValue: ns_default_filename];
result = [panel runModal];
if (result == NSOKButton)
{
Something went wrong with that request. Please try again.