Beispiel #1
0
class QInterpy(QtCore.QThread):

    finished = QtCore.pyqtSignal()

    mutex = QtCore.QMutex()

    def __init__(self, locals={}, *args, **kwargs):
        super(QInterpy, self).__init__(*args, **kwargs)
        self.interpy = Interpy(locals)
        self.locals = self.interpy.locals

    def run(self):
        QInterpy.mutex.lock()
        sys.stdout = WriteStream(queue)
        self.interpy.runsource(self.source, self.filename, symbol="exec")
        self.locals = dict(self.interpy.locals)
        sys.stdout = sys.__stdout__
        QInterpy.mutex.unlock()
        self.finished.emit()

    def runsource(self, source, filename="<source>"):
        self.source = source
        self.filename = filename

    def __del__(self):
        QInterpy.mutex.unlock()
        self.wait()
Beispiel #2
0
class QInterpy(QtCore.QThread):

    finished = QtCore.pyqtSignal()

    mutex = QtCore.QMutex()

    def __init__(self, locals={}, *args, **kwargs):
        super(QInterpy, self).__init__(*args, **kwargs)
        self.interpy = Interpy(locals)
        self.locals = self.interpy.locals

    def run(self):
        QInterpy.mutex.lock()
        sys.stdout = WriteStream(queue)
        self.interpy.runsource(self.source, self.filename, symbol='exec')
        self.locals = dict(self.interpy.locals)
        sys.stdout = sys.__stdout__
        QInterpy.mutex.unlock()
        self.finished.emit()

    def runsource(self, source, filename="<source>"):
        self.source = source
        self.filename = filename

    def __del__(self):
        QInterpy.mutex.unlock()
        self.wait()
Beispiel #3
0
 def __init__(self, locals={}, *args, **kwargs):
     super(QInterpy, self).__init__(*args, **kwargs)
     self.interpy = Interpy(locals)
     self.locals = self.interpy.locals
Beispiel #4
0
 def __init__(self, locals={}, *args, **kwargs):
     super(QInterpy, self).__init__(*args, **kwargs)
     self.interpy = Interpy(locals)
     self.locals = self.interpy.locals