From d5dc69dabb09abcff42e2190f0667b62323f1dfa Mon Sep 17 00:00:00 2001 From: Ahmed Mahfouz Date: Tue, 27 Feb 2024 12:14:17 +0100 Subject: [PATCH 1/5] refactor: change the default directory for static files --- teleop/teleop/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teleop/teleop/app.py b/teleop/teleop/app.py index 385d3db5..75cdb0c1 100644 --- a/teleop/teleop/app.py +++ b/teleop/teleop/app.py @@ -434,7 +434,7 @@ def teleop_publish(cmd): # Path to where the static files are stored (JS,CSS, images) r"/(.*)", web.StaticFileHandler, - {"path": os.path.join(os.path.sep, "app", "htm", "static")}, + {"path": os.path.join(os.path.sep, "app", "htm")}, ), ] ) From 1afc032c0fc10415b824f253f04877647d7bffbf Mon Sep 17 00:00:00 2001 From: Ahmed Mahfouz Date: Tue, 27 Feb 2024 12:15:15 +0100 Subject: [PATCH 2/5] refacor: remove styles in .html They already exist in the .css file --- teleop/htm/templates/mobile_controller_ui.html | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/teleop/htm/templates/mobile_controller_ui.html b/teleop/htm/templates/mobile_controller_ui.html index 3b7e10b3..d9c4318f 100644 --- a/teleop/htm/templates/mobile_controller_ui.html +++ b/teleop/htm/templates/mobile_controller_ui.html @@ -9,22 +9,8 @@ - - + + From b16ff9fae86aa85dbbcb8cf31dc51dc6150fef8f Mon Sep 17 00:00:00 2001 From: Ahmed Mahfouz Date: Tue, 27 Feb 2024 12:16:56 +0100 Subject: [PATCH 3/5] refactor: use the new directory for files All the JS files have shorter directory path --- .../mobileController_a_app.js | 10 ++--- .../mobileController_c_logic.js | 6 +-- .../mobileController_d_pixi.js | 4 +- .../mobileController_z_state.js | 4 +- teleop/htm/templates/index.html | 42 +++++++++---------- teleop/htm/templates/user_menu.html | 28 ++++++------- 6 files changed, 47 insertions(+), 47 deletions(-) diff --git a/teleop/htm/static/JS/mobileController/mobileController_a_app.js b/teleop/htm/static/JS/mobileController/mobileController_a_app.js index bc338f3c..ae073038 100644 --- a/teleop/htm/static/JS/mobileController/mobileController_a_app.js +++ b/teleop/htm/static/JS/mobileController/mobileController_a_app.js @@ -1,10 +1,10 @@ -import { topTriangle, bottomTriangle } from "/JS/mobileController/mobileController_b_shape_triangle.js" -import { Dot } from "/JS/mobileController/mobileController_b_shape_dot.js" +import { topTriangle, bottomTriangle } from "./mobileController_b_shape_triangle.js" +import { Dot } from "./mobileController_b_shape_dot.js" import { handleDotMove, detectTriangle, handleTriangleMove, initializeWS, sendJSONCommand } - from "/JS/mobileController/mobileController_c_logic.js" + from "./mobileController_c_logic.js" -import CTRL_STAT from '/JS/mobileController/mobileController_z_state.js'; // Stands for control state -import { redraw, app } from "/JS/mobileController/mobileController_d_pixi.js"; +import CTRL_STAT from './mobileController_z_state.js'; // Stands for control state +import { redraw, app } from "./mobileController_d_pixi.js"; window.addEventListener('load', () => { diff --git a/teleop/htm/static/JS/mobileController/mobileController_c_logic.js b/teleop/htm/static/JS/mobileController/mobileController_c_logic.js index 3bbbe45a..e8b91d1a 100644 --- a/teleop/htm/static/JS/mobileController/mobileController_c_logic.js +++ b/teleop/htm/static/JS/mobileController/mobileController_c_logic.js @@ -1,7 +1,7 @@ -import { topTriangle, bottomTriangle } from "/JS/mobileController/mobileController_b_shape_triangle.js" -import CTRL_STAT from '/JS/mobileController/mobileController_z_state.js'; -import { redraw } from '/JS/mobileController/mobileController_d_pixi.js'; +import { topTriangle, bottomTriangle } from "./mobileController_b_shape_triangle.js" +import CTRL_STAT from './mobileController_z_state.js'; +import { redraw } from './mobileController_d_pixi.js'; function initializeWS() { let WSprotocol = document.location.protocol === 'https:' ? 'wss://' : 'ws://'; diff --git a/teleop/htm/static/JS/mobileController/mobileController_d_pixi.js b/teleop/htm/static/JS/mobileController/mobileController_d_pixi.js index eb7cd49d..f6a5ee09 100644 --- a/teleop/htm/static/JS/mobileController/mobileController_d_pixi.js +++ b/teleop/htm/static/JS/mobileController/mobileController_d_pixi.js @@ -1,5 +1,5 @@ -import { topTriangle, bottomTriangle } from "/JS/mobileController/mobileController_b_shape_triangle.js" -import CTRL_STAT from '/JS/mobileController/mobileController_z_state.js'; +import { topTriangle, bottomTriangle } from "./mobileController_b_shape_triangle.js" +import CTRL_STAT from './mobileController_z_state.js'; const app = new PIXI.Application({ width: window.innerWidth, diff --git a/teleop/htm/static/JS/mobileController/mobileController_z_state.js b/teleop/htm/static/JS/mobileController/mobileController_z_state.js index 563d60ef..38c858d4 100644 --- a/teleop/htm/static/JS/mobileController/mobileController_z_state.js +++ b/teleop/htm/static/JS/mobileController/mobileController_z_state.js @@ -1,7 +1,7 @@ //Shared State variables that goes between the files/modules used -import { Dot } from "/JS/mobileController/mobileController_b_shape_dot.js" -import { topTriangle, bottomTriangle } from "/JS/mobileController/mobileController_b_shape_triangle.js" +import { Dot } from "./mobileController_b_shape_dot.js" +import { topTriangle, bottomTriangle } from "./mobileController_b_shape_triangle.js" class MobileControllerState { //The starting y coord when the triangles are relocated () diff --git a/teleop/htm/templates/index.html b/teleop/htm/templates/index.html index 64dd45b4..196e7141 100644 --- a/teleop/htm/templates/index.html +++ b/teleop/htm/templates/index.html @@ -6,8 +6,8 @@ teleop - - + + @@ -41,7 +41,7 @@
0 - - + +
- -
@@ -89,11 +89,11 @@
- - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/teleop/htm/templates/user_menu.html b/teleop/htm/templates/user_menu.html index dbd48531..93f96d5e 100644 --- a/teleop/htm/templates/user_menu.html +++ b/teleop/htm/templates/user_menu.html @@ -4,11 +4,11 @@ Menu - - - - - + + + + +