mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-08 21:10:06 +01:00
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:
1
TODO.txt
1
TODO.txt
@@ -132,7 +132,6 @@ other dev stuff
|
||||
* dialup ??
|
||||
* docmdi ??
|
||||
* docview ??
|
||||
* fswatcher
|
||||
* msgout
|
||||
* palette ?
|
||||
* persist ?
|
||||
|
||||
@@ -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
56
etg/fswatcher.py
Normal 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()
|
||||
|
||||
21
unittests/test_fswatcher.py
Normal file
21
unittests/test_fswatcher.py
Normal 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()
|
||||
Reference in New Issue
Block a user