python2 fix, ctrl+c now exits app, useless javascript console message removed
This commit is contained in:
parent
668d9d0dcf
commit
15ada52bfa
@ -897,7 +897,7 @@ function canvas_mousewheel(evt)
|
|||||||
//console.log(evt);
|
//console.log(evt);
|
||||||
var relativeX=(evt.offsetX)?evt.offsetX:evt.layerX;
|
var relativeX=(evt.offsetX)?evt.offsetX:evt.layerX;
|
||||||
var dir=(evt.deltaY/Math.abs(evt.deltaY))>0;
|
var dir=(evt.deltaY/Math.abs(evt.deltaY))>0;
|
||||||
console.log(dir);
|
//console.log(dir);
|
||||||
//i/=120;
|
//i/=120;
|
||||||
/*while (i--)*/ zoom_step(dir, relativeX, zoom_center_where_calc(evt.pageX));
|
/*while (i--)*/ zoom_step(dir, relativeX, zoom_center_where_calc(evt.pageX));
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
@ -1261,6 +1261,7 @@ function on_ws_error(event)
|
|||||||
|
|
||||||
function open_websocket()
|
function open_websocket()
|
||||||
{
|
{
|
||||||
|
//ws_url="ws://"+(window.location.origin.split("://")[1])+"/ws/" //guess automatically
|
||||||
if (!("WebSocket" in window))
|
if (!("WebSocket" in window))
|
||||||
divlog("Your browser does not support WebSocket, which is required for WebRX to run. Please upgrade to a HTML5 compatible browser.");
|
divlog("Your browser does not support WebSocket, which is required for WebRX to run. Please upgrade to a HTML5 compatible browser.");
|
||||||
ws = new WebSocket(ws_url+client_id);
|
ws = new WebSocket(ws_url+client_id);
|
||||||
|
15
openwebrx.py
15
openwebrx.py
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python2
|
||||||
print "" # python2.7 is required to run OpenWebRX instead of python3. Please run me by: python2 openwebrx.py
|
print "" # python2.7 is required to run OpenWebRX instead of python3. Please run me by: python2 openwebrx.py
|
||||||
"""
|
"""
|
||||||
OpenWebRX: open-source web based SDR for everyone!
|
OpenWebRX: open-source web based SDR for everyone!
|
||||||
@ -54,6 +54,7 @@ import ctypes
|
|||||||
import rxws
|
import rxws
|
||||||
import uuid
|
import uuid
|
||||||
import config_webrx as cfg
|
import config_webrx as cfg
|
||||||
|
import signal
|
||||||
|
|
||||||
def import_all_plugins(directory):
|
def import_all_plugins(directory):
|
||||||
for subdir in os.listdir(directory):
|
for subdir in os.listdir(directory):
|
||||||
@ -67,10 +68,13 @@ def import_all_plugins(directory):
|
|||||||
class MultiThreadHTTPServer(ThreadingMixIn, HTTPServer):
|
class MultiThreadHTTPServer(ThreadingMixIn, HTTPServer):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def handle_signal(signal, frame):
|
||||||
|
print "[openwebrx] Ctrl+C: aborting."
|
||||||
|
os._exit(1) #not too graceful exit
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global clients
|
global clients
|
||||||
global clients_mutex
|
global clients_mutex
|
||||||
|
|
||||||
print
|
print
|
||||||
print "OpenWebRX - Open Source Web Based SDR for Everyone | for license see LICENSE file in the package"
|
print "OpenWebRX - Open Source Web Based SDR for Everyone | for license see LICENSE file in the package"
|
||||||
print "_________________________________________________________________________________________________"
|
print "_________________________________________________________________________________________________"
|
||||||
@ -78,6 +82,9 @@ def main():
|
|||||||
print "Author contact info: Andras Retzler, HA7ILM <randras@sdr.hu>"
|
print "Author contact info: Andras Retzler, HA7ILM <randras@sdr.hu>"
|
||||||
print
|
print
|
||||||
|
|
||||||
|
#Set signal handler
|
||||||
|
signal.signal(signal.SIGINT, handle_signal) #http://stackoverflow.com/questions/1112343/how-do-i-capture-sigint-in-python
|
||||||
|
|
||||||
#Load plugins
|
#Load plugins
|
||||||
import_all_plugins("plugins/dsp/")
|
import_all_plugins("plugins/dsp/")
|
||||||
|
|
||||||
@ -98,9 +105,9 @@ def main():
|
|||||||
print "[openwebrx-main] Started rtl thread: "+cfg.start_rtl_command
|
print "[openwebrx-main] Started rtl thread: "+cfg.start_rtl_command
|
||||||
|
|
||||||
#Run rtl_mus.py in a different OS thread
|
#Run rtl_mus.py in a different OS thread
|
||||||
rtl_mus_thread=threading.Thread(target = lambda:subprocess.Popen("python rtl_mus.py config_rtl", shell=True), args=())
|
rtl_mus_thread=threading.Thread(target = lambda:subprocess.Popen("python2 rtl_mus.py config_rtl", shell=True), args=())
|
||||||
rtl_mus_thread.start() # The new feature in GNU Radio 3.7: top_block() locks up ALL python threads until it gets the TCP connection.
|
rtl_mus_thread.start() # The new feature in GNU Radio 3.7: top_block() locks up ALL python threads until it gets the TCP connection.
|
||||||
print "[openwebrx-main] Started rtl_mus"
|
print "[openwebrx-main] Started rtl_mus."
|
||||||
time.sleep(1) #wait until it really starts
|
time.sleep(1) #wait until it really starts
|
||||||
|
|
||||||
#Initialize clients
|
#Initialize clients
|
||||||
|
@ -37,10 +37,15 @@ import pdb
|
|||||||
import asyncore
|
import asyncore
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import dl
|
import dl
|
||||||
|
import signal
|
||||||
|
|
||||||
import code
|
import code
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
def handle_signal(signal, frame):
|
||||||
|
log.info("Ctrl+C: aborting.")
|
||||||
|
os._exit(1) #not too graceful exit
|
||||||
|
|
||||||
def ip_match(this,ip_ranges,for_allow):
|
def ip_match(this,ip_ranges,for_allow):
|
||||||
if not len(ip_ranges):
|
if not len(ip_ranges):
|
||||||
return 1 #empty list matches all ip addresses
|
return 1 #empty list matches all ip addresses
|
||||||
@ -445,6 +450,9 @@ def main():
|
|||||||
global rtl_tcp_core
|
global rtl_tcp_core
|
||||||
global sample_rate
|
global sample_rate
|
||||||
|
|
||||||
|
#Set signal handler
|
||||||
|
signal.signal(signal.SIGINT, handle_signal) #http://stackoverflow.com/questions/1112343/how-do-i-capture-sigint-in-python
|
||||||
|
|
||||||
# set up logging
|
# set up logging
|
||||||
log = logging.getLogger("rtl_mus")
|
log = logging.getLogger("rtl_mus")
|
||||||
log.setLevel(logging.DEBUG)
|
log.setLevel(logging.DEBUG)
|
||||||
|
Loading…
Reference in New Issue
Block a user