Ejemplo n.º 1
0
def main(game=Games.DIRT_RALLY,
         udp_host=UDP_IP,
         udp_port=UDP_PORT,
         callback=None):
    Debug.set_log_level(LogLevel(2))
    Debug.toggle(True)
    try:
        scan = Scan(game, udp_host, udp_port, callback)
        scan.start()
        return scan
    except Exception as e:
        Debug.err(e)
Ejemplo n.º 2
0
 def __init__(self,
              game=Games.DIRT_RALLY,
              udp_host=UDP_IP,
              udp_port=UDP_PORT,
              callback=None):
     Thread.__init__(self)
     Debug.set_log_level(LogLevel(2))
     Debug.toggle(True)
     self.finished = False
     self.callback = callback
     self.game = game
     self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     self.sock.settimeout(1)
     self.sock.bind((udp_host, udp_port))
     signal.signal(signal.SIGINT, self.exit_gracefully)
     signal.signal(signal.SIGTERM, self.exit_gracefully)
     signal.signal(signal.SIGABRT, self.exit_gracefully)
Ejemplo n.º 3
0
    default=LogLevel.warn,
    help='Set debug verbosity from 0 (only errors) to 2 (full output)',
    choices=range(0, 3))
flags = argument_parser.parse_args()
if flags.debug:
    DEBUG = True
if flags.log_level is not None:
    Debug.set_log_level(LogLevel(flags.log_level))
if flags.gui is not None:
    if flags.gui is False:
        Debug.notice('No gui')
        DEBUG = True
        Debug.set_log_level(LogLevel(2))
    GUI = flags.gui

Debug.toggle(DEBUG)


# noinspection PyUnusedLocal
def exit_gracefully(signum, frame):
    Debug.warn('Process killed (%s). Exiting gracefully' % signum)
    app.stop()
    sys.exit(0)


class MainApp(MainWindow.Listener):
    style_low = "QProgressBar::chunk {background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #00FF00, " \
                "stop: 1 #FFFF00); border: .px solid #FF3410;}"
    style_safe = "QProgressBar::chunk {background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #00FF00, " \
                 "stop: 0.625 #FFFF00, stop: 0.9 #FF3410, stop: 1 #0000FF); border: .px solid #FF3410;}"
    style_danger = "QProgressBar::chunk {background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #00FF00, " \