Commit 7b7274e7 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix support for legacy systems

parent 4b766de1
...@@ -38,6 +38,21 @@ try: ...@@ -38,6 +38,21 @@ try:
except ImportError: except ImportError:
log.error('You must install speedometer first') log.error('You must install speedometer first')
# Make sure the gui can import modules in the current directory
sys.path.insert(0, '.')
try:
import datamodel
except ImportError:
datamodel = None
try:
from PythonController import(OpenMsgQueueForReading,
GetMsgQueueBufferSize, DV, RetrieveMessageFromQueue)
python_controller = True
except ImportError:
python_controller = False
import resources import resources
from mscHandler import mscHandler from mscHandler import mscHandler
...@@ -111,9 +126,6 @@ def gui(): ...@@ -111,9 +126,6 @@ def gui():
# Exit app on Ctrl-C # Exit app on Ctrl-C
signal.signal(signal.SIGINT, signal.SIG_DFL) signal.signal(signal.SIGINT, signal.SIG_DFL)
# Make sure the gui can import modules in the current directory
sys.path.insert(0, '.')
usage = 'usage: gui.py [--udp=IP_Address:in_Port:out_Port]' usage = 'usage: gui.py [--udp=IP_Address:in_Port:out_Port]'
version = 'taste auto-gui %s' % (__version__) version = 'taste auto-gui %s' % (__version__)
...@@ -154,9 +166,7 @@ def gui(): ...@@ -154,9 +166,7 @@ def gui():
log.error('You entered ' + options.udp) log.error('You entered ' + options.udp)
sys.exit(-1) sys.exit(-1)
try: if not datamodel:
import datamodel
except ImportError:
log.error('Could not import project data') log.error('Could not import project data')
return -1 return -1
...@@ -164,13 +174,10 @@ def gui(): ...@@ -164,13 +174,10 @@ def gui():
udp = None udp = None
dll = None dll = None
hasTM = False hasTM = False
if options.udp is None and options.shared_lib is None: if not options.udp and not options.shared_lib:
# Default: use message queue # Default: use message queue
try: log.info('Using message queues to communicate')
from PythonController import(OpenMsgQueueForReading, if not python_controller:
GetMsgQueueBufferSize, DV, RetrieveMessageFromQueue)
log.info('Using message queues to communicate')
except ImportError:
log.error('Python module "PythonController" is missing') log.error('Python module "PythonController" is missing')
return -1 return -1
elif options.udp: elif options.udp:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Resource object code # Resource object code
# #
# Created: Sun Nov 16 11:39:53 2014 # Created: Sun Nov 16 12:02:01 2014
# by: The Resource Compiler for PySide (Qt v4.8.6) # by: The Resource Compiler for PySide (Qt v4.8.6)
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment