source: remote_control/puzzlebox_brainstorms_client_interface_local.py @ 87

Last change on this file since 87 was 87, checked in by sc, 11 years ago

remote_control/puzzlebox_brainstorms_network_client_thinkgear.py:

  • adjustment to debug output for clarity

remote_control/puzzlebox_brainstorms_network_client.py:

  • warning output on timeout waiting for server connections
  • adjustment to debug output for clarity

remote_control/puzzlebox_brainstorms_remote_control.py:

  • adjustment to debug output for clarity

remote_control/puzzlebox_brainstorms_client_interface.py:

  • forward driving halted when disconnected from ThinkGear? server
  • keyboard shortcuts added to direction buttons
  • virtual button presses drawn when driving activated by direction
  • better handling of speed changes in updateSpeed
  • speed dropped to 100 if NXT power threshold exceeded

remote_control/puzzlebox_brainstorms_configuration.ini:

  • ThinkGear? Connect Server Emulator configuration added
  • default Relaxation speed boosts tweaked

remote_control/interface/qt4_form.py:

  • faulty keyboard shortcuts removed

remote_control/puzzlebox_brainstorms_configuration.py:

  • ThinkGear? Connect Server Emulator configuration
  • default Relaxation speed boosts tweaked

remote_control/puzzlebox_brainstorms_client_interface_network.py:

  • initial checkin

remote_control/puzzlebox_brainstorms_client_interface_local.py:

  • initial checking
  • not properly establishing client/server communications

remote_control/puzzlebox_brainstorms_network_server_thinkgear.py

  • adjustment to debug output for clarity
  • some configuration settings moved to configuration module

remote_control/puzzlebox_brainstorms_network_server.py:

  • adjustment to debug output for clarity
  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Puzzlebox - Brainstorms - Client Interface - Qt - Local
5#
6# Copyright Puzzlebox Productions, LLC (2010)
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# Last Update: 2010.06.28
12#
13#####################################################################
14
15import os, sys
16import signal
17
18#try:
19        #from PySide import QtCore, QtGui, QtNetwork
20#except:
21        #print "Using PyQt4 module"
22        #from PyQt4 import QtCore, QtGui, QtNetwork
23#else:
24        #print "Using PySide module"
25
26from PyQt4 import QtCore, QtGui, QtNetwork
27#from PySide import QtCore, QtGui, QtNetwork
28
29sys.path.append(os.path.join(os.getcwd(), "interface"))
30from qt4_form import Ui_Form
31
32import simplejson as json
33
34import puzzlebox_brainstorms_configuration as configuration
35import puzzlebox_brainstorms_client_interface as client_interface
36import puzzlebox_brainstorms_network_client as brainstorms_client
37import puzzlebox_brainstorms_network_client_thinkgear as thinkgear_client
38import puzzlebox_brainstorms_network_server as server
39import puzzlebox_brainstorms_remote_control as remote_control
40#import puzzlebox_logger
41
42#####################################################################
43# Globals
44#####################################################################
45
46DEBUG = 1
47
48SERVER_INTERFACE = configuration.BRAINSTORMS_SERVER_INTERFACE
49SERVER_HOST = configuration.BRAINSTORMS_SERVER_HOST
50SERVER_PORT = configuration.BRAINSTORMS_SERVER_PORT
51
52CLIENT_NO_REPLY_WAIT = configuration.CLIENT_NO_REPLY_WAIT * 1000
53
54DELIMITER = configuration.BRAINSTORMS_DELIMITER
55
56BLUETOOTH_DEVICE = configuration.NXT_BLUETOOTH_DEVICE
57
58DISCRETE_CONTROL_COMMANDS = configuration.BRAINSTORMS_DISCRETE_CONTROL_COMMANDS
59
60#####################################################################
61# Classes
62#####################################################################
63
64#####################################################################
65# Functions
66#####################################################################
67
68#####################################################################
69# Main
70#####################################################################
71
72if __name__ == '__main__':
73       
74        # Perform correct KeyboardInterrupt handling
75        signal.signal(signal.SIGINT, signal.SIG_DFL)
76       
77        #log = puzzlebox_logger.puzzlebox_logger(logfile='client_interface')
78        log = None
79       
80        # Collect default settings and command line parameters
81        server_interface = SERVER_INTERFACE
82        server_host = SERVER_HOST
83        server_port = SERVER_PORT
84       
85        for each in sys.argv:
86               
87                if each.startswith("--interface="):
88                        server_interface = each[ len("--interface="): ]
89                if each.startswith("--host="):
90                        server_host = each[ len("--host="): ]
91                if each.startswith("--port="):
92                        server_port = each[ len("--port="): ]
93       
94        app = QtGui.QApplication(sys.argv)
95       
96        server = server.puzzlebox_brainstorms_network_server(log, \
97                    server_interface, \
98                    server_port, \
99                    DEBUG=DEBUG)
100       
101        window = client_interface.puzzlebox_brainstorms_client_interface(log, DEBUG)
102        window.show()
103       
104        sys.exit(app.exec_())
105
Note: See TracBrowser for help on using the repository browser.