1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
5 Image displaying classes to be embdeded inside wxHTML
7 __author__
= 'Michal Čihař'
8 __email__
= 'michal@cihar.com'
10 Copyright © 2003 - 2008 Michal Čihař
12 This program is free software; you can redistribute it and/or modify it
13 under the terms of the GNU General Public License version 2 as published by
14 the Free Software Foundation.
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 import wx
.lib
.throbber
54 class Bitmap(wx
.StaticBitmap
):
55 def __init__(self
, parent
, tooltip
= 'Image', image
= defaultbmp
, size
= None, scale
= 1):
56 bitmap
= wx
.BitmapFromXPMData(image
)
58 img
= wx
.ImageFromBitmap(bitmap
)
59 bitmap
= wx
.BitmapFromImage(img
.Scale(bitmap
.GetWidth() * scale
, bitmap
.GetHeight() * scale
))
60 wx
.StaticBitmap
.__init
__(self
, parent
, -1, bitmap
, (0,0))
61 self
.SetToolTipString(tooltip
)
63 class Throbber(wx
.lib
.throbber
.Throbber
):
64 def __init__(self
, parent
, tooltip
= 'Animation', images
= [defaultbmp
], size
= None, scale
= 1, delay
= 0.1):
67 bitmap
= wx
.BitmapFromXPMData(im
)
69 img
= wx
.ImageFromBitmap(bitmap
)
70 bitmap
= wx
.BitmapFromImage(img
.Scale(bitmap
.GetWidth() * scale
, bitmap
.GetHeight() * scale
))
71 bitmaps
.append(bitmap
)
72 wx
.lib
.throbber
.Throbber
.__init
__(self
, parent
, -1, bitmaps
, frameDelay
= delay
)
73 self
.SetToolTipString(tooltip
)