Le 2 avr. 09 à 12:28, Nicholas Riley a écrit :


On Thu, Apr 02, 2009 at 09:52:26AM +0200, Steph-info wrote:
Hi,

        I have the following piece of code :

"""
        @objc.IBAction
        def chooseRec_(self, sender):
                op = NSOpenPanel.openPanel()
                op.setTitle_('Choisir un dossier')
                op.setCanChooseDirectories_(True)
                op.setCanChooseFiles_(False)
                op.setResolvesAliases_(True)
                op.setAllowsMultipleSelection_(False)
                result = op.runModalForDirectory_file_types_(None, None,
                None)
                if result == NSOKButton:
                        self.pathRec = op.filename()
                        self.pathField.setStringValue_(self.pathRec)

"""
        which open an NSOpenPanel but I can't find how to change the default
"Open" and "Cancel" button's names.
        
        Could anybody post a line of code demonstrating how to achieve this
task ?

op.setPrompt_('foo') will change Open.  Note that NSOpenPanel inherits
from NSSavePanel and a bunch of the API you might be looking for is in
NSSavePanel.

I don't believe it's possible to change 'Cancel' (beyond localizing it).

Thanks Nicholas, it works for the "Open" button.

I found the following cocoa reference for the "Cancel" button :

"""
    NSSavePanel *panel = [NSSavePanel savePanel];
    NSButton* cancelButton =
[[panel contentView] buttonWithTag:NSFileHandlingPanelCancelButton];
"""

Do you know how I can translate this to PyObjC ?




--
Nicholas Riley <njri...@uiuc.edu>





Cordialement,

            Stéphane Serra.




_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to