Esempio n. 1
0
 def testParameters(self):
     logger.debug('Testing connection')
     try:
         cfg = self._getCfg()
         api = REST.Api(
             cfg['host'], cfg['masterKey'], cfg['ssl'])
         api.test()
         QtGui.QMessageBox.information(
             self, 'Test Passed', 'The test was executed successfully', QtGui.QMessageBox.Ok)
         logger.info('Test was passed successfully')
     except Exception as e:
         logger.info('Test error: {}'.format(utils.exceptionToMessage(e)))
         QtGui.QMessageBox.critical(self, 'Test Error', utils.exceptionToMessage(e), QtGui.QMessageBox.Ok)
Esempio n. 2
0
 def testParameters(self):
     logger.debug('Testing connection')
     try:
         cfg = self._getCfg()
         api = REST.Api(cfg['host'], cfg['masterKey'], cfg['ssl'])
         api.test()
         QtGui.QMessageBox.information(
             self, 'Test Passed', 'The test was executed successfully',
             QtGui.QMessageBox.Ok)
         logger.info('Test was passed successfully')
     except Exception as e:
         logger.info('Test error: {}'.format(utils.exceptionToMessage(e)))
         QtGui.QMessageBox.critical(self, 'Test Error',
                                    utils.exceptionToMessage(e),
                                    QtGui.QMessageBox.Ok)
Esempio n. 3
0
    def run(self):
        if self.ipc is None:
            return
        self.running = True

        # Wait a bit so we ensure IPC thread is running...
        time.sleep(2)

        while self.running and self.ipc.running:
            try:
                msg = self.ipc.getMessage()
                if msg is None:
                    break
                msgId, data = msg
                logger.debug('Got Message on User Space: {}:{}'.format(msgId, data))
                if msgId == ipc.MSG_MESSAGE:
                    self.displayMessage.emit(QtCore.QString.fromUtf8(data))
                elif msgId == ipc.MSG_LOGOFF:
                    self.logoff.emit()
                elif msgId == ipc.MSG_SCRIPT:
                    self.script.emit(QtCore.QString.fromUtf8(data))
                elif msgId == ipc.MSG_INFORMATION:
                    self.information.emit(pickle.loads(data))
            except Exception as e:
                try:
                    logger.error('Got error on IPC thread {}'.format(utils.exceptionToMessage(e)))
                except:
                    logger.error('Got error on IPC thread (an unicode error??)')

        if self.ipc.running is False and self.running is True:
            logger.warn('Lost connection with Service, closing program')

        self.exit.emit()
Esempio n. 4
0
    def run(self):
        if self.ipc is None:
            return
        self.running = True

        # Wait a bit so we ensure IPC thread is running...
        time.sleep(2)

        while self.running and self.ipc.running:
            try:
                msg = self.ipc.getMessage()
                if msg is None:
                    break
                msgId, data = msg
                logger.debug('Got Message on User Space: {}:{}'.format(
                    msgId, data))
                if msgId == ipc.MSG_MESSAGE:
                    self.displayMessage.emit(QtCore.QString.fromUtf8(data))
                elif msgId == ipc.MSG_LOGOFF:
                    self.logoff.emit()
                elif msgId == ipc.MSG_SCRIPT:
                    self.script.emit(QtCore.QString.fromUtf8(data))
                elif msgId == ipc.MSG_INFORMATION:
                    self.information.emit(pickle.loads(data))
            except Exception as e:
                try:
                    logger.error('Got error on IPC thread {}'.format(
                        utils.exceptionToMessage(e)))
                except:
                    logger.error(
                        'Got error on IPC thread (an unicode error??)')

        if self.ipc.running is False and self.running is True:
            logger.warn('Lost connection with Service, closing program')

        self.exit.emit()