#coding=utf-8
from PyQt4.QtCore import QEventLoop, QTimer, QObject, SIGNAL, SLOT
from PyQt4.QtGui import QApplication

def moveWidgetToScreenCenter(widget):
    desktopWidget = QApplication.desktop()
    clientRect = desktopWidget.availableGeometry()
    width = clientRect.width()
    height = clientRect.height()
    widget.move((width - widget.width())/2,  (height - widget.height())/2)

def eventloop_timer(time):
    eventloop = QEventLoop()
    timer = QTimer()
    QObject.connect(timer,SIGNAL("timeout()"),eventloop,SLOT("quit()"))
    timer.start(time*1000)
    eventloop.exec_()
