🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.python
1 messages
1 total messages Started by grizz Fri, 05 Mar 2010 11:43
[PyQt]Windows7 i problemy z przesuwaniem okna...
#27342
Author: 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  ::
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads