Re: Subclassing by monkey-patching

2010-09-06 Thread Glazner
On Sep 6, 11:08 am, Bruno Desthuilliers wrote: > Jason a écrit : > > > On Sep 5, 3:53 pm, Peter Otten <__pete...@web.de> wrote: > > m = gio.File(".").monitor_directory() > > C = type(m) > > > 'C' will not necessarily be 'gio.FileMonitor' — I think the internals > > of the GIO methods might

Re: Subclassing by monkey-patching

2010-09-06 Thread Bruno Desthuilliers
Jason a écrit : On Sep 5, 3:53 pm, Peter Otten <__pete...@web.de> wrote: m = gio.File(".").monitor_directory() C = type(m) 'C' will not necessarily be 'gio.FileMonitor' — I think the internals of the GIO methods might further "subclass" it in some way depending on what underlying monitors are

Re: Subclassing by monkey-patching

2010-09-05 Thread Jason
On Sep 6, 8:57 am, Jason wrote: > But it's looking more and more like I should give up > that particular goal. ...but on the other hand I just knocked together a pyinotify threaded watch system in about 50 lines. It's tempting to tell users of other platforms to write their own and submit a p

Re: Subclassing by monkey-patching

2010-09-05 Thread Jason
On Sep 5, 6:56 pm, Peter Otten <__pete...@web.de> wrote: > Does it have to be gio.FileMonitor? pyinotify can automatically add new > subdirectories out of the box. Well, since it's for a core part of the software, I'd like it to be cross platform — not in the sense of Windows/Mac, but FreeBSD, Sol

Re: Subclassing by monkey-patching

2010-09-05 Thread Peter Otten
Jason wrote: > On Sep 5, 3:53 pm, Peter Otten <__pete...@web.de> wrote: >> >>> m = gio.File(".").monitor_directory() >> >>> C = type(m) > > 'C' will not necessarily be 'gio.FileMonitor' — I think the internals > of the GIO methods might further "subclass" it in some way depending > on what underl

Re: Subclassing by monkey-patching

2010-09-05 Thread Jason
On Sep 5, 3:53 pm, Peter Otten <__pete...@web.de> wrote: > >>> m = gio.File(".").monitor_directory() > >>> C = type(m) 'C' will not necessarily be 'gio.FileMonitor' — I think the internals of the GIO methods might further "subclass" it in some way depending on what underlying monitors are availabl

Re: Subclassing by monkey-patching

2010-09-05 Thread Peter Otten
Arnaud Delobelle wrote: > Jason writes: > [...] >> Is there a way I can write the subclass but then somehow... extend an >> existing instance all at once rather than monkeypatch methods on one >> by one? So I could take an existing instance of a FileMonitor and make >> it an instance of my subcla

Re: Subclassing by monkey-patching

2010-09-05 Thread Arnaud Delobelle
Jason writes: [...] > Is there a way I can write the subclass but then somehow... extend an > existing instance all at once rather than monkeypatch methods on one > by one? So I could take an existing instance of a FileMonitor and make > it an instance of my subclass? This would even allow me to o

Subclassing by monkey-patching

2010-09-04 Thread Jason
I'm attempting to implement a recursive directory monitor based on the GIO file monitor in PyGTK. My approach is basically to take the gio.FileMonitor returned by the method gio.File.monitor_directory(), connect to the "changed" signal, and add or remove monitors on create/ delete events for subdir