🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.python
Article #27342

[PyQt]Windows7 i problemy z przesuwaniem okna...

#27342
From: grizz
Date: Fri, 05 Mar 2010 11:43
93 lines
3820 bytes
Mam aplikację... http://github.com/grizz-pl/mirlight/downloads

i po wciśnięciu przycisku start następują problemy z przesuwaniem okna, co 
ciekawe tylko pod w7. Pod xp i pod Linuxem śmiga... 

Jeszcze fajniejsze, jest to, że problemy są większe wraz ze wzrostem 
interwału timera. Tak jakby program czekał na "przerwę"  pomiędzy operacjami 
timera...

przycisk start wywołuje:

Kod

 	def startStop(self):
		"""
		start/stop Timer and change text on Button
		"""
		if not self._Timer.isActive(): 			
				# if timer doesn't work
			self.ui.pushButton.setText("Stop!")
			#fadeValue = config.getint('Hardware', 'fade')
			#self.sendConfiguration(fadeValue)
			self._Timer.start(config.getint('Timer', 
'interval'))
 
		else:
			self._Timer.stop()
			self.ui.pushButton.setText("Start!")
			self.sendColors(self.blackout)
 
	def getColor(self, px, py, w, h ):
		"""
		Grab specific field and resize it to receive average 
color of field
 
		@return a color value
		"""
		self.originalPixmap = 
QtGui.QPixmap.grabWindow(QtGui.QApplication.desktop().winId(), px, py, w, h)
		self.destPixmap = self.originalPixmap.scaled(1, 1, 
QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)
		self.destImage = self.destPixmap.toImage()
		value = self.destImage.pixel(0,0)
		return value
 
	def timer(self):
		"""
		getColor for every field and display it on appropriate 
label
		"""
		colors = []
		for field, x, y, w, h in [(1, fieldsconfig.getint('1', 
'x'), fieldsconfig.getint('1', 'y'), fieldsconfig.getint('1', 'w'), 
fieldsconfig.getint('1', 'h')),
								
	(2, fieldsconfig.getint('2', 'x'), fieldsconfig.getint('2', 'y'), 
fieldsconfig.getint('2', 'w'), fieldsconfig.getint('2', 'h')),
								
	(3, fieldsconfig.getint('3', 'x'), fieldsconfig.getint('3', 'y'), 
fieldsconfig.getint('3', 'w'), fieldsconfig.getint('3', 'h')),
								
	(4, fieldsconfig.getint('4', 'x'), fieldsconfig.getint('4', 'y'), 
fieldsconfig.getint('4', 'w'), fieldsconfig.getint('4', 'h')),
								
	(5, fieldsconfig.getint('5', 'x'), fieldsconfig.getint('5', 'y'), 
fieldsconfig.getint('5', 'w'), fieldsconfig.getint('5', 'h')),
								
	(6, fieldsconfig.getint('6', 'x'), fieldsconfig.getint('6', 'y'), 
fieldsconfig.getint('6', 'w'), fieldsconfig.getint('6', 'h')),
								
	(7, fieldsconfig.getint('7', 'x'), fieldsconfig.getint('7', 'y'), 
fieldsconfig.getint('7', 'w'), fieldsconfig.getint('7', 'h')),
								
	(8, fieldsconfig.getint('8', 'x'), fieldsconfig.getint('8', 'y'), 
fieldsconfig.getint('8', 'w'), fieldsconfig.getint('8', 'h'))]:
			color = self.getColor(x, y, w, h)
			colors.append(color)
			self.updateLabel(field, x, y, w, h, color)
		self.sendColors(colors)
 


Reszta kodu tutaj http://github.com/grizz-
pl/mirlight/blob/master/src/mirlight_gui.py

Jakieś pomysły, która operacja może powodować takie zachowanie okna?


-- 
::  Witek Firlej  ::
Voiceless it cries, Wingless flutters, Toothless bites, Mouthless mutters.
::  http://grizz.pl  ::  http://galeria.firlej.org  ::  jid: 
grizz//jabster.pl  ::
Technical Details
Message-ID: <hmqqor$ml1$1@news.onet.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail
From: grizz <grizz@poczta.onet.pl>
Newsgroups: pl.comp.lang.python
Subject: [PyQt]Windows7 i problemy z przesuwaniem okna...
Followup-To: pl.comp.lang.python
Date: Fri, 05 Mar 2010 12:43:23 +0100
Organization: http://onet.pl
Lines: 94
Message-ID: <hmqqor$ml1$1@news.onet.pl>
NNTP-Posting-Host: 77.236.8.37
Mime-Version: 1.0
X-Trace: news.onet.pl 1267789403 23201 77.236.8.37 (5 Mar 2010 11:43:23 GMT)
X-Complaints-To: niusy@onet.pl
NNTP-Posting-Date: Fri, 5 Mar 2010 11:43:23 +0000 (UTC)
User-Agent: KNode/4.4.1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit