Add wxFileSystemWatcher

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-08-02 05:39:26 +00:00
parent 6098d5d07e
commit 150725928a
4 changed files with 79 additions and 1 deletions

View File

@@ -132,7 +132,6 @@ other dev stuff
* dialup ??
* docmdi ??
* docview ??
* fswatcher
* msgout
* palette ?
* persist ?

View File

@@ -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',
]

56
etg/fswatcher.py Normal file
View File

@@ -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 <wx/fswatcher.h>')
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()

View File

@@ -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()