unfortunately for me, i was not asking how to associate a file type with my application, nor how to associate an icon type with my application's documents. i have already got that, very much along the lines you shared.
specifically, i am interested in telling my application how to behave when a document associated with it is double clicked.
for example, when i double click on a pdf file, it launches acrobat reader and _opens_ that pdf file in acrobat reader.
as it stands my application launches when one of its associated document types is double clicked, but my program does not know to actually open the document that was double clicked.
i already have file opening methods that the user can direct through the interface, i just want to be able to double click on a document and have it actually open in the program.
clear?
thanks very much
alexis
···
On Tue, 8 Jan 2008, Cody Precord wrote:
Hello,
You need to bundle your app with py2app (or similar) and setup a plist for it to tell osx what files to associate with your program. The below is an abbreviated version of that should do what you want but I also suggest looking at the py2app documentation as well as the documentation about plists on apples website.
PLIST = dict(CFBundleName = 'MySuperProgram',
CFBundleIconFile = 'myappicon.icns',
CFBundleShortVersionString = '1.0',
CFBundleGetInfoString = 'MySuperProgram 1.0',
CFBundleExecutable = 'MySuperProgram',
CFBundleIdentifier = 'com.myapp.MySuperProgram', # This is important read apples plist docs to make sure you use good value
CFBundleDocumentTypes = [dict(CFBundleTypeExtensions=['saw']), # Associate .saw files
CFBundleTypeIconFile='MySawFileIcon', # Optionally associate an icon with it should be found in MySuperProgram.app/Contents/Resources/MySawFileIcon.icns
CFBundleTypeRole="Editor"), # Give the program a role as editor see apples plist docs for other values
],
NSHumanReadableCopyright = "Copyright ME 2008"
)
On Jan 8, 2008, at 1:44 PM, lexy-lou@doyenne.com wrote:
hi there,
appologies if this ain't quite the appropriate forum, but i was wondering how i make my (wx)python program default to a particular action when i associate a file type with it in my operating system (os x for now).
suppose i have written a stupendously amazing program, called SAP.
this program creates stupendously amazing whachyamathingums, and lets the user save tham as files with the .saw extension.
suppose that i have associated files of type .saw in os x system with SAP.
how do i let SAP know what to do when it gets banged on by somone double clicking a .saw document?
again, i am not sure this is a wx issue particularly, but any direction appreciated.
alexis
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Ahh I see, make sure that 'argv_emulation' is set to true when bundling your app and in your wx.App subclass override the 'MacOpenFile(self, filename)' method to do the opening, it will be called when an associated file is double clicked and passed the files path.
Regards,
Cody Precord
···
On Jan 8, 2008, at 4:02 PM, lexy-lou@doyenne.com wrote:
hi cody,
thanks so much for the response.
unfortunately for me, i was not asking how to associate a file type with my application, nor how to associate an icon type with my application's documents. i have already got that, very much along the lines you shared.
specifically, i am interested in telling my application how to behave when a document associated with it is double clicked.
for example, when i double click on a pdf file, it launches acrobat reader and _opens_ that pdf file in acrobat reader.
as it stands my application launches when one of its associated document types is double clicked, but my program does not know to actually open the document that was double clicked.
i already have file opening methods that the user can direct through the interface, i just want to be able to double click on a document and have it actually open in the program.
clear?
thanks very much
alexis
On Tue, 8 Jan 2008, Cody Precord wrote:
Hello,
You need to bundle your app with py2app (or similar) and setup a plist for it to tell osx what files to associate with your program. The below is an abbreviated version of that should do what you want but I also suggest looking at the py2app documentation as well as the documentation about plists on apples website.
PLIST = dict(CFBundleName = 'MySuperProgram',
CFBundleIconFile = 'myappicon.icns',
CFBundleShortVersionString = '1.0',
CFBundleGetInfoString = 'MySuperProgram 1.0',
CFBundleExecutable = 'MySuperProgram',
CFBundleIdentifier = 'com.myapp.MySuperProgram', # This is important read apples plist docs to make sure you use good value
CFBundleDocumentTypes = [dict(CFBundleTypeExtensions=['saw']), # Associate .saw files
CFBundleTypeIconFile='MySawFileIcon', # Optionally associate an icon with it should be found in MySuperProgram.app/Contents/Resources/MySawFileIcon.icns
CFBundleTypeRole="Editor"), # Give the program a role as editor see apples plist docs for other values
],
NSHumanReadableCopyright = "Copyright ME 2008"
)
On Jan 8, 2008, at 1:44 PM, lexy-lou@doyenne.com wrote:
hi there,
appologies if this ain't quite the appropriate forum, but i was wondering how i make my (wx)python program default to a particular action when i associate a file type with it in my operating system (os x for now).
suppose i have written a stupendously amazing program, called SAP.
this program creates stupendously amazing whachyamathingums, and lets the user save tham as files with the .saw extension.
suppose that i have associated files of type .saw in os x system with SAP.
how do i let SAP know what to do when it gets banged on by somone double clicking a .saw document?
again, i am not sure this is a wx issue particularly, but any direction appreciated.
alexis
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org