source: trunk/synapse-server.py

Last change on this file was 396, checked in by sc, 9 years ago

server:

  • clean up from console launching
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright Puzzlebox Productions, LLC (2010-2012)
5#
6# This code is released under the GNU Pulic License (GPL) version 2
7# For more information please refer to http://www.gnu.org/copyleft/gpl.html
8
9import Puzzlebox.Synapse.ThinkGear.Server as thinkgear_server
10import Puzzlebox.Synapse.Configuration as configuration
11
12import sys, signal
13
14try:
15        import PySide as PyQt4
16        from PySide import QtCore
17except:
18        print "Using PyQt4 module"
19        from PyQt4 import QtCore
20else:
21        print "Using PySide module"
22
23DEBUG = 1
24
25# Perform correct KeyboardInterrupt handling
26signal.signal(signal.SIGINT, signal.SIG_DFL)
27log = None
28
29server_interface = configuration.THINKGEAR_SERVER_INTERFACE
30server_port = configuration.THINKGEAR_SERVER_PORT
31device_address = configuration.THINKGEAR_DEVICE_SERIAL_PORT
32#device_id = configuration.THINKGEAR_DEVICE_ID
33
34for each in sys.argv:
35        if each.startswith("--interface="):
36                server_interface = each[ len("--interface="): ]
37        if each.startswith("--port="):
38                server_port = each[ len("--port="): ]
39        if each.startswith("--device="):
40                device_address = each[ len("--device="): ]
41        if each.startswith("--debug="):
42                DEBUG = int (each[ len("--debug="): ] )
43        if each.startswith("--id="):
44                device_id = int (each[ len("--id="): ] )
45
46app = QtCore.QCoreApplication(sys.argv)
47server = thinkgear_server.puzzlebox_synapse_server_thinkgear( \
48            log, \
49            server_interface=server_interface, \
50            server_port=server_port, \
51            #device_id, \
52            device_address=device_address, \
53            emulate_headset_data = configuration.THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA, \
54            DEBUG=DEBUG)
55
56server.start()
57sys.exit(app.exec_())
Note: See TracBrowser for help on using the repository browser.