Exemplo n.º 1
0
class NewstickrWindow(QtGui.QWidget):
	def __init__(self, width, height, parent=None):
		QtGui.QWidget.__init__(self, parent)
		self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.X11BypassWindowManagerHint)
		self.setGeometry(0, height-30, width, 30)
		self.setWindowTitle('Newstickr')
		self.newsLabels = []
		self.ticks = 0
		self.message = NewsTickrMessage(self)
		self.updateThread = UpdateThread(self.message)
		QtCore.QObject.connect(self.updateThread, QtCore.SIGNAL('rotated()'), self, QtCore.SLOT('update()'))
		QtCore.QObject.connect(self, QtCore.SIGNAL('rotating(bool)'), self.updateThread, QtCore.SLOT('setRotating(bool)'))
		self.updateThread.start()
		self.dataSourceThread = DataSourceThread(self.message)
		self.dataSourceThread.start()
	

	def resizeEvent(self, event):
		geo = self.geometry()
		self.message.setGeometry(0, 0, geo.width(), geo.height())


	def closeEvent(self, event):
		self.updateThread.finish()
		self.dataSourceThread.finish()
		time.sleep(0.2)
		event.accept()

	def enterEvent(self, event):
		self.emit(QtCore.SIGNAL('rotating(bool)'), False)

	def leaveEvent(self, event):
		self.emit(QtCore.SIGNAL('rotating(bool)'), True)


	@QtCore.pyqtSignature('update()')
	def update(self):
		self.message.show()
		self.ticks += 1
		newX = Config.width - self.ticks * Config.accel
		self.message.setGeometry(newX, 0, self.message.sizeInPixels, self.message.height())
		if newX < -self.message.sizeInPixels:
			self.ticks = 0
Exemplo n.º 2
0
	def __init__(self, width, height, parent=None):
		QtGui.QWidget.__init__(self, parent)
		self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.X11BypassWindowManagerHint)
		self.setGeometry(0, height-30, width, 30)
		self.setWindowTitle('Newstickr')
		self.newsLabels = []
		self.ticks = 0
		self.message = NewsTickrMessage(self)
		self.updateThread = UpdateThread(self.message)
		QtCore.QObject.connect(self.updateThread, QtCore.SIGNAL('rotated()'), self, QtCore.SLOT('update()'))
		QtCore.QObject.connect(self, QtCore.SIGNAL('rotating(bool)'), self.updateThread, QtCore.SLOT('setRotating(bool)'))
		self.updateThread.start()
		self.dataSourceThread = DataSourceThread(self.message)
		self.dataSourceThread.start()