X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4c3b4ed07f8d33e70baa4e66ca43dd0ab834578b..71aba8333cc915afff9e740c944f7fa7247abacb:/wxPython/demo/wxMimeTypesManager.py diff --git a/wxPython/demo/wxMimeTypesManager.py b/wxPython/demo/wxMimeTypesManager.py index 4a830181b6..d6356389d4 100644 --- a/wxPython/demo/wxMimeTypesManager.py +++ b/wxPython/demo/wxMimeTypesManager.py @@ -2,6 +2,7 @@ import pprint, string, os from wxPython.wx import * from mimetypes_wdr import * +from Main import opj #---------------------------------------------------------------------------- @@ -13,7 +14,7 @@ class MimeTypesTestPanel(wxPanel): style = wxTAB_TRAVERSAL ): wxPanel.__init__(self, parent, id, pos, size, style) - MakeMimeTypesTestPanel( self, true ) + MakeMimeTypesTestPanel( self, True ) # WDR: handler declarations for MimeTypesTestPanel EVT_LISTBOX(self, ID_LISTBOX, self.OnListbox) @@ -33,8 +34,8 @@ class MimeTypesTestPanel(wxPanel): def OnListbox(self, event): mimetype = event.GetString() self.GetInputText().SetValue(mimetype) - self.GetMimeBtn().SetValue(TRUE) - self.GetExtensionBtn().SetValue(FALSE) + self.GetMimeBtn().SetValue(True) + self.GetExtensionBtn().SetValue(False) self.OnLookup() @@ -75,8 +76,12 @@ class MimeTypesTestPanel(wxPanel): self.GetExtensionsTxt().SetValue(str(ft.GetExtensions())) self.GetDescriptionTxt().SetValue(str(ft.GetDescription())) - ext = ft.GetExtensions()[0] - if ext[0] == ".": ext = ext[1:] + extList = ft.GetExtensions() + if extList: + ext = extList[0] + if ext[0] == ".": ext = ext[1:] + else: + ext = "" filename = "SPAM" + "." + ext mime = ft.GetMimeType() or "" cmd = ft.GetOpenCommand(filename, mime) @@ -160,10 +165,19 @@ overview = """\ import mimetypes_wdr +import images def MyBitmapsFunc( index ): - return wxImage( "bitmaps/noicon.png", wxBITMAP_TYPE_PNG ).ConvertToBitmap() + return images.getNoIconBitmap() mimetypes_wdr.MyBitmapsFunc = MyBitmapsFunc + + + + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])])