source: orbit/python/orbit-gui.py @ 80b23ae

Last change on this file since 80b23ae was e85c5b0, checked in by Steve Castellotti <sc@…>, 7 years ago
  • Created separate Interface file for Orbit
  • Property mode set to 100755
File size: 2.8 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Puzzlebox - Orbit - Interface - GUI
5#
6# Copyright Puzzlebox Productions, LLC (2013-2014)
7
8__changelog__ = """\
9Last Update: 2014.02.23
10"""
11
12__doc__ = """|
13Linux Examples:
14#hcitool scan # Find devices
15#sdptool search sp D0:DF:9A:69:5D:42 # Examine serial services on device
16#hciconfig hci0 sspmode 0 # ignore this step as device seems to work with sspmode enabled
17rfcomm bind rfcomm0 D0:DF:9A:69:5D:42 1 # bind /dev/rfcomm0 to channel 1 on device
18rfcomm release D0:DF:9A:69:5D:42 # disconnect device
19"""
20
21import os, sys
22import signal
23
24if ('_MEIPASS2' in os.environ.keys()):
25        sys.path.insert(0, os.environ['_MEIPASS2'])
26        os.chdir(os.environ['_MEIPASS2'])
27
28if (sys.platform == 'darwin'):
29        pass
30
31import Puzzlebox.Orbit.Configuration as configuration
32
33if configuration.ENABLE_PYSIDE:
34        try:
35                #import PySide as PyQt4
36                from PySide import QtCore, QtGui, QtNetwork
37        except Exception, e:
38                print "ERROR: Exception importing PySide:",
39                print e
40                configuration.ENABLE_PYSIDE = False
41        else:
42                print "INFO: [Orbit:orbit-gui] Using PySide module"
43
44if not configuration.ENABLE_PYSIDE:
45        print "INFO: [Orbit:orbit-gui] Using PyQt4 module"
46        from PyQt4 import QtCore, QtGui, QtNetwork
47
48
49import Puzzlebox.Orbit.Interface as interface
50#import puzzlebox_logger
51
52
53#####################################################################
54# Globals
55#####################################################################
56
57DEBUG = 1
58
59#####################################################################
60# Classes
61#####################################################################
62
63#####################################################################
64# Functions
65#####################################################################
66
67#####################################################################
68# Main
69#####################################################################
70
71if __name__ == '__main__':
72       
73        # Perform correct KeyboardInterrupt handling
74        signal.signal(signal.SIGINT, signal.SIG_DFL)
75       
76        #log = puzzlebox_logger.puzzlebox_logger(logfile='client_interface')
77        log = None
78       
79        # Collect default settings and command line parameters
80        #server_interface = SERVER_INTERFACE
81        #server_host = SERVER_HOST
82        #server_port = SERVER_PORT
83       
84        for each in sys.argv:
85               
86                if each.startswith("--interface="):
87                        server_interface = each[ len("--interface="): ]
88                if each.startswith("--host="):
89                        server_host = each[ len("--host="): ]
90                if each.startswith("--port="):
91                        server_port = each[ len("--port="): ]
92       
93        app = QtGui.QApplication(sys.argv)
94       
95        QtGui.QApplication.setApplicationName('puzzlebox-orbit')
96       
97        window = interface.puzzlebox_orbit_interface(log, \
98                                                     #server=server, \
99                                                      DEBUG=DEBUG)
100       
101        window.show()
102       
103        sys.exit(app.exec_())
Note: See TracBrowser for help on using the repository browser.