1 | #!/usr/bin/env python |
---|
2 | # -*- coding: utf-8 -*- |
---|
3 | |
---|
4 | # Copyright Puzzlebox Productions, LLC (2010-2011) |
---|
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 | |
---|
9 | import Puzzlebox.Synapse.Server as tgServer |
---|
10 | import Puzzlebox.Synapse.Configuration as tgConf |
---|
11 | |
---|
12 | import sys, signal |
---|
13 | |
---|
14 | try: |
---|
15 | import PySide as PyQt4 |
---|
16 | from PySide import QtCore |
---|
17 | except: |
---|
18 | print "Using PyQt4 module" |
---|
19 | from PyQt4 import QtCore |
---|
20 | else: |
---|
21 | print "Using PySide module" |
---|
22 | |
---|
23 | DEBUG = 1 |
---|
24 | |
---|
25 | # Perform correct KeyboardInterrupt handling |
---|
26 | signal.signal(signal.SIGINT, signal.SIG_DFL) |
---|
27 | log = None |
---|
28 | |
---|
29 | server_interface = tgConf.THINKGEAR_SERVER_INTERFACE |
---|
30 | server_port = tgConf.THINKGEAR_SERVER_PORT |
---|
31 | device_address = tgConf.THINKGEAR_DEVICE_SERIAL_PORT |
---|
32 | device_id = tgConf.THINKGEAR_DEVICE_ID |
---|
33 | |
---|
34 | for 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 | |
---|
46 | app = QtCore.QCoreApplication(sys.argv) |
---|
47 | server = tgServer.ThinkgearServer(log, server_interface, server_port, device_address, device_id, emulate_headset_data = tgConf.THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA, DEBUG=DEBUG) |
---|
48 | server.start() |
---|
49 | sys.exit(app.exec_()) |
---|