diff --git a/TODO.txt b/TODO.txt index b7d09939..0f7df797 100644 --- a/TODO.txt +++ b/TODO.txt @@ -132,7 +132,6 @@ other dev stuff * dialup ?? * docmdi ?? * docview ?? - * fswatcher * msgout * palette ? * persist ? diff --git a/etg/_core.py b/etg/_core.py index 2d130630..0ec97269 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -36,6 +36,7 @@ INCLUDES = [ # base and core stuff 'wxpy_api', 'arrayholder', 'string', + 'filename', 'arrays', 'clntdata', 'userdata', @@ -210,6 +211,7 @@ INCLUDES = [ # base and core stuff 'mousemanager', 'filehistory', 'cmdproc', + 'fswatcher', ] diff --git a/etg/fswatcher.py b/etg/fswatcher.py new file mode 100644 index 00000000..f9bf5a59 --- /dev/null +++ b/etg/fswatcher.py @@ -0,0 +1,56 @@ +#--------------------------------------------------------------------------- +# Name: etg/fswatcher.py +# Author: Robin Dunn +# +# Created: 29-Jul-2012 +# Copyright: (c) 2012 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_core" +NAME = "fswatcher" # 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 = [ "wxFileSystemWatcher", + "wxFileSystemWatcherEvent", + ] + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + + #----------------------------------------------------------------- + # Tweak the parsed meta objects in the module object as needed for + # customizing the generated code and docstrings. + + module.addHeaderCode('#include ') + + c = module.find('wxFileSystemWatcher') + assert isinstance(c, etgtools.ClassDef) + + + c = module.find('wxFileSystemWatcherEvent') + tools.fixEventClass(c) + + c.addPyCode("""\ + EVT_FSWATCHER = wx.PyEventBinder(wxEVT_FSWATCHER) + """) + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/unittests/test_fswatcher.py b/unittests/test_fswatcher.py new file mode 100644 index 00000000..85260c19 --- /dev/null +++ b/unittests/test_fswatcher.py @@ -0,0 +1,21 @@ +import imp_unittest, unittest +import wtc +import wx + +#--------------------------------------------------------------------------- + +class fswatcher_Tests(wtc.WidgetTestCase): + + def test_fswatcher1(self): + + evtLoop = self.app.GetTraits().CreateEventLoop() + activator = wx.EventLoopActivator(evtLoop) # automatically restores the old one + watcher = wx.FileSystemWatcher() + watcher.Add(__file__) + watcher.Bind(wx.EVT_FSWATCHER, lambda evt: None) + + +#--------------------------------------------------------------------------- + +if __name__ == '__main__': + unittest.main()