00001 # Copyright (C) 2008-2009 Mark Hanegraaff 00002 # 00003 # This program is free software: you can redistribute it and/or modify 00004 # it under the terms of the GNU General Public License as published by 00005 # the Free Software Foundation, either version 3 of the License, or 00006 # (at your option) any later version. 00007 # 00008 # This program is distributed in the hope that it will be useful, 00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 # GNU General Public License for more details. 00012 # 00013 # You should have received a copy of the GNU General Public License 00014 # along with this program. If not, see <http://www.gnu.org/licenses/>. 00015 00016 00017 import wx.animate 00018 00019 ##Wrapper class for the wx.animate.GIFAnimationCtrl class. 00020 # This class is mainly used to control the animated widget on the top right corner of 00021 # EyeSpy's frame (the one used to indicate that the application is running) 00022 class animatedLoaderIcon(): 00023 00024 ## animatedLoaderIcon constructor. 00025 # @param parent The container class for this object (i.e. mainFrameToolbar) 00026 # @param fileName Animated Gif FileName 00027 # @param initialPos Animated Gif Position on the tool bar 00028 def __init__(self, parent, fileName, initialPos): 00029 # 00030 self.parent = parent 00031 self.fileName = fileName 00032 00033 self.animLoaderIcon = wx.animate.GIFAnimationCtrl(parent, -1, self.fileName, pos=initialPos) 00034 self.isPlaying = False 00035 00036 ## Start the animation 00037 def play(self): 00038 self.animLoaderIcon.Play() 00039 self.isPlaying = True 00040 00041 ## Stop the animation 00042 def stop(self): 00043 self.animLoaderIcon.Stop() 00044 self.isPlaying = False 00045 00046 ## Change the position of the image. This is usually done when the window is resized 00047 # @param newPos: New Position 00048 def changePos(self, newPos): 00049 if self.isPlaying == True: self.animLoaderIcon.Stop() 00050 00051 self.animLoaderIcon.Destroy() 00052 self.animLoaderIcon = wx.animate.GIFAnimationCtrl(self.parent, -1, self.fileName, pos=newPos) 00053 00054 if self.isPlaying == True: self.animLoaderIcon.Play() 00055 00056
1.5.8