Re: Using invalidate_extension_info in python extensions
- From: Jason Field <jason jasonfield com>
- To: Alexander Larsson <alexl redhat com>
- Cc: nautilus-list gnome org
- Subject: Re: Using invalidate_extension_info in python extensions
- Date: Tue, 12 Dec 2006 21:51:48 +0000
Thanks for the reply Alex. I've done a bit more investigation - see
points below...
Alexander Larsson wrote:
On Sat, 2006-11-18 at 00:07 +0000, Jason Field wrote:
How is an extension writer supposed to ask Nautilus to re-scan a folder
for extension information? From what little I've gleaned from the
Nautilus wiki, I'm supposed to use the invalidate_extension_info call.
Only problem is, it doesn't seem to do much in my code!
Is there some documentation on how it (and the other FileInfo methods)
are supposed to work?
Hmm. That is supposed to work. If any user of the NautilusFile in
nautilus has expressed an interest in the extension info for the file
then if you invalidate it it should be re-read by nautilus.
I take it there isn't any documentation other than the code then :). It
looks at the moment like my threading code isn't getting executed
properly, which is why I'm not seeing property updates. Are there
supposed to be restrictions on thread activity instead nautilus python
extension objects? If I do the following;
import threading
import time
import nautilus
class Test:
def __init__(self):
t = threading.Thread(target=self.ThreadProc)
t.start()
def ThreadProc(self):
while True:
print time.clock()
time.sleep(0.5)
t = Test()
class MyExtension(nautilus.InfoProvider, nautilus.MenuProvider,
nautilus.ColumnProvider):
... rest of extension here
I would expect that the time would get printed every half a second. What
seems to happen is that I get a couple of prints at the start, and then
a print every time I refresh the view in the Nautilus window. Is the
nautilus extension keeping hold of the Python interpreter lock, or in
some other way stopping Python executing other threads?
I tried working around this limitation by running a server in a separate
instance of Python, and piping serialised file objects over a socket,
but the NautilusFileInfo objects don't serialise correctly with pickle
(it was a long shot :) ).
My purpose is to get Nautilus to re-scan the file info every 30 seconds
or so. I'm writing the extension in Python, and the rest of the code
(emblems, menu items etc.) all works fine. I'm running Gnome 2.14.3
(Ubuntu distro).
Strange. Just calling the invalidate_extension_info in a timeout should
work. Might be a bug of some sort.
Yep sorry my bad - I've got a feeling that the invalidate_extension_info
will work fine once I sort the threading out.
Oh and a second quick question - is it possible to nest extension-added
menu items?
In recent version (2.16 i think) there is support for this.
Kick ass :)
Cheers,
Jason
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]