1
2 """
3 __version__ = "$Revision: 1.24 $"
4 __date__ = "$Date: 2004/08/11 01:58:03 $"
5 """
6
7 import wx
8 import wx.animate
9
10 from PythonCard import event, graphic, widget
11
12 USE_GENERIC = wx.Platform == '__WXGTK__'
13
14 from wx.lib.flashwin import FlashWindow
15
18 events = []
19 attributes = {
20 'file' : { 'presence' : 'optional', 'default':'' },
21
22
23
24
25
26
27
28 'size' : { 'presence' : 'optional', 'default' : [ -1, -1 ] },
29 }
30 widget.WidgetSpec.__init__( self, 'Flash', 'Widget', events, attributes )
31
32
33 -class Flash(widget.Widget, FlashWindow):
34 """
35 show flash.
36 """
37
38 _spec = FlashSpec()
39
41 self._file = aResource.file
42
43 self._size = tuple(aResource.size)
44 w = aResource.size[0]
45 if w == -2:
46 w = self._bitmap.getWidth()
47 h = aResource.size[1]
48 if h == -2:
49 h = self._bitmap.getHeight()
50 size = (w, h)
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72 FlashWindow.__init__(
73 self,
74 aParent,
75 widget.makeNewId(aResource.id),
76 aResource.position,
77 size,
78 style = wx.SUNKEN_BORDER,
79 name = aResource.name,
80 )
81
82 self.LoadMovie(0, self._file)
83 self.Play()
84
85
86 widget.Widget.__init__( self, aParent, aResource )
87
88 wx.EVT_WINDOW_DESTROY(self, self._OnDestroy)
89
90 self._bindEvents(event.WIDGET_EVENTS)
91
93
94 self._bitmap = None
95 event.Skip()
96
97
98
99
101 self._size = tuple(aSize)
102 w = aSize[0]
103 if w == -2:
104 w = self._bitmap.getWidth()
105 h = aSize[1]
106 if h == -2:
107 h = self._bitmap.getHeight()
108 self.SetSize((w, h))
109
110
111
112
113
114
117
118
119
120
121
123 self._file = aFile
124 self._setBitmap(graphic.Bitmap(aFile))
125
126
127
128
129 file = property(_getFile, _setFile)
130 size = property(widget.Widget._getSize, _setSize)
131
132
133 import sys
134 from PythonCard import registry
135 registry.Registry.getInstance().register(sys.modules[__name__].Flash)
136