Example #1
0
def initCfg():
    global cfg  # pylint: disable=global-statement
    cfg = store.readConfig()

    if logger.logger.isWindows():
        # Logs will also go to windows event log for services
        logger.logger.serviceLogger = True

    if cfg is not None:
        logger.setLevel(cfg.get('logLevel', 20000))
    else:
        logger.setLevel(20000)
        cfg = {}

    # If ANY var is missing, reset cfg
    for v in ('host', 'ssl', 'masterKey'):
        if v not in cfg:
            cfg = None
            break
Example #2
0
def initCfg():
    global cfg  # pylint: disable=global-statement
    cfg = store.readConfig()

    if logger.logger.isWindows():
        # Logs will also go to windows event log for services
        logger.logger.serviceLogger = True

    if cfg is not None:
        logger.setLevel(cfg.get('logLevel', 20000))
    else:
        logger.setLevel(20000)
        cfg = {}

    # If ANY var is missing, reset cfg
    for v in ('host', 'ssl', 'masterKey'):
        if v not in cfg:
            cfg = None
            break
Example #3
0
        cfg = self._getCfg()
        store.writeConfig(cfg)
        self.close()


if __name__ == "__main__":

    # If to be run as "sudo" on linux, we will need this to avoid problems
    if 'linux' in sys.platform:
        os.environ['QT_X11_NO_MITSHM'] = '1'

    app = QtGui.QApplication(sys.argv)

    if store.checkPermissions() is False:
        QtGui.QMessageBox.critical(
            None, 'Notice', 'This Program must be executed as administrator',
            QtGui.QMessageBox.Ok)
        sys.exit(1)

    # Read configuration
    cfg = store.readConfig()

    if cfg is not None:
        logger.setLevel(int(cfg.get('logLevel', 20000)))
    else:
        logger.setLevel(20000)

    myapp = UDSConfigDialog(cfg)
    myapp.show()
    sys.exit(app.exec_())
Example #4
0
                self.checkIpsChanged()
            # In milliseconds, will break
            self.doWait(1000)

        self.endIPC()
        self.endAPI()

        self.notifyStop()


def usage():
    sys.stderr.write("usage: {} start|stop|restart|login 'username'|logout 'username'\n".format(sys.argv[0]))
    sys.exit(2)

if __name__ == '__main__':
    logger.setLevel(20000)

    if len(sys.argv) == 3 and sys.argv[1] in ('login', 'logout'):
        logger.debug('Running client udsactor')
        client = None
        try:
            client = ipc.ClientIPC(IPC_PORT)
            if 'login' == sys.argv[1]:
                client.sendLogin(sys.argv[2])
                sys.exit(0)
            elif 'logout' == sys.argv[1]:
                client.sendLogout(sys.argv[2])
                sys.exit(0)
            else:
                usage()
        except Exception as e:
Example #5
0
'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
# pylint: disable=invalid-name
import sys
import os

import PyQt5  # pylint: disable=unused-import
from PyQt5.QtCore import QTimer

from udsactor.log import logger, INFO
from udsactor.client import UDSClientQApp
from udsactor.platform import operations

if __name__ == "__main__":
    logger.setLevel(INFO)

    # Ensure idle operations is initialized on start
    operations.initIdleDuration(0)

    if 'linux' in sys.platform:
        os.environ['QT_X11_NO_MITSHM'] = '1'

    UDSClientQApp.setQuitOnLastWindowClosed(False)

    qApp = UDSClientQApp(sys.argv)

    qApp.init()

    # Crate a timer, so we can check signals from time to time by executing python interpreter
    # Note: Signals are only checked on python code execution, so we create a timer to force call back to python
Example #6
0
'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
# pylint: disable=invalid-name
import sys
import os

import PyQt5  # pylint: disable=unused-import
from PyQt5.QtCore import QTimer

from udsactor.log import logger, DEBUG
from udsactor.client import UDSClientQApp
from udsactor.platform import operations

if __name__ == "__main__":
    logger.setLevel(DEBUG)

    # Ensure idle operations is initialized on start
    operations.initIdleDuration(0)

    if 'linux' in sys.platform:
        os.environ['QT_X11_NO_MITSHM'] = '1'

    logger.info('Started UDS Client Actor')

    UDSClientQApp.setQuitOnLastWindowClosed(False)

    qApp = UDSClientQApp(sys.argv)

    qApp.init()
Example #7
0
    def acceptAndSave(self):
        cfg = self._getCfg()
        store.writeConfig(cfg)
        self.close()


if __name__ == "__main__":

    # If to be run as "sudo" on linux, we will need this to avoid problems
    if 'linux' in sys.platform:
        os.environ['QT_X11_NO_MITSHM'] = '1'

    app = QtGui.QApplication(sys.argv)

    if store.checkPermissions() is False:
        QtGui.QMessageBox.critical(None, 'Notice', 'This Program must be executed as administrator', QtGui.QMessageBox.Ok)
        sys.exit(1)

    # Read configuration
    cfg = store.readConfig()

    if cfg is not None:
        logger.setLevel(int(cfg.get('logLevel', 20000)))
    else:
        logger.setLevel(20000)

    myapp = UDSConfigDialog(cfg)
    myapp.show()
    sys.exit(app.exec_())