Re: [Specto-devel] the main watch class
Brought to you by:
kiddokiddo
|
From: Kiddo <nek...@gm...> - 2006-02-08 18:01:23
|
So far, I agree on the main class requirements (name + refresh
interval), but I have not yet thought of something else that is shared
among all watches, maybe a URI, but not really all watches use that
(if we create watches for package management for example).
About the pseudocode: yes, that is basically what is supposed to
happen. I think the watch_raw and watch_rss modules already use this
kind of thing, but in a different way. The watch_rss module is older,
so it needs to be revised I think...
The big big problem is that modules do not communicate (afaik)
currently. That's the blocker.
> some questions about the code that is allready in watch.py:
> def __init__(self, refresh=3D float(5.0)):
> self.refresh_ =3D refresh
> self.timer =3D Timer(float(0.1), self.update)
> self.timer.start()
> what is "self.update"? is it the interval between updates for a watch? a=
nd
> why would you use refresh =3D float(5.0), isn't that something the user h=
as to
> set?
Yes, it is supposed to be a variable. HOWEVER, we set it to something
like 5 seconds, but that's ONLY for development and testing purposes.
It should be removed when watches can "talk".
> And when i wan't to create an object from the module i get this error:
> >>> import specto.watch
> >>> t =3D specto.watch()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: 'module' object is not callable
> >>>
I'm not sure, wasn't there a watch call example lying there somewhere?
hmmm... Try this, but I can absolutely not guarantee it will work,
it's just an old testwatch.py lying in my archives...
#!/usr/bin/env python
from watch_raw import rawCacheCreator
def hasChanged(text):
print text
raw =3D rawCacheCreator("http://nanokron.info", hasChanged, "",
['Nouveau Fichier 1'])
raw2 =3D rawCacheCreator("http://127.0.0.1/Screenshot.png", hasChanged,
"", ['Nouveau Fichier 2'])
raw3 =3D rawCacheCreator("http://specto.sf.net", hasChanged, "",
['Nouveau Fichier 3'])
I think this calls watch_raw.py and runs three different "watch"
instances. Of course you have to change the URIs to whatever test
files you want to use and modify and see if it works.
Now, some terminology so that I'm sure you are not confused at the way
I named things in the beginning:
watch_rss =3D a watch module for RSS/atom feeds
watch_raw =3D caches, MD5sums and compares ANYTHING. That's for static
webpages, images, whatever. Pascal coded this based on something I
don't quite remember the name at the moment.
self.update =3D is a function that CHECKS FOR UPDATES, then if there are
updates, calls self.notify
self.notify =3D is where we should send the signals to the notify module
that the watch was updated, so that the gui displays the relevant
information. However, currently (can't say that enough ;), the modules
don't really communicate, so this only prints that the watch was
updated, in the terminal.
I hope I could answer some of your concerns. If I'm wrong on any of
these, Pascal please correct me.
Jeff
|