[PyKDE] Network Transparency Help

Jim Bublitz jbublitz at nwinternet.com
Tue May 16 07:19:59 BST 2006


On Monday 15 May 2006 18:01, Paul Waldo wrote:
> Hi all,
>
> I'm trying to write a PyKDE application that, among other things, does bulk
> file copying.  I'm trying to write this with Network Transparency in mind.
> Rather than just being able to copy files from /my/directory/*
> to /your/directory/ (recursively), I want the user to be able to specify
> something like copying from ftp://my.machine.com/my/directory to
> ftp://your.machine.com/your/directory.
>
> There does not seem to be a whole lot of help I have been able to find. 
> I've googled on just about every phrase having to do with the concepts. 
> There seem to be a fair amount of documentation on single operation tasks,
> such as using KIO::mkdir, but not a lot of info on what I need to use:
> KIO::listRecursive.
>
> I was hoping someone could point me to some info and/or sample code that
> uses KIO::listRecursive.  That is my first choice but, in lieu of that,
> maybe someone can spot what I am doing wrong here:
>
> from qt import *
> from kdecore import *
> from kdeui import *
> from kio import *
>
> class FileLocator:
>     def __init__(self, parent, url):
>         self._parent = parent
>         self._url = url
>
>     def locateFiles(self):
>         startUrl = KURL(self._url)
>         job = KIO.listRecursive(startUrl)
>         QObject.connect(job, SIGNAL("entries(KIO::Job *,
> 		const KIO::UDSEntryList &)"), self.newItems)
>
>     def newItems(job, list):
>         print job
>         print list
>
>
> When I create an instance of FileLocator and call its locateFiles method, I
> get a progress dialog that hangs around for a while, but newItems() never
> gets called.  I was expecting that once listRecursive() found all the
> files, newItems() would be called with all of the found items in list.
>
> Any help or links to examples would be greatly appreciated!

Have you tried using self.job in locateFiles()?

Jim




More information about the PyQt mailing list