- Add the 2 snippets of code related to `FileType`.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Andrea Gavana
2012-05-21 20:02:03 +00:00
parent 4d61dc78a8
commit 276acdab9a
2 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
# provide the message parameters for the MIME type manager
class MailMessageParameters(wx.FileType.MessageParameters):
def __init__(self, filename, mimetype):
wx.FileType.MessageParameters.__init__(self, filename, mimetype)
def GetParamValue(self, name):
# parameter names are not case-sensitive
if name.lower() == "charset":
return "US-ASCII"
else:
return wx.FileType.MessageParameters.GetParamValue(name)

View File

@@ -0,0 +1,11 @@
if filetype.GetOpenCommand(MailMessageParameters("foo.txt", "text/plain")):
# the full command for opening the text documents is in 'command'
# (it might be "notepad foo.txt" under Windows or "cat foo.txt" under Unix)
HandleCommand()
else:
# we don't know how to handle such files...
pass