def information(self, info):
     '''
     Invoked when received information from service
     '''
     logger.debug('Got information message: {}'.format(info))
     if 'idle' in info:
         idle = int(info['idle'])
         operations.initIdleDuration(idle)
         self.maxIdleTime = idle
         logger.debug('Set screensaver launching to {}'.format(idle))
     else:
         self.maxIdleTime = None
Exemple #2
0
 def information(self, info):
     '''
     Invoked when received information from service
     '''
     logger.debug('Got information message: {}'.format(info))
     if 'idle' in info:
         idle = int(info['idle'])
         operations.initIdleDuration(idle)
         self.maxIdleTime = idle
         logger.debug('Set screensaver launching to {}'.format(idle))
     else:
         self.maxIdleTime = None
if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)

    if not QtGui.QSystemTrayIcon.isSystemTrayAvailable():
        # QtGui.QMessageBox.critical(None, "Systray", "I couldn't detect any system tray on this system.")
        sys.exit(1)

    # This is important so our app won't close on message windows
    QtGui.QApplication.setQuitOnLastWindowClosed(False)

    try:
        trayIcon = UDSSystemTray(app)
    except Exception:
        logger.error('UDS Service is not running, or it can\'t contact with UDS Server. User Tools stopped')
        sys.exit(1)

    # Sets a default idle duration, but will not be used unless idle is notified from server
    operations.initIdleDuration(3600 * 10)

    trayIcon.show()

    # Catch kill and logout user :)
    signal.signal(signal.SIGTERM, sigTerm)

    res = app.exec_()

    logger.debug('Exiting')
    trayIcon.quit()

    sys.exit(res)
Exemple #4
0
if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)

    if not QtGui.QSystemTrayIcon.isSystemTrayAvailable():
        # QtGui.QMessageBox.critical(None, "Systray", "I couldn't detect any system tray on this system.")
        sys.exit(1)

    # This is important so our app won't close on message windows
    QtGui.QApplication.setQuitOnLastWindowClosed(False)

    try:
        trayIcon = UDSSystemTray(app)
    except Exception:
        logger.error('UDS Service is not running. Tool stopped')
        sys.exit(1)

    # Sets a default idle duration, but will not be used unless idle is notified from server
    operations.initIdleDuration(3600 * 10)

    trayIcon.show()

    # Catch kill and logout user :)
    signal.signal(signal.SIGTERM, sigTerm)

    res = app.exec_()

    logger.debug('Exiting')
    trayIcon.quit()

    sys.exit(res)