move depenency up
This commit is contained in:
parent
077120e9e4
commit
4a3f7b8384
|
@ -4,6 +4,7 @@ from datetime import timedelta
|
||||||
|
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
import pyautogui
|
||||||
import eventlet
|
import eventlet
|
||||||
from engineio.payload import Payload
|
from engineio.payload import Payload
|
||||||
|
|
||||||
|
@ -23,11 +24,12 @@ from flask_socketio import SocketIO
|
||||||
|
|
||||||
|
|
||||||
# Configs and 'init'
|
# Configs and 'init'
|
||||||
|
APP_NAME = 'RemoteMouse'
|
||||||
ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__))
|
ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.update({
|
app.config.update({
|
||||||
"TITLE": 'RemoteMouse',
|
"TITLE": APP_NAME,
|
||||||
'DEBUG': False,
|
'DEBUG': False,
|
||||||
'SECRET_KEY': secrets.token_hex(32),
|
'SECRET_KEY': secrets.token_hex(32),
|
||||||
'PERMANENT_SESSION_LIFETIME': timedelta(days = 7).total_seconds()
|
'PERMANENT_SESSION_LIFETIME': timedelta(days = 7).total_seconds()
|
||||||
|
@ -45,4 +47,10 @@ socketio = SocketIO(app, async_mode = 'eventlet',
|
||||||
logger = True)
|
logger = True)
|
||||||
|
|
||||||
|
|
||||||
|
app.jinja_env.globals['TITLE'] = APP_NAME
|
||||||
|
pyautogui.FAILSAFE = False # If we hit corner, that's ok
|
||||||
|
# Let piautogui make updates as quick as it can...
|
||||||
|
pyautogui.MINIMUM_DURATION = 0
|
||||||
|
pyautogui.PAUSE = 0
|
||||||
|
|
||||||
from core import routes
|
from core import routes
|
||||||
|
|
|
@ -7,24 +7,17 @@ from flask import request, render_template
|
||||||
|
|
||||||
|
|
||||||
# App imports
|
# App imports
|
||||||
from core import app, socketio # Get from __init__
|
from core import app, pyautogui, socketio # Get from __init__
|
||||||
from core.MessageHandler import MessageHandler # Get simple message processor
|
from core.MessageHandler import MessageHandler # Get simple message processor
|
||||||
|
|
||||||
|
|
||||||
msgHandler = MessageHandler()
|
msgHandler = MessageHandler()
|
||||||
TITLE = app.config['TITLE']
|
|
||||||
|
|
||||||
pyautogui.FAILSAFE = False # If we hit corner, that's ok
|
|
||||||
# Let piautogui make updates as quick as it can...
|
|
||||||
pyautogui.MINIMUM_DURATION = 0
|
|
||||||
pyautogui.PAUSE = 0
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def home():
|
def home():
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render_template('index.html',
|
return render_template('index.html')
|
||||||
title=TITLE)
|
|
||||||
|
|
||||||
return render_template('error.html',
|
return render_template('error.html',
|
||||||
title='Error!',
|
title='Error!',
|
||||||
|
@ -42,7 +35,6 @@ def soundManager():
|
||||||
print(process.stdout.read())
|
print(process.stdout.read())
|
||||||
_apps = []
|
_apps = []
|
||||||
return render_template('sound-manager.html',
|
return render_template('sound-manager.html',
|
||||||
title=TITLE,
|
|
||||||
apps=_apps)
|
apps=_apps)
|
||||||
|
|
||||||
return render_template('error.html',
|
return render_template('error.html',
|
||||||
|
|
|
@ -6,7 +6,7 @@ from flask import request, render_template
|
||||||
|
|
||||||
|
|
||||||
# App imports
|
# App imports
|
||||||
from core import app, socketio # Get from __init__
|
from core import app, pyautogui, socketio # Get from __init__
|
||||||
from core.MessageHandler import MessageHandler # Get simple message processor
|
from core.MessageHandler import MessageHandler # Get simple message processor
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,11 +14,6 @@ from core.MessageHandler import MessageHandler # Get simple message processor
|
||||||
|
|
||||||
msgHandler = MessageHandler()
|
msgHandler = MessageHandler()
|
||||||
|
|
||||||
pyautogui.FAILSAFE = False # If we hit corner, that's ok
|
|
||||||
# Let piautogui make updates as quick as it can...
|
|
||||||
pyautogui.MINIMUM_DURATION = 0
|
|
||||||
pyautogui.PAUSE = 0
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/mouse-down')
|
@app.route('/mouse-down')
|
||||||
@socketio.on('mouse_down')
|
@socketio.on('mouse_down')
|
||||||
|
@ -79,4 +74,4 @@ def updateCoords(message):
|
||||||
# print(str(x) + "," + str(y))
|
# print(str(x) + "," + str(y))
|
||||||
pyautogui.moveRel(x, y);
|
pyautogui.moveRel(x, y);
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print( repr(e) )
|
pass
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{% if title %}
|
{% if title %}
|
||||||
<title>{{title}}</title>
|
<title>{{title}}</title>
|
||||||
{% else %}
|
{% else %}
|
||||||
<title>App</title>
|
<title>{{TITLE}}</title>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% block header_css %}
|
{% block header_css %}
|
||||||
|
|
Loading…
Reference in New Issue