Compare commits
No commits in common. "847fd0562ecfc43ee39a69e6c72b169e6b9f763e" and "ebfb47932e92fbea9fddb89acf3c3436fff9507c" have entirely different histories.
847fd0562e
...
ebfb47932e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1 @@
|
|||||||
.*swp*
|
.*swp*
|
||||||
*__pycache__
|
|
||||||
www/config.js
|
|
||||||
|
@ -6,8 +6,6 @@ wwwip = 192.168.2.43
|
|||||||
nozoscip = 127.0.0.1
|
nozoscip = 127.0.0.1
|
||||||
bhoroscip = 127.0.0.1
|
bhoroscip = 127.0.0.1
|
||||||
autostart = artnet
|
autostart = artnet
|
||||||
wstype = ws
|
|
||||||
wsport = 9001
|
|
||||||
|
|
||||||
[laser0]
|
[laser0]
|
||||||
color = -1
|
color = -1
|
||||||
|
44
configure.py
44
configure.py
@ -7,6 +7,7 @@ v0.1.0
|
|||||||
|
|
||||||
A console friendly interface to change important parameters
|
A console friendly interface to change important parameters
|
||||||
|
|
||||||
|
|
||||||
LICENCE : CC
|
LICENCE : CC
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@ -14,41 +15,20 @@ import configparser
|
|||||||
from libs3 import gstt
|
from libs3 import gstt
|
||||||
import ast
|
import ast
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import os, sys
|
import updateUI
|
||||||
import fileinput
|
|
||||||
from shutil import copyfile
|
|
||||||
ljpath = r'%s' % os.getcwd().replace('\\','/')
|
|
||||||
|
|
||||||
def updateJSConfig(config):
|
|
||||||
global ljpath
|
|
||||||
wwwip = config.get('General','wwwip')
|
|
||||||
wstype = config.get('General','wstype')
|
|
||||||
wsport = config.get('General','wsport')
|
|
||||||
# copy template
|
|
||||||
src = ljpath + "/templates/config.js"
|
|
||||||
dst = ljpath + "/www/config.js"
|
|
||||||
copyfile(src, dst)
|
|
||||||
# Interpolate variables
|
|
||||||
with fileinput.FileInput(dst, inplace=True) as file:
|
|
||||||
for line in file:
|
|
||||||
line = line.replace("%wstype%", wstype)
|
|
||||||
line = line.replace("%wsport%", wsport)
|
|
||||||
line = line.replace("%wwwip%", wwwip)
|
|
||||||
print(line, end='')
|
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(gstt.ConfigName)
|
config.read(gstt.ConfigName)
|
||||||
|
|
||||||
qList = [
|
qList = [
|
||||||
{"q":"The server IP address ","c":"General","k":"ljayserverip"},
|
{"q":"The server IP address ","c":"General","k":"ljayserverip"},
|
||||||
{"q":"The IP address for webui ","c":"General","k":"wwwip"},
|
{"q":"The IP address for webui","c":"General","k":"wwwip"},
|
||||||
{"q":"Websocket type (ws or wss?) ","c":"General","k":"wstype"},
|
{"q":"How many lasers to use ","c":"General","k":"lasernumber"},
|
||||||
{"q":"Websocket port ","c":"General","k":"wsport"},
|
{"q":"Laser 0 IP address ","c":"laser0","k":"ip"},
|
||||||
{"q":"How many lasers to use ","c":"General","k":"lasernumber"},
|
{"q":"Laser 1 IP address ","c":"laser1","k":"ip"},
|
||||||
{"q":"Laser 0 IP address ","c":"laser0","k":"ip"},
|
{"q":"Laser 2 IP address ","c":"laser2","k":"ip"},
|
||||||
{"q":"Laser 1 IP address ","c":"laser1","k":"ip"},
|
{"q":"Laser 3 IP address ","c":"laser3","k":"ip"}
|
||||||
{"q":"Laser 2 IP address ","c":"laser2","k":"ip"},
|
|
||||||
{"q":"Laser 3 IP address ","c":"laser3","k":"ip"}
|
|
||||||
]
|
]
|
||||||
stop = False
|
stop = False
|
||||||
while stop == False :
|
while stop == False :
|
||||||
@ -74,7 +54,7 @@ while stop == False :
|
|||||||
new_value = input("Please enter the new value:")
|
new_value = input("Please enter the new value:")
|
||||||
config.set(choice["c"],choice["k"],new_value)
|
config.set(choice["c"],choice["k"],new_value)
|
||||||
config.write(open(gstt.ConfigName,'w'))
|
config.write(open(gstt.ConfigName,'w'))
|
||||||
if choice["k"] in ["wwwip","wstype","wsport"] :
|
print(choice["c"],choice["k"])
|
||||||
updateJSConfig(config)
|
if choice["k"] == "wwwip":
|
||||||
print("*****************************\nUpdated the www configuration\n*****************************")
|
updateUI.www(new_value)
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
websocket_uri = "%wstype%://%wwwip%:%wsport%/"
|
|
80
updateUI.py
80
updateUI.py
@ -1,31 +1,67 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python2.7
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# -*- mode: Python -*-
|
# -*- mode: Python -*-
|
||||||
'''
|
'''
|
||||||
LJ UI IP updater v0.9.0
|
LJ UI IP updater v0.8.1
|
||||||
|
|
||||||
MUST be called from configure.py
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
#wwwIP = "192.168.2.78"
|
||||||
|
#wwwIP = "aurora.teamlaser.fr"
|
||||||
|
wwwIP = "192.168.1.48"
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
import fileinput
|
|
||||||
from shutil import copyfile
|
|
||||||
ljpath = r'%s' % os.getcwd().replace('\\','/')
|
ljpath = r'%s' % os.getcwd().replace('\\','/')
|
||||||
|
|
||||||
def www(config):
|
python2 = (2, 6) <= sys.version_info < (3, 0)
|
||||||
global ljpath
|
|
||||||
wwwip = config.get('General','wwwip')
|
def Updatepage(file_name):
|
||||||
wstype = config.get('General','wstype')
|
|
||||||
wsport = config.get('General','wsport')
|
print("updating", file_name)
|
||||||
# copy template
|
f=open(file_name,"r+")
|
||||||
src = ljpath + "/templates/config.js"
|
a=f.readlines()
|
||||||
dst = ljpath + "/www/config.js"
|
#print a
|
||||||
copyfile(src, dst)
|
|
||||||
# Interpolate variables
|
for line in a:
|
||||||
with fileinput.FileInput(dst, inplace=True) as file:
|
|
||||||
for line in file:
|
if python2 == True:
|
||||||
line = line.replace("%wstype%", wstype)
|
|
||||||
line = line.replace("%wsport%", wsport)
|
# python2
|
||||||
line = line.replace("%wwwip%", wwwip)
|
if "var LJ = " in line > -1:
|
||||||
print(line, end='')
|
p=a.index(line)
|
||||||
|
#so now we have the position of the line which to be modified
|
||||||
|
a[p]=" var LJ = 'ws://"+wwwIP+":9001/'\n"
|
||||||
|
#print(p, line, a[p])
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
# python3
|
||||||
|
IPline = ("var LJ = " in line)
|
||||||
|
if IPline == True:
|
||||||
|
|
||||||
|
p=a.index(line)
|
||||||
|
#so now we have the position of the line which to be modified
|
||||||
|
a[p]=" var LJ = 'ws://"+wwwIP+":9001/'\n"
|
||||||
|
#print(p, line, a[p])
|
||||||
|
|
||||||
|
f.seek(0)
|
||||||
|
f.truncate() #ersing all data from the file
|
||||||
|
f.close()
|
||||||
|
#so now we have an empty file and we will write the modified content now in the file
|
||||||
|
o=open(file_name,"w")
|
||||||
|
for i in a:
|
||||||
|
o.write(i)
|
||||||
|
o.close()
|
||||||
|
#now the modification is done in the file
|
||||||
|
|
||||||
|
def www(wwwip):
|
||||||
|
global wwwIP
|
||||||
|
|
||||||
|
wwwIP = wwwip
|
||||||
|
print("Updating www files to use", wwwIP)
|
||||||
|
Updatepage(ljpath+"/www/LJ.js")
|
||||||
|
Updatepage(ljpath+"/www/trckr/trckrcam1.html")
|
||||||
|
Updatepage(ljpath+"/www/trckr/trckr.html")
|
||||||
|
Updatepage(ljpath+"/www/simu.html")
|
||||||
|
Updatepage(ljpath+"/www/align.html")
|
||||||
|
Updatepage(ljpath+"/www/auralls.html")
|
||||||
|
Updatepage(ljpath+"/www/index.html")
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// LJ websocket address. IP will be updated at LJ startup according to LJ.conf wwwIP
|
// LJ websocket address. IP will be updated at LJ startup according to LJ.conf wwwIP
|
||||||
|
|
||||||
var LJ = websocket_uri
|
var LJ = 'ws://192.168.2.44:9001/'
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
<!-- Web audio buttons defaults -->
|
<!-- Web audio buttons defaults -->
|
||||||
<script type="application/javascript" src="webcomponents-lite.js"></script>
|
<script type="application/javascript" src="webcomponents-lite.js"></script>
|
||||||
<script type="application/javascript" src="config.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
WebAudioControlsOptions={
|
WebAudioControlsOptions={
|
||||||
useMidi:1,
|
useMidi:1,
|
||||||
@ -659,7 +658,7 @@
|
|||||||
<!-- LJ style WS : A nettoyer ! -->
|
<!-- LJ style WS : A nettoyer ! -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var LJ = websocket_uri
|
var LJ = 'ws://192.168.2.44:9001/'
|
||||||
|
|
||||||
var _WS = {
|
var _WS = {
|
||||||
uri: LJ,
|
uri: LJ,
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
<!-- Web audio buttons defaults -->
|
<!-- Web audio buttons defaults -->
|
||||||
<script type="application/javascript" src="webcomponents-lite.js"></script>
|
<script type="application/javascript" src="webcomponents-lite.js"></script>
|
||||||
<script type="application/javascript" src="config.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
WebAudioControlsOptions={
|
WebAudioControlsOptions={
|
||||||
useMidi:1,
|
useMidi:1,
|
||||||
@ -418,7 +417,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var LJ = websocket_uri
|
var LJ = 'ws://192.168.2.44:9001/'
|
||||||
|
|
||||||
|
|
||||||
var pl = "";
|
var pl = "";
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
<!-- Web audio buttons defaults -->
|
<!-- Web audio buttons defaults -->
|
||||||
<script type="application/javascript" src="webcomponents-lite.js"></script>
|
<script type="application/javascript" src="webcomponents-lite.js"></script>
|
||||||
<script type="application/javascript" src="config.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
WebAudioControlsOptions={
|
WebAudioControlsOptions={
|
||||||
useMidi:1,
|
useMidi:1,
|
||||||
@ -232,7 +231,7 @@
|
|||||||
<!-- LJ style WS : A nettoyer ! -->
|
<!-- LJ style WS : A nettoyer ! -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var LJ = websocket_uri
|
var LJ = 'ws://192.168.2.44:9001/'
|
||||||
|
|
||||||
|
|
||||||
var _WS = {
|
var _WS = {
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
<!-- Web audio buttons defaults -->
|
<!-- Web audio buttons defaults -->
|
||||||
<script type="application/javascript" src="webcomponents-lite.js"></script>
|
<script type="application/javascript" src="webcomponents-lite.js"></script>
|
||||||
<script type="application/javascript" src="config.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
WebAudioControlsOptions={
|
WebAudioControlsOptions={
|
||||||
useMidi:1,
|
useMidi:1,
|
||||||
@ -198,7 +197,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var LJ = websocket_uri
|
var LJ = 'ws://192.168.2.44:9001/'
|
||||||
|
|
||||||
|
|
||||||
var pl = "";
|
var pl = "";
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
<title>PDM Modelviewer</title>
|
<title>PDM Modelviewer</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||||
<script type="application/javascript" src="../config.js"></script>
|
|
||||||
<style>
|
<style>
|
||||||
@import url(https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700);
|
@import url(https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700);
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
<title>PDM Modelviewer</title>
|
<title>PDM Modelviewer</title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||||
<script type="application/javascript" src="../config.js"></script>
|
|
||||||
<style>
|
<style>
|
||||||
@import url(https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700);
|
@import url(https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700);
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
<link rel="apple-touch-icon" sizes="180x180" href="../touch-icon-iphone-retina.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="../touch-icon-iphone-retina.png">
|
||||||
<link rel="apple-touch-icon" sizes="167x167" href="../touch-icon-ipad-retina.png">
|
<link rel="apple-touch-icon" sizes="167x167" href="../touch-icon-ipad-retina.png">
|
||||||
|
|
||||||
<script type="application/javascript" src="../config.js"></script>
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
@ -379,7 +378,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var LJ = 'ws://192.168.2.43:9001/'
|
var LJ = 'ws://192.168.2.44:9001/'
|
||||||
|
|
||||||
var _WS = {
|
var _WS = {
|
||||||
uri: LJ,
|
uri: LJ,
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
<link rel="apple-touch-icon" sizes="180x180" href="../touch-icon-iphone-retina.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="../touch-icon-iphone-retina.png">
|
||||||
<link rel="apple-touch-icon" sizes="167x167" href="../touch-icon-ipad-retina.png">
|
<link rel="apple-touch-icon" sizes="167x167" href="../touch-icon-ipad-retina.png">
|
||||||
|
|
||||||
<script type="application/javascript" src="../config.js"></script>
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
@ -379,7 +378,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var LJ = 'ws://192.168.2.43:9001/'
|
var LJ = 'ws://192.168.2.44:9001/'
|
||||||
|
|
||||||
var _WS = {
|
var _WS = {
|
||||||
uri: LJ,
|
uri: LJ,
|
||||||
|
Loading…
Reference in New Issue
Block a user