source: trunk/synapse-server.py @ 353

Last change on this file since 353 was 276, checked in by sc, 10 years ago

Puzzlebox Synapse:

  • split out into separate repository from Puzzlebox Brainstorms
  • Property svn:executable set to *
File size: 1.4 KB
Line 
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
9import Puzzlebox.Synapse.Server as tgServer
10import Puzzlebox.Synapse.Configuration as tgConf
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 = tgConf.THINKGEAR_SERVER_INTERFACE
30server_port = tgConf.THINKGEAR_SERVER_PORT
31device_address = tgConf.THINKGEAR_DEVICE_SERIAL_PORT
32device_id = tgConf.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 = tgServer.ThinkgearServer(log, server_interface, server_port, device_address, device_id, emulate_headset_data = tgConf.THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA, DEBUG=DEBUG)
48server.start()
49sys.exit(app.exec_())
Note: See TracBrowser for help on using the repository browser.