Prepare for release, mention why there is still no Windows version.
[wammu.git] / Wammu / Image.py
blob9d4ba6e47acf04c16c8dabad25e8a657d2dfd32f
1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
3 '''
4 Wammu - Phone manager
5 Image displaying classes to be embdeded inside wxHTML
6 '''
7 __author__ = 'Michal Čihař'
8 __email__ = 'michal@cihar.com'
9 __license__ = '''
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
19 more details.
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
24 '''
26 import wx
27 import wx.lib.throbber
29 defaultbmp = [
30 '20 20 2 1',
31 '. c Black',
32 ' c None',
33 ' ',
34 ' .. .. ',
35 ' ... ... ',
36 ' ... ... ',
37 ' ... ... ',
38 ' ... ... ',
39 ' ... ... ',
40 ' ... ... ',
41 ' ...... ',
42 ' .... ',
43 ' .... ',
44 ' ...... ',
45 ' ... ... ',
46 ' ... ... ',
47 ' ... ... ',
48 ' ... ... ',
49 ' ... ... ',
50 ' ... ... ',
51 ' .. .. ',
52 ' ']
54 class Bitmap(wx.StaticBitmap):
55 def __init__(self, parent, tooltip = 'Image', image = defaultbmp, size = None, scale = 1):
56 bitmap = wx.BitmapFromXPMData(image)
57 if scale > 1:
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):
65 bitmaps = []
66 for im in images:
67 bitmap = wx.BitmapFromXPMData(im)
68 if scale > 1:
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)