gui/graphic.py
def _getbitmap_type( self, filename ) :
        """
        Get the type of an image from the file's extension ( .jpg, etc. )
        """
        # KEA 2001-07-27
        # was
        #name, ext = filename.split( '.' )
        #ext = ext.upper()
        if filename is None or filename == '':
            return None

        name, ext = os.path.splitext(filename)
        ext = ext[1:].upper()
        if ext == 'BMP':
            return wx.BITMAP_TYPE_BMP
        elif ext == 'GIF':
            return wx.BITMAP_TYPE_GIF
        elif ext == 'JPG' or ext == 'JPEG':
            return wx.BITMAP_TYPE_JPEG
        elif ext == 'PCX':
            return wx.BITMAP_TYPE_PCX
        #elif ext == 'PICT':
        #    return wx.BITMAP_TYPE_PICT
        elif ext == 'PNG':
            return wx.BITMAP_TYPE_PNG
        elif ext == 'PNM':
            return wx.BITMAP_TYPE_PNM
        elif ext == 'TIF' or ext == 'TIFF':
            return wx.BITMAP_TYPE_TIF
        elif ext == 'XBM':
            return wx.BITMAP_TYPE_XBM
        elif ext == 'XPM':
            return wx.BITMAP_TYPE_XPM
        else:
            # KEA 2001-10-10
            # rather than throw an exception, we could try and have wxPython figure out the image
            # type by returning wxBITMAP_TYPE_ANY
            raise RuntimeError('invalid graphics format')
def _getbitmap_type( self, filename ) :
        """
        Get the type of an image from the file's extension ( .jpg, etc. )
        """
        # KEA 2001-07-27
        # was
        #name, ext = filename.split( '.' )
        #ext = ext.upper()
        if filename is None or filename == '':
            return None

        name, ext = os.path.splitext(filename)
        ext = ext[1:].upper()
        if ext == 'BMP':
            return wx.BITMAP_TYPE_BMP
        elif ext == 'GIF':
            return wx.BITMAP_TYPE_GIF
        elif ext == 'JPG' or ext == 'JPEG':
            return wx.BITMAP_TYPE_JPEG
        elif ext == 'PCX':
            return wx.BITMAP_TYPE_PCX
        #elif ext == 'PICT':
        #    return wx.BITMAP_TYPE_PICT
        elif ext == 'PNG':
            return wx.BITMAP_TYPE_PNG
        elif ext == 'PNM':
            return wx.BITMAP_TYPE_PNM
        elif ext == 'TIF' or ext == 'TIFF':
            return wx.BITMAP_TYPE_TIF
        elif ext == 'XBM':
            return wx.BITMAP_TYPE_XBM
        elif ext == 'XPM':
            return wx.BITMAP_TYPE_XPM
        else:
            # KEA 2001-10-10
            # rather than throw an exception, we could try and have wxPython figure out the image
            # type by returning wxBITMAP_TYPE_ANY
            raise RuntimeError('invalid graphics format')
def _getbitmap_type ( self , filename ) : # KEA 2001-07-27
 # was
 #name, ext = filename.split( '.' )
 #ext = ext.upper()
 if filename is None or filename == '' : return None name , ext = os . path . splitext ( filename ) ext = ext [ 1 : ] . upper ( ) if ext == 'BMP' : return wx . BITMAP_TYPE_BMP elif ext == 'GIF' : return wx . BITMAP_TYPE_GIF elif ext == 'JPG' or ext == 'JPEG' : return wx . BITMAP_TYPE_JPEG elif ext == 'PCX' : return wx . BITMAP_TYPE_PCX #elif ext == 'PICT':
 #    return wx.BITMAP_TYPE_PICT
 elif ext == 'PNG' : return wx . BITMAP_TYPE_PNG elif ext == 'PNM' : return wx . BITMAP_TYPE_PNM elif ext == 'TIF' or ext == 'TIFF' : return wx . BITMAP_TYPE_TIF elif ext == 'XBM' : return wx . BITMAP_TYPE_XBM elif ext == 'XPM' : return wx . BITMAP_TYPE_XPM else : # KEA 2001-10-10
 # rather than throw an exception, we could try and have wxPython figure out the image
 # type by returning wxBITMAP_TYPE_ANY
 raise RuntimeError ( 'invalid graphics format' )
Get the type of an image from the file's extension ( .jpg, etc. )
Get the type of an image from the file s extension ( . jpg etc . )