Пример #1
0
    def start(self):
        # Unload cyclone
        self.stop()

        # Stock the current state of python import and rollback it if try to restart the AppServer
        self.rollbackImporter = RollbackImporter()
        from vt_as_cyclone import CycloneThread

        self.appThread = CycloneThread(self.parent())

        # Use this signal from the thread to indicate the thread exited
        QObject.connect(self.appThread, SIGNAL("runFinished(PyQt_PyObject)"),
                        self.stop)
        QObject.connect(self.appThread, SIGNAL("runStatus(PyQt_PyObject)"),
                        self.stop)
        QObject.connect(self.appThread, SIGNAL("runError(PyQt_PyObject)"),
                        self.stop)

        self.appThread.start()

        self.timer = QTimer()
        QObject.connect(self.timer, SIGNAL("timeout()"), self.yield_thread)
        self.timer.start(10)
Пример #2
0
    def start(self):
        # Unload cyclone
        self.stop()

        # Stock the current state of python import and rollback it if try to restart the AppServer
        self.rollbackImporter = RollbackImporter()
        from vt_as_cyclone import CycloneThread

        self.appThread = CycloneThread(self.parent())

        # Use this signal from the thread to indicate the thread exited
        QObject.connect(self.appThread, SIGNAL("runFinished(PyQt_PyObject)"),
                        self.stop)
        QObject.connect(self.appThread, SIGNAL("runStatus(PyQt_PyObject)"),
                        self.stop)
        QObject.connect(self.appThread, SIGNAL("runError(PyQt_PyObject)"),
                        self.stop)

        self.appThread.start()

        self.timer = QTimer()
        QObject.connect(self.timer, SIGNAL("timeout()"),
                        self.yield_thread)
        self.timer.start(10)
Пример #3
0
class AppServer(QObject):

    ## Constructor.
    #  @param parent  the QObject parent
    def __init__(self, parent):
        QObject.__init__(self, parent)
        self.rollbackImporter = None
        self.appThread = None
        self.timer = None
        self.saveStdout = sys.stdout
        self.saveStderr = sys.stderr

    ## start method
    #  Launch the application server
    #  @override QObject
    def start(self):
        # Unload cyclone
        self.stop()

        # Stock the current state of python import and rollback it if try to restart the AppServer
        self.rollbackImporter = RollbackImporter()
        from vt_as_cyclone import CycloneThread

        self.appThread = CycloneThread(self.parent())

        # Use this signal from the thread to indicate the thread exited
        QObject.connect(self.appThread, SIGNAL("runFinished(PyQt_PyObject)"),
                        self.stop)
        QObject.connect(self.appThread, SIGNAL("runStatus(PyQt_PyObject)"),
                        self.stop)
        QObject.connect(self.appThread, SIGNAL("runError(PyQt_PyObject)"),
                        self.stop)

        self.appThread.start()

        self.timer = QTimer()
        QObject.connect(self.timer, SIGNAL("timeout()"), self.yield_thread)
        self.timer.start(10)

    ## stop method
    #  Stop the application server and clean the import modules
    #  @override QObject
    def stop(self):
        if self.appThread:
            while (self.appThread.isRunning()):
                self.appThread.stop()
                self.thread().msleep(10)
                QCoreApplication.instance().processEvents()
            del self.appThread
            self.appThread = None
        if self.rollbackImporter:
            self.rollbackImporter.uninstall()
        if self.timer:
            self.timer.stop()
        sys.stdout = self.saveStdout
        sys.stderr = self.saveStderr

    ## yield_thread method
    #  Yied application server thread to not hang the GUI
    #  @override QObject
    def yield_thread(self):
        if self.appThread:
            self.appThread.msleep(1)
Пример #4
0
class AppServer(QObject):

    ## Constructor.
    #  @param parent  the QObject parent
    def __init__(self, parent):
        QObject.__init__(self, parent)
        self.rollbackImporter = None
        self.appThread = None
        self.timer = None
        self.saveStdout = sys.stdout
        self.saveStderr = sys.stderr

    ## start method
    #  Launch the application server
    #  @override QObject
    def start(self):
        # Unload cyclone
        self.stop()

        # Stock the current state of python import and rollback it if try to restart the AppServer
        self.rollbackImporter = RollbackImporter()
        from vt_as_cyclone import CycloneThread

        self.appThread = CycloneThread(self.parent())

        # Use this signal from the thread to indicate the thread exited
        QObject.connect(self.appThread, SIGNAL("runFinished(PyQt_PyObject)"),
                        self.stop)
        QObject.connect(self.appThread, SIGNAL("runStatus(PyQt_PyObject)"),
                        self.stop)
        QObject.connect(self.appThread, SIGNAL("runError(PyQt_PyObject)"),
                        self.stop)

        self.appThread.start()

        self.timer = QTimer()
        QObject.connect(self.timer, SIGNAL("timeout()"),
                        self.yield_thread)
        self.timer.start(10)

    ## stop method
    #  Stop the application server and clean the import modules
    #  @override QObject
    def stop(self):
        if self.appThread:
            while (self.appThread.isRunning()):
                self.appThread.stop()
                self.thread().msleep(10)
                QCoreApplication.instance().processEvents()
            del self.appThread
            self.appThread = None
        if self.rollbackImporter:
            self.rollbackImporter.uninstall()
        if self.timer:
            self.timer.stop()
        sys.stdout = self.saveStdout
        sys.stderr = self.saveStderr

    ## yield_thread method
    #  Yied application server thread to not hang the GUI
    #  @override QObject
    def yield_thread(self):
        if self.appThread:
            self.appThread.msleep(1)