From df9176ab7174ef5f5d03213f24662603ced7793d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 16 Oct 2001 19:14:43 +0000 Subject: [PATCH] Autodetect image type, some other cleanup git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12036 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/wxPython/lib/splashscreen.py | 28 +++++---------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/wxPython/wxPython/lib/splashscreen.py b/wxPython/wxPython/lib/splashscreen.py index 8dfa14f445..18042549dc 100644 --- a/wxPython/wxPython/lib/splashscreen.py +++ b/wxPython/wxPython/lib/splashscreen.py @@ -15,24 +15,6 @@ from wxPython.wx import * #---------------------------------------------------------------------- -def bitmapFromFile(filename): - '''Non-portable test for bitmap type...''' - import imghdr - BITMAPTYPEGUESSDICT = { - "bmp" :wxBITMAP_TYPE_BMP, - "png" :wxBITMAP_TYPE_PNG, - "jpeg":wxBITMAP_TYPE_JPEG, - "jpg" :wxBITMAP_TYPE_JPEG, - "gif" :wxBITMAP_TYPE_GIF, - "xbm" :wxBITMAP_TYPE_XBM, - } - # following assumes bitmap type if we cannot resolve image type - typ = BITMAPTYPEGUESSDICT.get(imghdr.what(filename), wxBITMAP_TYPE_BMP) - bitmap = wxImage(filename, typ).ConvertToBitmap() - return bitmap - -#---------------------------------------------------------------------- - class SplashScreen(wxFrame): def __init__(self, parent, ID=-1, title="SplashScreen", style=wxSIMPLE_BORDER|wxSTAY_ON_TOP, @@ -41,11 +23,12 @@ class SplashScreen(wxFrame): ''' parent, ID, title, style -- see wxFrame duration -- milliseconds to display the splash screen - bitmapfile -- absolute or relative pathname, extension used for type negotiation - callback -- if specified, is called when timer completes, callback is responsible for closing the splash screen + bitmapfile -- absolute or relative pathname to image file + callback -- if specified, is called when timer completes, callback is + responsible for closing the splash screen ''' ### Loading bitmap - self.bitmap = bmp = bitmapFromFile(bitmapfile) + self.bitmap = bmp = wxImage(bitmapfile, wxBITMAP_TYPE_ANY).ConvertToBitmap() ### Determine size of bitmap to size window... size = (bmp.GetWidth(), bmp.GetHeight()) # size of screen @@ -66,8 +49,7 @@ class SplashScreen(wxFrame): EVT_ERASE_BACKGROUND(self, self.OnEraseBG) self.Show(true) - #dc = wxClientDC(self) - #dc.DrawBitmap(self.bitmap, 0,0, false) + class SplashTimer(wxTimer): def __init__(self, targetFunction):