Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use generic animation classes on all platforms #1579

Merged
merged 29 commits into from Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
799d94b
Enable adding extra TypeHeader text in wxListWrapperTemplate
RobinD42 Mar 25, 2020
24be75d
Add --disable-nativeanimation to configure command
RobinD42 Mar 25, 2020
73b18b6
Add animation decoders
RobinD42 Mar 25, 2020
3298d64
Update wxWidgets ref
RobinD42 Mar 25, 2020
a263e02
Some additional default typeVal items for the stubs generator
Mar 25, 2020
eafc9a3
Add TODO for handling when the native ctrl is configured
Mar 25, 2020
62ab56e
--disable-nativeanimation is gone, wxGenericAnimationCtrl is a real c…
RobinD42 Mar 25, 2020
93f75b0
Remove TODO
RobinD42 Mar 25, 2020
192577e
Add new animation classes
RobinD42 Mar 30, 2020
b92bf63
Add ability to select native of generic animation classes
RobinD42 Mar 30, 2020
58d6eae
Update wxWidgets ref
RobinD42 Mar 30, 2020
0890976
Add changelog entry
RobinD42 Mar 30, 2020
df018ac
Update wxWidgets ref
RobinD42 Apr 1, 2020
7aac38d
Updates needed for animation updates in wxWidgets
RobinD42 Apr 1, 2020
669b11d
Update wxWidgets ref
RobinD42 Apr 2, 2020
75d8def
Trim whitespace
RobinD42 Apr 2, 2020
0af8589
wxAnimationGenericImpl is not public
RobinD42 Apr 3, 2020
8d998a9
Update wxWidgets ref
RobinD42 Apr 3, 2020
8525541
Update wxWidgets ref
RobinD42 Apr 6, 2020
1b579fc
More updates for changes in wxWidgets animation classes
RobinD42 Apr 6, 2020
0d838c1
Make wxGenericAnimationCtrl derive from wxControl, and add missing me…
Apr 6, 2020
0d6f2d2
Changes needed to ensure both the native and generic controls can be …
Apr 6, 2020
4dcd9a7
Ensure animationctrl virtuals are still virtual in the wrapper classes
RobinD42 Apr 6, 2020
6037779
Try different usages of creating the animation and control
RobinD42 Apr 6, 2020
bd6af90
Add CreateCompatibleAnimation
RobinD42 Apr 6, 2020
ca1d367
Update wxWidgets ref
RobinD42 Apr 6, 2020
04c82c5
Some of the copied methods are not virtuals
Apr 6, 2020
550cf16
Rename the module in the demo to match the actual class name
RobinD42 Apr 6, 2020
2cff46c
Add more details to the changelog for the animation changes.
RobinD42 Apr 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 29 additions & 23 deletions CHANGES.rst
Expand Up @@ -18,7 +18,7 @@ Pip: ``pip install wxPython==4.1.0``

Starting with this release wxPython has switched to tracking the wxWidgets
master branch (version 3.1.x) for the wxWidgets source code, which wxPython is
built upon, and which is included in the wxPython source archives.
built upon, and which is included in the wxPython source archives.

New and improved in this release:

Expand All @@ -37,8 +37,8 @@ New and improved in this release:
with warnings enabled so you can see which class, method or function calls
you need to change.

* Bug fixes in wx.lib.calendar: key navigation across month boundaries is now
possible; key navigation now sets the date and fires the EVT_CALENDAR event;
* Bug fixes in wx.lib.calendar: key navigation across month boundaries is now
possible; key navigation now sets the date and fires the EVT_CALENDAR event;
setter APIs now set the date correctly (#1230).

* Switch to using a wx.Overlay in the Widget Inspection Tool to highlight
Expand All @@ -49,7 +49,7 @@ New and improved in this release:

* Grafted on a EnableSystemTheme method to the classes which support it. This
can be used to disable the default system theme on Windows for native widgets
like wx.ListCtrl, wx.TreeCtrl and wx.dataview.DataViewCtrl. It has no effect
like wx.ListCtrl, wx.TreeCtrl and wx.dataview.DataViewCtrl. It has no effect
on the other platforms.

* The wx.WS_EX_VALIDATE_RECURSIVELY extended style flag is obsolete, as it is
Expand All @@ -60,13 +60,13 @@ New and improved in this release:
* Fix a sometimes crash when using a wx.Overlay by letting the wx.DCOverlay hold
a reference to the DC, to ensure that the DCOverlay is destroyed first.
(PR#1301)

* Replaced the Vagrant VMs used for building wxPython for various Linux distros
with Docker images.

* Add some missing methods in wx.adv.BitmapComboBox (#1307)

* Added the wx.svg package which contains code for parsing SVG (Scalable Vector
* Added the wx.svg package which contains code for parsing SVG (Scalable Vector
Graphics) files, and also code for integrating with wxPython. It can rasterize
the SVG to a wx.Bitmap of any size with no loss of quality, and it can also
render the SVG directly to a wx.GraphicsContext using the GC's drawing
Expand All @@ -75,10 +75,10 @@ New and improved in this release:
* Ported the embedding sample from Classic, which shows how to use wxPython from
a C++ wxWidgets application that embeds Python. (PR #1353)

* Fixed wx.GetApp() to use wxWidgets' global wxApp instance instead of
* Fixed wx.GetApp() to use wxWidgets' global wxApp instance instead of
maintaining its own pointer. This way, if the wxApp is created by C++ code
wxPython will still be able to get access to it. (#1126)

* Added wrappers for the wx.ActivityIndicator class.

* Added wrappers for the wx.CollapsibleHeaderCtrl class.
Expand All @@ -88,6 +88,12 @@ New and improved in this release:
* Added wx.msw.CHMHelpController, and also a wx.HelpController factory function
that creates an instance of the best Help Controller for the platform. (#1536)

* Added wx.adv.GenericAnimationCtrl so the generic version of the animation classes
can be used even on the platforms that have a native version. Note that due to
internal changes to support both types of animations, some API changes in how
the Animation objects are created. See the AnimationCtrl.py sample in the demo
for the various usage patterns (#1579)




Expand Down Expand Up @@ -130,13 +136,13 @@ Pip: ``pip install wxPython==4.0.7``
This release is comprised mostly of fixes and minor features which have been
back-ported from the master branch. This release is likely the last release of
the 4.0.x release series, and is certainly the last 4.0.x release that will
support Python 2.7. It may still continue to build for Python 2.7 for some time,
support Python 2.7. It may still continue to build for Python 2.7 for some time,
but no extra effort will be expended to keep it compatible.

This release provides the following changes:

* Bug fixes in wx.lib.calendar: key navigation across month boundaries is now
possible; key navigation now sets the date and fires the EVT_CALENDAR event;
* Bug fixes in wx.lib.calendar: key navigation across month boundaries is now
possible; key navigation now sets the date and fires the EVT_CALENDAR event;
setter APIs now set the date correctly (#1230).

* Switch to using a wx.Overlay in the Widget Inspection Tool to highlight
Expand All @@ -148,16 +154,16 @@ This release provides the following changes:
* Fix a sometimes crash when using a wx.Overlay by letting the wx.DCOverlay hold
a reference to the DC, to ensure that the DCOverlay is destroyed first.
(PR#1301)

* Ported the embedding sample from Classic, which shows how to use wxPython from
a C++ wxWidgets application that embeds Python. (PR #1353)

* Fixed wx.GetApp() to use wxWidgets' global wxApp instance instead of
* Fixed wx.GetApp() to use wxWidgets' global wxApp instance instead of
maintaining its own pointer. This way, if the wxApp is created by C++ code
wxPython will still be able to get access to it. (#1126)
* Several other PRs have been backported from the master branch (which will
become wxPython 4.1.0), the full list can be seen here:

* Several other PRs have been backported from the master branch (which will
become wxPython 4.1.0), the full list can be seen here:
https://github.com/wxWidgets/Phoenix/pull/1357


Expand All @@ -181,8 +187,8 @@ This release provides the following fixes:
* Reverted the change that loads up install_requires from the contents of
requirements.txt. Split the requirements.txt file into one for install and one
for development.




4.0.5 "St. Helens Day"
Expand All @@ -195,21 +201,21 @@ Pip: ``pip install wxPython==4.0.5``

Changes in this release include the following:

* Added missing HtmlWindow.ScrollToAnchor method, and also a couple methods
* Added missing HtmlWindow.ScrollToAnchor method, and also a couple methods
in HtmlCell too. (#1141)

* Added missing setters for the wheel-related properties in wx.MouseEvent.
* Added missing setters for the wheel-related properties in wx.MouseEvent.
(#1140)

* Updated wxWidgets commit reference, bringing fixes for #1140, #1086 and
* Updated wxWidgets commit reference, bringing fixes for #1140, #1086 and
#1147.

* Fix the use of the output parameter in HtmlWindow.OnOpeningURL the same way
* Fix the use of the output parameter in HtmlWindow.OnOpeningURL the same way
it was fixed in HtmlWindowInterface.OnHTMLOpeningURL. (#1068)

* Fixed a crashing bug when using a member of a transient wx.VisualAttributes
object. Also set the attributes to be read-only to simplify the fix. (#1198).

* Updated the sip being used in wxPython builds to version 4.19.16.

* Added helper functions to check results of wxWidgets configure during the
Expand Down
61 changes: 0 additions & 61 deletions demo/AnimateCtrl.py

This file was deleted.

104 changes: 104 additions & 0 deletions demo/AnimationCtrl.py
@@ -0,0 +1,104 @@
#!/usr/bin/env python

import wx
from wx.adv import Animation

UseNative = True
if UseNative:
# Use the native classes, if the platform has a native widget. It will fall
# back to the generic version if there isn't a native one available.
from wx.adv import AnimationCtrl
else:
# Or we can force use of the generic widget on all platforms
from wx.adv import GenericAnimationCtrl as AnimationCtrl

from Main import opj

GIFNames = [
'bitmaps/AG00178_.gif',
'bitmaps/BD13656_.gif',
'bitmaps/AG00185_.gif',
'bitmaps/AG00039_.gif',
'bitmaps/AG00183_.gif',
'bitmaps/AG00028_.gif',
]

#----------------------------------------------------------------------

class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
sizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)

for name in GIFNames:
# There are a few usage pattens for creating the control and the
# animation object. They're more-or-less equivalent, but if you have
# non-standard needs in your application then one pattern may make
# more sense for you to use.
if False:
# If you need a separate animation object then you can have the
# control create one for you.
ctrl = AnimationCtrl(self)
ani = ctrl.CreateAnimation()
ani.LoadFile(opj(name))
ctrl.SetAnimation(ani)
elif False:
# if you need to have the animation object before the control is
# created, then you can do it like this:
ani = AnimationCtrl.CreateCompatibleAnimation()
ani.LoadFile(opj(name))
ctrl = AnimationCtrl(self, -1, ani)
else:
# Or you can keep it simple and just have the control make and
# use its own animation object internally.
ctrl = AnimationCtrl(self)
ctrl.LoadFile(opj(name))

ctrl.SetBackgroundColour(self.GetBackgroundColour())
ctrl.Play()
sizer.Add(ctrl, 0, wx.ALL, 10)

if UseNative and 'wxGTK' in wx.PlatformInfo:
# See comment in updateBestSizes below
wx.CallAfter(self.updateBestSizes)

border = wx.BoxSizer()
border.Add(sizer, 1, wx.EXPAND | wx.ALL, 20)
self.SetSizer(border)

def updateBestSizes(self):
# The native control on GTK is not able to set the BestSize of the
# animation widget until after it has finished loading the animation
# images. So here we will invalidate the initial best size, so it will
# be recalculated on the next layout of the sizer.
for child in self.GetChildren():
if isinstance(child, AnimationCtrl):
child.InvalidateBestSize()
self.Layout()

#----------------------------------------------------------------------

def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win

#----------------------------------------------------------------------



overview = """<html><body>
<h2><center>wx.adv.AnimationCtrl</center></h2>

wx.adv.AnimationCtrl is like a wx.StaticBitmap but is able to
display an animation by extracting frames from a multi-image GIF file.

</body></html>
"""


if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

2 changes: 1 addition & 1 deletion demo/demodata.py
Expand Up @@ -247,7 +247,7 @@
('Using Images', [
'AdjustChannels',
'AlphaDrawing',
'AnimateCtrl',
'AnimationCtrl',
'ArtProvider',
'BitmapFromBuffer',
'Cursor',
Expand Down
18 changes: 18 additions & 0 deletions docs/sphinx/itemToModuleMap.json
Expand Up @@ -110,10 +110,17 @@
"AND":"wx.",
"AND_INVERT":"wx.",
"AND_REVERSE":"wx.",
"ANIDecoder":"wx.adv.",
"ANIMATION_IMPL_TYPE_GENERIC":"wx.adv.",
"ANIMATION_IMPL_TYPE_NATIVE":"wx.adv.",
"ANIMATION_TYPE_ANI":"wx.adv.",
"ANIMATION_TYPE_ANY":"wx.adv.",
"ANIMATION_TYPE_GIF":"wx.adv.",
"ANIMATION_TYPE_INVALID":"wx.adv.",
"ANIM_DONOTREMOVE":"wx.adv.",
"ANIM_TOBACKGROUND":"wx.adv.",
"ANIM_TOPREVIOUS":"wx.adv.",
"ANIM_UNSPECIFIED":"wx.adv.",
"ANTIALIAS_DEFAULT":"wx.",
"ANTIALIAS_NONE":"wx.",
"APPLY":"wx.",
Expand Down Expand Up @@ -300,8 +307,15 @@
"AlphaPixelData":"wx.",
"AlphaPixelData_Accessor":"wx.",
"Animation":"wx.adv.",
"AnimationBase":"wx.adv.",
"AnimationCtrl":"wx.adv.",
"AnimationCtrlGeneric":"wx.adv.",
"AnimationCtrlNameStr":"wx.adv.",
"AnimationDecoder":"wx.adv.",
"AnimationDisposal":"wx.adv.",
"AnimationGenericImpl":"wx.adv.",
"AnimationImpl":"wx.adv.",
"AnimationImplType":"wx.adv.",
"AnimationType":"wx.adv.",
"AntialiasMode":"wx.",
"AnyButton":"wx.",
Expand Down Expand Up @@ -1306,6 +1320,7 @@
"GBSpan":"wx.",
"GCDC":"wx.",
"GDIObject":"wx.",
"GIFDecoder":"wx.adv.",
"GIFHandler":"wx.",
"GLAttribsBase":"wx.glcanvas.",
"GLAttributes":"wx.glcanvas.",
Expand Down Expand Up @@ -1347,6 +1362,8 @@
"Gauge":"wx.",
"GaugeNameStr":"wx.",
"GenericAboutBox":"wx.adv.",
"GenericAnimation":"wx.adv.",
"GenericAnimationCtrl":"wx.adv.",
"GenericCalendarCtrl":"wx.adv.",
"GenericDatePickerCtrl":"wx.adv.",
"GenericDirCtrl":"wx.",
Expand Down Expand Up @@ -2520,6 +2537,7 @@
"NullColour":"wx.",
"NullCursor":"wx.",
"NullFont":"wx.",
"NullGenericAnimation":"wx.adv.",
"NullGraphicsBitmap":"wx.",
"NullGraphicsBrush":"wx.",
"NullGraphicsFont":"wx.",
Expand Down