summaryrefslogtreecommitdiff
path: root/src/leap/gui/threads.py
blob: 8aad886680171f3475cd6ee71135d31c22024042 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from PyQt4 import QtCore


class FunThread(QtCore.QThread):

    def __init__(self, fun=None, parent=None):

        QtCore.QThread.__init__(self, parent)
        self.exiting = False
        self.fun = fun

    def __del__(self):
        self.exiting = True
        self.wait()

    def run(self):
        if self.fun:
            self.fun()

    def begin(self):
        self.start()