source: tags/pyrokinesis-1.0.0/brainstorms-local.py @ 285

Revision 285, 3.2 KB checked in by sc, 13 months ago (diff)

trunk/brainstorms-local.py:

  • adjustment to commented-out debug code

trunk/puzzlebox_brainstorms_configuration.ini:

  • iRobot defaults added

trunk/Puzzlebox/Brainstorms/Interface_Design.py:

  • temporary interface tweak, assumed for PySide? compatibility

trunk/Puzzlebox/Brainstorms/iRobot_Control.py:

  • VARIABLE_CONTROL_DURATION support added
  • various enchancement in preparation of 0.6.0 release

trunk/Puzzlebox/Brainstorms/Interface.py:

  • typo bug fixed

trunk/Puzzlebox/Brainstorms/Server.py:

  • VARIABLE_CONTROL_DURATION support added for iRobot

trunk/Puzzlebox/Brainstorms/Configuration.py:

  • iRobot defaults added

trunk/Puzzlebox/Brainstorms/iRobot/pyrobot.py:

  • various enchancement in preparation of 0.6.0 release

trunk/Puzzlebox/Brainstorms/iRobot_Control.py

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Puzzlebox - Brainstorms - Interface - Local
5#
6# Copyright Puzzlebox Productions, LLC (2010-2011)
7#
8# This code is released under the GNU Pulic License (GPL) version 2
9# For more information please refer to http://www.gnu.org/copyleft/gpl.html
10
11__changelog__ = """\
12Last Update: 2011.04.14
13
14"""
15
16import os, sys
17import signal
18
19#if (sys.platform == 'win32'):
20        #sys.path.append('C:\Python26\Lib\PyQt4\bin')
21
22try:
23        import PySide as PyQt4
24        from PySide import QtCore, QtGui, QtNetwork
25except:
26        print "Using PyQt4 module"
27        from PyQt4 import QtCore, QtGui, QtNetwork
28else:
29        print "Using PySide module"
30
31
32import Puzzlebox.Brainstorms.Configuration as configuration
33import Puzzlebox.Brainstorms.Interface as client_interface
34import Puzzlebox.Brainstorms.Client as brainstorms_client
35import Puzzlebox.Brainstorms.Server as server
36#import Puzzlebox.Brainstorms.NXT_Control as nxt_control
37#import puzzlebox_logger
38
39#####################################################################
40# Globals
41#####################################################################
42
43DEBUG = 1
44
45SERVER_INTERFACE = configuration.BRAINSTORMS_SERVER_INTERFACE
46SERVER_HOST = configuration.BRAINSTORMS_SERVER_HOST
47SERVER_PORT = configuration.BRAINSTORMS_SERVER_PORT
48
49CLIENT_NO_REPLY_WAIT = configuration.CLIENT_NO_REPLY_WAIT * 1000
50
51DELIMITER = configuration.BRAINSTORMS_DELIMITER
52
53BLUETOOTH_DEVICE = configuration.NXT_BLUETOOTH_DEVICE
54
55VARIABLE_CONTROL_DURATION = configuration.BRAINSTORMS_VARIABLE_CONTROL_DURATION
56
57#####################################################################
58# Classes
59#####################################################################
60
61#####################################################################
62# Functions
63#####################################################################
64
65#####################################################################
66# Main
67#####################################################################
68
69if __name__ == '__main__':
70       
71        # Perform correct KeyboardInterrupt handling
72        signal.signal(signal.SIGINT, signal.SIG_DFL)
73       
74        #log = puzzlebox_logger.puzzlebox_logger(logfile='client_interface')
75        log = None
76       
77        # Collect default settings and command line parameters
78        server_interface = SERVER_INTERFACE
79        server_host = SERVER_HOST
80        server_port = SERVER_PORT
81       
82        for each in sys.argv:
83               
84                if each.startswith("--interface="):
85                        server_interface = each[ len("--interface="): ]
86                if each.startswith("--host="):
87                        server_host = each[ len("--host="): ]
88                if each.startswith("--port="):
89                        server_port = each[ len("--port="): ]
90       
91        app = QtGui.QApplication(sys.argv)
92       
93        server = server.puzzlebox_brainstorms_network_server(log, \
94                    server_interface, \
95                    server_port, \
96                    embedded_mode=True, \
97                    robot_type=None, \
98                    DEBUG=DEBUG)
99       
100       
101        window = client_interface.puzzlebox_brainstorms_client_interface(log, \
102                                                                         server=server, \
103                                                                         DEBUG=DEBUG)
104       
105        if configuration.AUTOCONNECT_TO_NXT_DEVICE is True:
106                window.connectToBrainstormsServer()
107       
108        window.show()
109       
110        sys.exit(app.exec_())
111
Note: See TracBrowser for help on using the repository browser.