[PyKDE] QIconView to display Thumbnails.

Olivier Roulet oroulet at yahoo.com
Fri Jan 10 20:25:00 GMT 2003


pyqt3.4 and python2.2.1 qt3.01 , linux
 
I am using QIconView in a small program to display
thumbnails of all pictures in a directory.
Since it takes quite  long to generate the thumbnails
I first create the IconView and then I use
 a queue in a different thread  to post events to
create the thumbnails one by one
But I have few problems to make things work right. So
I have 2 questions :

1- I guess many people have allreay made a similar
design, every file browser needs it. Can someone point
me to a place
 I could see such an implementation. I know konqueror 
for example does it ,
 but kde is a HUUDGE program ! so I do not know where
to look.  ( in addition I am not that good in C++)

2- In my current implementation I get a lot of "Xlib :
asynch reply" error message as soon as  I have 
more than few hundreds thumbnails. I know those errors
are related to threading but I do not create
 any QT objects in the thread. It is just a queue . 
The only QT object that goes in the thread is a 
QIconViewItem that is queued and posted without
modifications. Can this be the problem ?? 

Thank you
Olivier

Rmq that program seems to work perfectly under qt2.3
on windows......

In this extract the argument icon of enqueue can be a
QIconViewItem

	def
enqueue(self,target,eventtype,icon=None,dir=None,targetfile=None):
		self.mutex.lock()
		self._enqueue(target,eventtype,icon,dir,targetfile)
		self.mutex.unlock(

	def run(self):
		sleepTime=50
		while True:
			if self.finished:
				if self.stop :
					return
				self.mutex.lock()
				if len(self.queue)>0 :
					self.finished=False
					e=self.queue.pop(0)
					self.mutex.unlock()
				
QApplication.postEvent(e[0],OEvent(e[1],e[2],e[3],e[4]))
				else:
					self.mutex.unlock()
					self.msleep(sleepTime)
			else: 
				self.msleep(sleepTime)


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com




More information about the PyQt mailing list