Added wrappers and a demo for the animate contrib

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33337 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2005-04-04 23:15:29 +00:00
parent 48e7d325a2
commit 2e5aa9c48d
23 changed files with 5954 additions and 5 deletions

View File

@ -82,6 +82,7 @@ BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module
BUILD_OGL = 0 # If true, build the contrib/ogl extension module
BUILD_STC = 1 # If true, build the contrib/stc extension module
BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library
BUILD_ANIMATE = 1 # Build a module for the animate contrib library
BUILD_DLLWIDGET = 0# Build a module that enables unknown wx widgets
# to be loaded from a DLL and to be used from Python.

View File

@ -0,0 +1,16 @@
// A bunch of %rename directives generated by BuildRenamers in config.py
// in order to remove the wx prefix from all global scope names.
#ifndef BUILDING_RENAMERS
%rename(ANIM_UNSPECIFIED) wxANIM_UNSPECIFIED;
%rename(ANIM_DONOTREMOVE) wxANIM_DONOTREMOVE;
%rename(ANIM_TOBACKGROUND) wxANIM_TOBACKGROUND;
%rename(ANIM_TOPREVIOUS) wxANIM_TOPREVIOUS;
%rename(AnimationPlayer) wxAnimationPlayer;
%rename(AnimationBase) wxAnimationBase;
%rename(GIFAnimation) wxGIFAnimation;
%rename(AN_FIT_ANIMATION) wxAN_FIT_ANIMATION;
%rename(GIFAnimationCtrl) wxGIFAnimationCtrl;
#endif

View File

@ -0,0 +1,323 @@
/////////////////////////////////////////////////////////////////////////////
// Name: animate.i
// Purpose: Wrappers for the animation classes in wx/contrib
//
// Author: Robin Dunn
//
// Created: 4-April-2005
// RCS-ID: $Id$
// Copyright: (c) 2005 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%define DOCSTRING
"Simple animation player classes, including `wxGIFAnimationCtrl` for displaying
animated GIF files
"
%enddef
%module(package="wx", docstring=DOCSTRING) animate
%{
#include "wx/wxPython/wxPython.h"
#include "wx/wxPython/pyclasses.h"
#include <wx/animate/animate.h>
%}
//---------------------------------------------------------------------------
%import core.i
%pythoncode { import wx }
%pythoncode { __docfilter__ = wx._core.__DocFilter(globals()) }
MAKE_CONST_WXSTRING2(AnimationControlNameStr, wxT("animationControl"));
MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
%include _animate_rename.i
//---------------------------------------------------------------------------
enum wxAnimationDisposal
{
wxANIM_UNSPECIFIED = -1,
wxANIM_DONOTREMOVE = 0,
wxANIM_TOBACKGROUND = 1,
wxANIM_TOPREVIOUS = 2
} ;
/* wxAnimationPlayer
* Create an object of this class, and either pass an wxXXXAnimation object in
* the constructor, or call SetAnimation. Then call Play(). The wxAnimation
* object is only destroyed in the destructor if destroyAnimation is true in
* the constructor.
*/
class wxAnimationPlayer : public wxObject
{
public:
wxAnimationPlayer(wxAnimationBase *animation = NULL,
bool destroyAnimation = false);
~wxAnimationPlayer();
void SetAnimation(wxAnimationBase* animation, bool destroyAnimation = false);
wxAnimationBase* GetAnimation() const;
void SetDestroyAnimation(bool destroyAnimation);
bool GetDestroyAnimation() const;
void SetCurrentFrame(int currentFrame);
int GetCurrentFrame() const;
void SetWindow(wxWindow* window);
wxWindow* GetWindow() const;
void SetPosition(const wxPoint& pos);
wxPoint GetPosition() const;
void SetLooped(bool looped);
bool GetLooped() const;
bool HasAnimation() const;
bool IsPlaying() const;
// Specify whether the GIF's background colour is to be shown,
// or whether the window background should show through (the default)
void UseBackgroundColour(bool useBackground);
bool UsingBackgroundColour() const;
// Set and use a user-specified background colour (valid for transparent
// animations only)
void SetCustomBackgroundColour(const wxColour& col,
bool useCustomBackgroundColour = true);
bool UsingCustomBackgroundColour() const;
const wxColour& GetCustomBackgroundColour() const;
// Another refinement - suppose we're drawing the animation in a separate
// control or window. We may wish to use the background of the parent
// window as the background of our animation. This allows us to specify
// whether to grab from the parent or from this window.
void UseParentBackground(bool useParent);
bool UsingParentBackground() const;
// Play
virtual bool Play(wxWindow& window, const wxPoint& pos = wxPoint(0, 0), bool looped = true);
// Build animation (list of wxImages). If not called before Play
// is called, Play will call this automatically.
virtual bool Build();
// Stop the animation
virtual void Stop();
// Draw the current view of the animation into this DC.
// Call this from your OnPaint, for example.
virtual void Draw(wxDC& dc);
virtual int GetFrameCount() const;
virtual wxImage* GetFrame(int i) const; // Creates a new wxImage
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
virtual wxRect GetFrameRect(int i) const; // Position and size of frame
virtual int GetDelay(int i) const; // Delay for this frame
virtual wxSize GetLogicalScreenSize() const;
virtual bool GetBackgroundColour(wxColour& col) const ;
virtual bool GetTransparentColour(wxColour& col) const ;
// Play the frame
virtual bool PlayFrame(int frame, wxWindow& window, const wxPoint& pos);
%Rename(PlayNextFrame,
virtual bool, PlayFrame());
virtual void DrawFrame(int frame, wxDC& dc, const wxPoint& pos);
virtual void DrawBackground(wxDC& dc, const wxPoint& pos, const wxColour& colour);
// Clear the wxImage cache
virtual void ClearCache();
// Save the pertinent area of the window so we can restore
// it if drawing transparently
void SaveBackground(const wxRect& rect);
wxBitmap& GetBackingStore();
};
//---------------------------------------------------------------------------
/* wxAnimationBase
* Base class for animations.
* A wxXXXAnimation only stores the animation, providing accessors to
* wxAnimationPlayer. Currently an animation is read-only, but we could
* extend the API for adding frames programmatically, and perhaps have a
* wxMemoryAnimation class that stores its frames in memory, and is able to
* save all files with suitable filenames. You could then use e.g. Ulead GIF
* Animator to load the image files into a GIF animation.
*/
class wxAnimationBase : public wxObject
{
public:
//wxAnimationBase() {}; // It's an ABC
~wxAnimationBase() {};
//// Accessors. Should be overridden by each derived class.
virtual int GetFrameCount() const;
virtual wxImage* GetFrame(int i) const;
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
virtual wxRect GetFrameRect(int i) const; // Position and size of frame
virtual int GetDelay(int i) const; // Delay for this frame
virtual wxSize GetLogicalScreenSize() const;
virtual bool GetBackgroundColour(wxColour& col) const;
virtual bool GetTransparentColour(wxColour& col) const;
// Is the animation OK?
virtual bool IsValid() const;
virtual bool LoadFile(const wxString& filename);
};
// TODO: Add a wxPyAnimationBase class
//---------------------------------------------------------------------------
/* wxGIFAnimation
* This will be moved to a separate file in due course.
*/
class wxGIFAnimation : public wxAnimationBase
{
public:
wxGIFAnimation() ;
~wxGIFAnimation() ;
//// Accessors
virtual int GetFrameCount() const;
virtual wxImage* GetFrame(int i) const;
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
virtual wxRect GetFrameRect(int i) const; // Position and size of frame
virtual int GetDelay(int i) const; // Delay for this frame
virtual wxSize GetLogicalScreenSize() const ;
virtual bool GetBackgroundColour(wxColour& col) const ;
virtual bool GetTransparentColour(wxColour& col) const ;
virtual bool IsValid() const;
//// Operations
virtual bool LoadFile(const wxString& filename);
};
//---------------------------------------------------------------------------
/*
* wxAnimationCtrlBase
* Abstract base class for format-specific animation controls.
* This class implements most of the functionality; all a derived
* class has to do is create the appropriate animation class on demand.
*/
// Resize to animation size if this is set
enum { wxAN_FIT_ANIMATION };
// class wxAnimationCtrlBase: public wxControl
// {
// public:
// %pythonAppend wxAnimationCtrlBase "self._setOORInfo(self)"
// %pythonAppend wxAnimationCtrlBase() ""
// wxAnimationCtrlBase(wxWindow *parent, wxWindowID id,
// const wxString& filename = wxPyEmptyString,
// const wxPoint& pos = wxDefaultPosition,
// const wxSize& size = wxDefaultSize,
// long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
// const wxString& name = wxPyAnimationControlNameStr);
// %RenameCtor(PreAnimationCtrlBase, wxAnimationCtrlBase());
// bool Create(wxWindow *parent, wxWindowID id,
// const wxString& filename = wxPyEmptyString,
// const wxPoint& pos = wxDefaultPosition,
// const wxSize& size = wxDefaultSize,
// long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
// const wxString& name = wxPyAnimationControlNameStr);
// //// Operations
// virtual bool LoadFile(const wxString& filename = wxPyEmptyString);
// virtual bool Play(bool looped = true) ;
// virtual void Stop();
// virtual void FitToAnimation();
// //// Accessors
// virtual bool IsPlaying() const;
// virtual wxAnimationPlayer& GetPlayer();
// virtual wxAnimationBase* GetAnimation();
// const wxString& GetFilename() const;
// void SetFilename(const wxString& filename);
// };
/*
* wxGIFAnimationCtrl
* Provides a GIF animation class when required.
*/
MustHaveApp(wxGIFAnimationCtrl);
class wxGIFAnimationCtrl: public wxControl //wxAnimationCtrlBase
{
public:
%pythonAppend wxGIFAnimationCtrl "self._setOORInfo(self)"
%pythonAppend wxGIFAnimationCtrl() ""
wxGIFAnimationCtrl(wxWindow *parent, wxWindowID id=-1,
const wxString& filename = wxPyEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
const wxString& name = wxPyAnimationControlNameStr);
%RenameCtor(PreGIFAnimationCtrl, wxGIFAnimationCtrl());
bool Create(wxWindow *parent, wxWindowID id=-1,
const wxString& filename = wxPyEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
const wxString& name = wxPyAnimationControlNameStr);
//// Operations
virtual bool LoadFile(const wxString& filename = wxPyEmptyString);
virtual bool Play(bool looped = true) ;
virtual void Stop();
virtual void FitToAnimation();
//// Accessors
virtual bool IsPlaying() const;
virtual wxAnimationPlayer& GetPlayer();
virtual wxAnimationBase* GetAnimation();
const wxString& GetFilename() const;
void SetFilename(const wxString& filename);
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

View File

@ -0,0 +1,446 @@
# This file was created automatically by SWIG.
# Don't modify this file, modify the SWIG interface instead.
"""
Simple animation player classes, including `wxGIFAnimationCtrl` for displaying
animated GIF files
"""
import _animate
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "this"):
if isinstance(value, class_type):
self.__dict__[name] = value.this
if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
del value.thisown
return
method = class_type.__swig_setmethods__.get(name,None)
if method: return method(self,value)
if (not static) or hasattr(self,name) or (name == "thisown"):
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self,class_type,name,value):
return _swig_setattr_nondynamic(self,class_type,name,value,0)
def _swig_getattr(self,class_type,name):
method = class_type.__swig_getmethods__.get(name,None)
if method: return method(self)
raise AttributeError,name
import types
try:
_object = types.ObjectType
_newclass = 1
except AttributeError:
class _object : pass
_newclass = 0
del types
def _swig_setattr_nondynamic_method(set):
def set_attr(self,name,value):
if hasattr(self,name) or (name in ("this", "thisown")):
set(self,name,value)
else:
raise AttributeError("You cannot add attributes to %s" % self)
return set_attr
import _core
import wx
__docfilter__ = wx._core.__DocFilter(globals())
ANIM_UNSPECIFIED = _animate.ANIM_UNSPECIFIED
ANIM_DONOTREMOVE = _animate.ANIM_DONOTREMOVE
ANIM_TOBACKGROUND = _animate.ANIM_TOBACKGROUND
ANIM_TOPREVIOUS = _animate.ANIM_TOPREVIOUS
class AnimationPlayer(_core.Object):
"""Proxy of C++ AnimationPlayer class"""
def __repr__(self):
return "<%s.%s; proxy of C++ wxAnimationPlayer instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
"""__init__(self, AnimationBase animation=None, bool destroyAnimation=False) -> AnimationPlayer"""
newobj = _animate.new_AnimationPlayer(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
def __del__(self, destroy=_animate.delete_AnimationPlayer):
"""__del__(self)"""
try:
if self.thisown: destroy(self)
except: pass
def SetAnimation(*args, **kwargs):
"""SetAnimation(self, AnimationBase animation, bool destroyAnimation=False)"""
return _animate.AnimationPlayer_SetAnimation(*args, **kwargs)
def GetAnimation(*args, **kwargs):
"""GetAnimation(self) -> AnimationBase"""
return _animate.AnimationPlayer_GetAnimation(*args, **kwargs)
def SetDestroyAnimation(*args, **kwargs):
"""SetDestroyAnimation(self, bool destroyAnimation)"""
return _animate.AnimationPlayer_SetDestroyAnimation(*args, **kwargs)
def GetDestroyAnimation(*args, **kwargs):
"""GetDestroyAnimation(self) -> bool"""
return _animate.AnimationPlayer_GetDestroyAnimation(*args, **kwargs)
def SetCurrentFrame(*args, **kwargs):
"""SetCurrentFrame(self, int currentFrame)"""
return _animate.AnimationPlayer_SetCurrentFrame(*args, **kwargs)
def GetCurrentFrame(*args, **kwargs):
"""GetCurrentFrame(self) -> int"""
return _animate.AnimationPlayer_GetCurrentFrame(*args, **kwargs)
def SetWindow(*args, **kwargs):
"""SetWindow(self, Window window)"""
return _animate.AnimationPlayer_SetWindow(*args, **kwargs)
def GetWindow(*args, **kwargs):
"""GetWindow(self) -> Window"""
return _animate.AnimationPlayer_GetWindow(*args, **kwargs)
def SetPosition(*args, **kwargs):
"""SetPosition(self, Point pos)"""
return _animate.AnimationPlayer_SetPosition(*args, **kwargs)
def GetPosition(*args, **kwargs):
"""GetPosition(self) -> Point"""
return _animate.AnimationPlayer_GetPosition(*args, **kwargs)
def SetLooped(*args, **kwargs):
"""SetLooped(self, bool looped)"""
return _animate.AnimationPlayer_SetLooped(*args, **kwargs)
def GetLooped(*args, **kwargs):
"""GetLooped(self) -> bool"""
return _animate.AnimationPlayer_GetLooped(*args, **kwargs)
def HasAnimation(*args, **kwargs):
"""HasAnimation(self) -> bool"""
return _animate.AnimationPlayer_HasAnimation(*args, **kwargs)
def IsPlaying(*args, **kwargs):
"""IsPlaying(self) -> bool"""
return _animate.AnimationPlayer_IsPlaying(*args, **kwargs)
def UseBackgroundColour(*args, **kwargs):
"""UseBackgroundColour(self, bool useBackground)"""
return _animate.AnimationPlayer_UseBackgroundColour(*args, **kwargs)
def UsingBackgroundColour(*args, **kwargs):
"""UsingBackgroundColour(self) -> bool"""
return _animate.AnimationPlayer_UsingBackgroundColour(*args, **kwargs)
def SetCustomBackgroundColour(*args, **kwargs):
"""SetCustomBackgroundColour(self, Colour col, bool useCustomBackgroundColour=True)"""
return _animate.AnimationPlayer_SetCustomBackgroundColour(*args, **kwargs)
def UsingCustomBackgroundColour(*args, **kwargs):
"""UsingCustomBackgroundColour(self) -> bool"""
return _animate.AnimationPlayer_UsingCustomBackgroundColour(*args, **kwargs)
def GetCustomBackgroundColour(*args, **kwargs):
"""GetCustomBackgroundColour(self) -> Colour"""
return _animate.AnimationPlayer_GetCustomBackgroundColour(*args, **kwargs)
def UseParentBackground(*args, **kwargs):
"""UseParentBackground(self, bool useParent)"""
return _animate.AnimationPlayer_UseParentBackground(*args, **kwargs)
def UsingParentBackground(*args, **kwargs):
"""UsingParentBackground(self) -> bool"""
return _animate.AnimationPlayer_UsingParentBackground(*args, **kwargs)
def Play(*args, **kwargs):
"""Play(self, Window window, Point pos=wxPoint(0, 0), bool looped=True) -> bool"""
return _animate.AnimationPlayer_Play(*args, **kwargs)
def Build(*args, **kwargs):
"""Build(self) -> bool"""
return _animate.AnimationPlayer_Build(*args, **kwargs)
def Stop(*args, **kwargs):
"""Stop(self)"""
return _animate.AnimationPlayer_Stop(*args, **kwargs)
def Draw(*args, **kwargs):
"""Draw(self, DC dc)"""
return _animate.AnimationPlayer_Draw(*args, **kwargs)
def GetFrameCount(*args, **kwargs):
"""GetFrameCount(self) -> int"""
return _animate.AnimationPlayer_GetFrameCount(*args, **kwargs)
def GetFrame(*args, **kwargs):
"""GetFrame(self, int i) -> Image"""
return _animate.AnimationPlayer_GetFrame(*args, **kwargs)
def GetDisposalMethod(*args, **kwargs):
"""GetDisposalMethod(self, int i) -> int"""
return _animate.AnimationPlayer_GetDisposalMethod(*args, **kwargs)
def GetFrameRect(*args, **kwargs):
"""GetFrameRect(self, int i) -> Rect"""
return _animate.AnimationPlayer_GetFrameRect(*args, **kwargs)
def GetDelay(*args, **kwargs):
"""GetDelay(self, int i) -> int"""
return _animate.AnimationPlayer_GetDelay(*args, **kwargs)
def GetLogicalScreenSize(*args, **kwargs):
"""GetLogicalScreenSize(self) -> Size"""
return _animate.AnimationPlayer_GetLogicalScreenSize(*args, **kwargs)
def GetBackgroundColour(*args, **kwargs):
"""GetBackgroundColour(self, Colour col) -> bool"""
return _animate.AnimationPlayer_GetBackgroundColour(*args, **kwargs)
def GetTransparentColour(*args, **kwargs):
"""GetTransparentColour(self, Colour col) -> bool"""
return _animate.AnimationPlayer_GetTransparentColour(*args, **kwargs)
def PlayFrame(*args, **kwargs):
"""PlayFrame(self, int frame, Window window, Point pos) -> bool"""
return _animate.AnimationPlayer_PlayFrame(*args, **kwargs)
def PlayNextFrame(*args, **kwargs):
"""PlayNextFrame(self) -> bool"""
return _animate.AnimationPlayer_PlayNextFrame(*args, **kwargs)
def DrawFrame(*args, **kwargs):
"""DrawFrame(self, int frame, DC dc, Point pos)"""
return _animate.AnimationPlayer_DrawFrame(*args, **kwargs)
def DrawBackground(*args, **kwargs):
"""DrawBackground(self, DC dc, Point pos, Colour colour)"""
return _animate.AnimationPlayer_DrawBackground(*args, **kwargs)
def ClearCache(*args, **kwargs):
"""ClearCache(self)"""
return _animate.AnimationPlayer_ClearCache(*args, **kwargs)
def SaveBackground(*args, **kwargs):
"""SaveBackground(self, Rect rect)"""
return _animate.AnimationPlayer_SaveBackground(*args, **kwargs)
def GetBackingStore(*args, **kwargs):
"""GetBackingStore(self) -> Bitmap"""
return _animate.AnimationPlayer_GetBackingStore(*args, **kwargs)
class AnimationPlayerPtr(AnimationPlayer):
def __init__(self, this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = AnimationPlayer
_animate.AnimationPlayer_swigregister(AnimationPlayerPtr)
cvar = _animate.cvar
AnimationControlNameStr = cvar.AnimationControlNameStr
class AnimationBase(_core.Object):
"""Proxy of C++ AnimationBase class"""
def __init__(self): raise RuntimeError, "No constructor defined"
def __repr__(self):
return "<%s.%s; proxy of C++ wxAnimationBase instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __del__(self, destroy=_animate.delete_AnimationBase):
"""__del__(self)"""
try:
if self.thisown: destroy(self)
except: pass
def GetFrameCount(*args, **kwargs):
"""GetFrameCount(self) -> int"""
return _animate.AnimationBase_GetFrameCount(*args, **kwargs)
def GetFrame(*args, **kwargs):
"""GetFrame(self, int i) -> Image"""
return _animate.AnimationBase_GetFrame(*args, **kwargs)
def GetDisposalMethod(*args, **kwargs):
"""GetDisposalMethod(self, int i) -> int"""
return _animate.AnimationBase_GetDisposalMethod(*args, **kwargs)
def GetFrameRect(*args, **kwargs):
"""GetFrameRect(self, int i) -> Rect"""
return _animate.AnimationBase_GetFrameRect(*args, **kwargs)
def GetDelay(*args, **kwargs):
"""GetDelay(self, int i) -> int"""
return _animate.AnimationBase_GetDelay(*args, **kwargs)
def GetLogicalScreenSize(*args, **kwargs):
"""GetLogicalScreenSize(self) -> Size"""
return _animate.AnimationBase_GetLogicalScreenSize(*args, **kwargs)
def GetBackgroundColour(*args, **kwargs):
"""GetBackgroundColour(self, Colour col) -> bool"""
return _animate.AnimationBase_GetBackgroundColour(*args, **kwargs)
def GetTransparentColour(*args, **kwargs):
"""GetTransparentColour(self, Colour col) -> bool"""
return _animate.AnimationBase_GetTransparentColour(*args, **kwargs)
def IsValid(*args, **kwargs):
"""IsValid(self) -> bool"""
return _animate.AnimationBase_IsValid(*args, **kwargs)
def LoadFile(*args, **kwargs):
"""LoadFile(self, String filename) -> bool"""
return _animate.AnimationBase_LoadFile(*args, **kwargs)
class AnimationBasePtr(AnimationBase):
def __init__(self, this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = AnimationBase
_animate.AnimationBase_swigregister(AnimationBasePtr)
class GIFAnimation(AnimationBase):
"""Proxy of C++ GIFAnimation class"""
def __repr__(self):
return "<%s.%s; proxy of C++ wxGIFAnimation instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
"""__init__(self) -> GIFAnimation"""
newobj = _animate.new_GIFAnimation(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
def __del__(self, destroy=_animate.delete_GIFAnimation):
"""__del__(self)"""
try:
if self.thisown: destroy(self)
except: pass
def GetFrameCount(*args, **kwargs):
"""GetFrameCount(self) -> int"""
return _animate.GIFAnimation_GetFrameCount(*args, **kwargs)
def GetFrame(*args, **kwargs):
"""GetFrame(self, int i) -> Image"""
return _animate.GIFAnimation_GetFrame(*args, **kwargs)
def GetDisposalMethod(*args, **kwargs):
"""GetDisposalMethod(self, int i) -> int"""
return _animate.GIFAnimation_GetDisposalMethod(*args, **kwargs)
def GetFrameRect(*args, **kwargs):
"""GetFrameRect(self, int i) -> Rect"""
return _animate.GIFAnimation_GetFrameRect(*args, **kwargs)
def GetDelay(*args, **kwargs):
"""GetDelay(self, int i) -> int"""
return _animate.GIFAnimation_GetDelay(*args, **kwargs)
def GetLogicalScreenSize(*args, **kwargs):
"""GetLogicalScreenSize(self) -> Size"""
return _animate.GIFAnimation_GetLogicalScreenSize(*args, **kwargs)
def GetBackgroundColour(*args, **kwargs):
"""GetBackgroundColour(self, Colour col) -> bool"""
return _animate.GIFAnimation_GetBackgroundColour(*args, **kwargs)
def GetTransparentColour(*args, **kwargs):
"""GetTransparentColour(self, Colour col) -> bool"""
return _animate.GIFAnimation_GetTransparentColour(*args, **kwargs)
def IsValid(*args, **kwargs):
"""IsValid(self) -> bool"""
return _animate.GIFAnimation_IsValid(*args, **kwargs)
def LoadFile(*args, **kwargs):
"""LoadFile(self, String filename) -> bool"""
return _animate.GIFAnimation_LoadFile(*args, **kwargs)
class GIFAnimationPtr(GIFAnimation):
def __init__(self, this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = GIFAnimation
_animate.GIFAnimation_swigregister(GIFAnimationPtr)
AN_FIT_ANIMATION = _animate.AN_FIT_ANIMATION
class GIFAnimationCtrl(_core.Control):
"""Proxy of C++ GIFAnimationCtrl class"""
def __repr__(self):
return "<%s.%s; proxy of C++ wxGIFAnimationCtrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, String filename=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxAN_FIT_ANIMATION|wxNO_BORDER,
String name=AnimationControlNameStr) -> GIFAnimationCtrl
"""
newobj = _animate.new_GIFAnimationCtrl(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
self._setOORInfo(self)
def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, String filename=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=wxAN_FIT_ANIMATION|wxNO_BORDER,
String name=AnimationControlNameStr) -> bool
"""
return _animate.GIFAnimationCtrl_Create(*args, **kwargs)
def LoadFile(*args, **kwargs):
"""LoadFile(self, String filename=EmptyString) -> bool"""
return _animate.GIFAnimationCtrl_LoadFile(*args, **kwargs)
def Play(*args, **kwargs):
"""Play(self, bool looped=True) -> bool"""
return _animate.GIFAnimationCtrl_Play(*args, **kwargs)
def Stop(*args, **kwargs):
"""Stop(self)"""
return _animate.GIFAnimationCtrl_Stop(*args, **kwargs)
def FitToAnimation(*args, **kwargs):
"""FitToAnimation(self)"""
return _animate.GIFAnimationCtrl_FitToAnimation(*args, **kwargs)
def IsPlaying(*args, **kwargs):
"""IsPlaying(self) -> bool"""
return _animate.GIFAnimationCtrl_IsPlaying(*args, **kwargs)
def GetPlayer(*args, **kwargs):
"""GetPlayer(self) -> AnimationPlayer"""
return _animate.GIFAnimationCtrl_GetPlayer(*args, **kwargs)
def GetAnimation(*args, **kwargs):
"""GetAnimation(self) -> AnimationBase"""
return _animate.GIFAnimationCtrl_GetAnimation(*args, **kwargs)
def GetFilename(*args, **kwargs):
"""GetFilename(self) -> String"""
return _animate.GIFAnimationCtrl_GetFilename(*args, **kwargs)
def SetFilename(*args, **kwargs):
"""SetFilename(self, String filename)"""
return _animate.GIFAnimationCtrl_SetFilename(*args, **kwargs)
class GIFAnimationCtrlPtr(GIFAnimationCtrl):
def __init__(self, this):
self.this = this
if not hasattr(self,"thisown"): self.thisown = 0
self.__class__ = GIFAnimationCtrl
_animate.GIFAnimationCtrl_swigregister(GIFAnimationCtrlPtr)
def PreGIFAnimationCtrl(*args, **kwargs):
"""PreGIFAnimationCtrl() -> GIFAnimationCtrl"""
val = _animate.new_PreGIFAnimationCtrl(*args, **kwargs)
val.thisown = 1
return val

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
import wx
from wx.animate import GIFAnimationCtrl
from Main import opj
GIFNames = [
"bitmaps/ani-bttrfly.gif",
"bitmaps/ani-avtr.gif",
"bitmaps/ani-phone.gif",
# "bitmaps/ani-walker.gif",
"bitmaps/ani-man.gif",
"bitmaps/ani-bookworm.gif",
"bitmaps/ani-hooked.gif",
]
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
sizer = wx.FlexGridSizer(2,3,5,5)
for name in GIFNames:
ani = GIFAnimationCtrl(self, -1, opj(name))
ani.GetPlayer().UseBackgroundColour(True)
ani.Play()
sizer.Add(ani, 0, wx.ALL, 10)
border = wx.BoxSizer()
border.Add(sizer, 1, wx.EXPAND|wx.ALL, 20)
self.SetSizer(border)
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html><body>
<h2><center>wx.animate.GIFAnimationCtrl</center></h2>
wx.animate.GIFAnimationCtrl is like a wx.StaticBitmap but is able to
display an animation by extracing frames from a multi-images GIF file.
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

View File

@ -48,6 +48,7 @@ _treeList = [
# new stuff
('Recent Additions/Updates', [
'FoldPanelBar',
'GIFAnimationCtrl',
]),
# managed windows == things with a (optional) caption you can close
@ -153,6 +154,7 @@ _treeList = [
'FloatBar',
'FloatCanvas',
'FoldPanelBar',
'GIFAnimationCtrl',
'HtmlWindow',
'IntCtrl',
'MediaCtrl',
@ -211,6 +213,7 @@ _treeList = [
'ArtProvider',
'Cursor',
'DragImage',
'GIFAnimationCtrl',
'Image',
'ImageAlpha',
'ImageFromStream',

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -16,6 +16,10 @@ wxPython/contrib/activex/wxie
wxPython/contrib/activex/wxie/doxydoc
wxPython/contrib/activex/wxie/latex
wxPython/contrib/dllwidget
wxPython/contrib/animate
wxPython/contrib/animate/gtk
wxPython/contrib/animate/mac
wxPython/contrib/animate/msw
wxPython/contrib/gizmos
wxPython/contrib/gizmos/gtk
wxPython/contrib/gizmos/mac

View File

@ -258,6 +258,7 @@ if [ $skipbuild != yes ]; then
touch lib/libwx*.r*
make $MAKEJOBS
make $MAKEJOBS -C contrib/src/animate
make $MAKEJOBS -C contrib/src/gizmos
make $MAKEJOBS -C contrib/src/stc
@ -277,9 +278,10 @@ fi
if [ $skipinstall != yes ]; then
# Install wxWidgets
cd $WXBLD
make prefix=$INSTALLROOT$PREFIX install
make -C contrib/src/gizmos prefix=$INSTALLROOT$PREFIX install
make -C contrib/src/stc prefix=$INSTALLROOT$PREFIX install
make prefix=$INSTALLROOT$PREFIX install
make -C contrib/src/animate prefix=$INSTALLROOT$PREFIX install
make -C contrib/src/gizmos prefix=$INSTALLROOT$PREFIX install
make -C contrib/src/stc prefix=$INSTALLROOT$PREFIX install
# relink wx-config with a relative link

View File

@ -83,6 +83,7 @@ Source: "wx\_calendar.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; C
Source: "wx\_controls_.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core
Source: "wx\_core_.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core
Source: "wx\_gdi_.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core
Source: "wx\_animate.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core
Source: "wx\_gizmos.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core
Source: "wx\_glcanvas.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core
Source: "wx\_grid.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core

View File

@ -211,8 +211,8 @@ cd bld
make
make -C contrib/src/animate
make -C contrib/src/gizmos
##make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0"
make -C contrib/src/stc
@ -238,8 +238,8 @@ WXDIR=`pwd`
# Install wxGTK and contribs
cd bld
make prefix=$RPM_BUILD_ROOT%{wxpref} install
make -C contrib/src/animate prefix=$RPM_BUILD_ROOT%{wxpref} install
make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install
##make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install
make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install

View File

@ -141,6 +141,7 @@ place, then do the same for wxPython.
dir I don't lose my scripts too.) This is what it looks like::
make $* \
&& make -C contrib/src/animate $* \
&& make -C contrib/src/gizmos $* \
&& make -C contrib/src/stc $*
@ -392,6 +393,7 @@ accordingly if you are using the bash shell.
same command from the following directories in order to build the
contrib libraries::
%WXDIR%\contrib\build\animate
%WXDIR%\contrib\build\gizmos
%WXDIR%\contrib\build\stc

View File

@ -64,6 +64,13 @@ this gives more flexibility on where the data can come from.
Added MDI support to XRC
Added wx.animate module and a demo. The wx.animate module provides a
control that is able to display an animated GIF file.
wx.lib.plot.py: Applied patch from Werner F. Bruhin that allows either
vertical and/or horizontal gridlines.

View File

@ -648,6 +648,33 @@ if BUILD_GIZMOS:
wxpExtensions.append(ext)
#----------------------------------------------------------------------
# Define the ANIMATE extension module
#----------------------------------------------------------------------
if BUILD_ANIMATE:
msg('Preparing ANIMATE...')
location = 'contrib/animate'
swig_sources = run_swig(['animate.i'], location, GENDIR, PKGDIR,
USE_SWIG, swig_force, swig_args, swig_deps)
ext = Extension('_animate',
swig_sources,
include_dirs = includes + CONTRIBS_INC,
define_macros = defines,
library_dirs = libdirs,
libraries = libs + makeLibName('animate'),
extra_compile_args = cflags,
extra_link_args = lflags,
)
wxpExtensions.append(ext)
#----------------------------------------------------------------------
# Define the DLLWIDGET extension module

View File

@ -0,0 +1,38 @@
## This file reverse renames symbols in the wx package to give
## them their wx prefix again, for backwards compatibility.
##
## Generated by BuildRenamers in config.py
# This silly stuff here is so the wxPython.wx module doesn't conflict
# with the wx package. We need to import modules from the wx package
# here, then we'll put the wxPython.wx entry back in sys.modules.
import sys
_wx = None
if sys.modules.has_key('wxPython.wx'):
_wx = sys.modules['wxPython.wx']
del sys.modules['wxPython.wx']
import wx.animate
sys.modules['wxPython.wx'] = _wx
del sys, _wx
# Now assign all the reverse-renamed names:
wxAnimationControlNameStr = wx.animate.AnimationControlNameStr
wxANIM_UNSPECIFIED = wx.animate.ANIM_UNSPECIFIED
wxANIM_DONOTREMOVE = wx.animate.ANIM_DONOTREMOVE
wxANIM_TOBACKGROUND = wx.animate.ANIM_TOBACKGROUND
wxANIM_TOPREVIOUS = wx.animate.ANIM_TOPREVIOUS
wxAnimationPlayer = wx.animate.AnimationPlayer
wxAnimationPlayerPtr = wx.animate.AnimationPlayerPtr
wxAnimationBase = wx.animate.AnimationBase
wxAnimationBasePtr = wx.animate.AnimationBasePtr
wxGIFAnimation = wx.animate.GIFAnimation
wxGIFAnimationPtr = wx.animate.GIFAnimationPtr
wxAN_FIT_ANIMATION = wx.animate.AN_FIT_ANIMATION
wxGIFAnimationCtrl = wx.animate.GIFAnimationCtrl
wxGIFAnimationCtrlPtr = wx.animate.GIFAnimationCtrlPtr
wxPreGIFAnimationCtrl = wx.animate.PreGIFAnimationCtrl