diff --git a/etg/_media.py b/etg/_media.py new file mode 100644 index 00000000..fa99aa57 --- /dev/null +++ b/etg/_media.py @@ -0,0 +1,75 @@ +#--------------------------------------------------------------------------- +# Name: etg/_media.py +# Author: Dietmar Schwertberger +# +# Created: 13-Nov-2015 +# Copyright: (c) 2015 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + + +import etgtools +import etgtools.tweaker_tools as tools +from etgtools import PyFunctionDef, PyCodeDef, PyPropertyDef + +PACKAGE = "wx" +MODULE = "_media" +NAME = "_media" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ ] + + + +# The list of other ETG scripts and back-end generator modules that are +# included as part of this module. These items are in their own etg scripts +# for easier maintainability, but their class and function definitions are +# intended to be part of this module, not their own module. This also makes it +# easier to promote one of these to module status later if desired, simply +# remove it from this list of Includes, and change the MODULE value in the +# promoted script to be the same as its NAME. + +INCLUDES = [ 'mediactrl', + ] + + +# Separate the list into those that are generated from ETG scripts and the +# rest. These lists can be used from the build scripts to get a list of +# sources and/or additional dependencies when building this extension module. +ETGFILES = ['etg/%s.py' % NAME] + tools.getEtgFiles(INCLUDES) +DEPENDS = tools.getNonEtgFiles(INCLUDES) +OTHERDEPS = [ ] + + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + module.check4unittest = False + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + module.addHeaderCode('#include ') + module.addImport('_core') + module.addPyCode('import wx', order=10) + module.addInclude(INCLUDES) + + + #----------------------------------------------------------------- + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + run() diff --git a/etg/mediactrl.py b/etg/mediactrl.py new file mode 100644 index 00000000..7a23f762 --- /dev/null +++ b/etg/mediactrl.py @@ -0,0 +1,85 @@ +#--------------------------------------------------------------------------- +# Name: etg/metafile.py +# Author: Robin Dunn +# Dietmar Schwertberger +# +# Created: 24-Nov-2015 +# Copyright: (c) 2015 by Wide Open Technologies +# License: wxWindows License +#--------------------------------------------------------------------------- + + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_media" +NAME = "mediactrl" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ 'wxMediaCtrl', + 'wxMediaEvent'] + + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + module.addHeaderCode('#include "wx/mediactrl.h"') + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + c = module.find('wxMediaCtrl') + c.addPrivateCopyCtor() + + c.find('wxMediaCtrl.id').default = '-1' + c.find('Create.id').default = '-1' + + # the C++ class has three overloaded Load(...) methods + # for now we ignore all than the first one for loading a filename + for item in c.findAll("Load"): + if not "fileName" in item.argsString: + # ignore e.g. the Load with args '(const wxURI &uri)' + # keep e.g. '(const wxString &fileName)' + item.ignore() + + + + c = module.find('wxMediaEvent') + tools.fixEventClass(c) + + c.addPyCode("""\ + EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED ) + EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP ) + EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED ) + EVT_MEDIA_STATECHANGED = wx.PyEventBinder( wxEVT_MEDIA_STATECHANGED ) + EVT_MEDIA_PLAY = wx.PyEventBinder( wxEVT_MEDIA_PLAY ) + EVT_MEDIA_PAUSE = wx.PyEventBinder( wxEVT_MEDIA_PAUSE ) + """) + + + # See mediactrl.h: + module.addPyCode("""\ + MEDIABACKEND_DIRECTSHOW = "wxAMMediaBackend" + MEDIABACKEND_MCI = "wxMCIMediaBackend" + MEDIABACKEND_QUICKTIME = "wxQTMediaBackend" + MEDIABACKEND_GSTREAMER = "wxGStreamerMediaBackend" + MEDIABACKEND_REALPLAYER = "wxRealPlayerMediaBackend" + MEDIABACKEND_WMP10 = "wxWMP10MediaBackend" + """) + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/ext/wxWidgets b/ext/wxWidgets index 3d7d7aae..b010793e 160000 --- a/ext/wxWidgets +++ b/ext/wxWidgets @@ -1 +1 @@ -Subproject commit 3d7d7aaea6b4078abdffbd72e74cdfab7b438856 +Subproject commit b010793ea84807697f270a3feddc4da78aa5cb0f diff --git a/unittests/test_mediactrl.py b/unittests/test_mediactrl.py new file mode 100644 index 00000000..be371aac --- /dev/null +++ b/unittests/test_mediactrl.py @@ -0,0 +1,55 @@ +import imp_unittest, unittest +import wtc +import wx +import wx.media + +#--------------------------------------------------------------------------- + +class mediactrl_Tests(wtc.WidgetTestCase): + + def test_mediactrl1(self): + wx.media.MEDIASTATE_STOPPED + wx.media.MEDIASTATE_PAUSED + wx.media.MEDIASTATE_PLAYING + wx.media.MEDIACTRLPLAYERCONTROLS_NONE + wx.media.MEDIACTRLPLAYERCONTROLS_STEP + wx.media.MEDIACTRLPLAYERCONTROLS_VOLUME + wx.media.MEDIACTRLPLAYERCONTROLS_DEFAULT + + wx.media.MEDIABACKEND_DIRECTSHOW + wx.media.MEDIABACKEND_MCI + wx.media.MEDIABACKEND_QUICKTIME + wx.media.MEDIABACKEND_GSTREAMER + wx.media.MEDIABACKEND_REALPLAYER + wx.media.MEDIABACKEND_WMP10 + + def test_mediactrl2(self): + mc = wx.media.MediaCtrl() + mc.Create(self.frame) + + def test_mediactrl3(self): + mc = wx.media.MediaCtrl(self.frame) + + + def test_mediactrl4(self): + evt = wx.media.MediaEvent() + + def test_mediactrl5(self): + wx.media.wxEVT_MEDIA_LOADED + wx.media.wxEVT_MEDIA_STOP + wx.media.wxEVT_MEDIA_FINISHED + wx.media.wxEVT_MEDIA_STATECHANGED + wx.media.wxEVT_MEDIA_PLAY + wx.media.wxEVT_MEDIA_PAUSE + + wx.media.EVT_MEDIA_LOADED + wx.media.EVT_MEDIA_STOP + wx.media.EVT_MEDIA_FINISHED + wx.media.EVT_MEDIA_STATECHANGED + wx.media.EVT_MEDIA_PLAY + wx.media.EVT_MEDIA_PAUSE + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main() diff --git a/wscript b/wscript index 83aba8a4..e242bfee 100644 --- a/wscript +++ b/wscript @@ -134,6 +134,10 @@ def configure(conf): _copyEnvGroup(conf.env, '_WX', '_WXRICHTEXT') conf.env.LIB_WXRICHTEXT += cfg.makeLibName('richtext') + _copyEnvGroup(conf.env, '_WX', '_WXMEDIA') + conf.env.LIB_WXMEDIA += cfg.makeLibName('media') + + # ** Add code for new modules here (and below for non-MSW) # tweak the PYEXT compile and link flags if making a --debug build @@ -561,6 +565,14 @@ def build(bld): ) makeExtCopyRule(bld, '_richtext') + etg = loadETG('etg/_media.py') + bld(features = 'c cxx cxxshlib pyext', + target = makeTargetName(bld, '_media'), + source = getEtgSipCppFiles(etg) + rc, + uselib = 'WX WXPY WXMEDIA', + ) + makeExtCopyRule(bld, '_media') + # ** Add code for new modules here