From 5bde88c8701d7bfd7cd6c516a6bd1e79b011c388 Mon Sep 17 00:00:00 2001 From: gb0101010101 <7369439+gb0101010101@users.noreply.github.com> Date: Thu, 16 Jan 2020 14:25:36 -0800 Subject: [PATCH 1/4] Desktop UI fixes and improvements: Add feather icons, fix alignment of control elements, add styles for cleaner display. --- static/styles/frontpage.css | 18 +++++++++++++++++ templates/frontpage3d.html | 39 ++++++++++++++++++------------------- templates/zaxis.html | 10 ++++++---- 3 files changed, 43 insertions(+), 24 deletions(-) diff --git a/static/styles/frontpage.css b/static/styles/frontpage.css index b4cf77da..b71f1e44 100644 --- a/static/styles/frontpage.css +++ b/static/styles/frontpage.css @@ -143,3 +143,21 @@ html, body{ 100% { background-color: #B20000; box-shadow: 0 0 3px #B20000; } } +.controls { + align-items: center; +} + +.controls .btn { + width: 100%; + padding: .375rem .125rem; +} + +.controls label { + width: 100%; + margin-bottom: auto; + text-align: right; +} + +#pauseButton { + color: #fff; +} diff --git a/templates/frontpage3d.html b/templates/frontpage3d.html index 1636e279..e4a37f71 100644 --- a/templates/frontpage3d.html +++ b/templates/frontpage3d.html @@ -19,58 +19,57 @@

Controls

-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
- +
+
+
-
+
-
- +
+
diff --git a/templates/zaxis.html b/templates/zaxis.html index bb561778..586808fb 100644 --- a/templates/zaxis.html +++ b/templates/zaxis.html @@ -11,7 +11,7 @@
- +
@@ -19,15 +19,15 @@
- +
- +
- +
@@ -35,4 +35,6 @@ {% block javascript %} + + {% endblock %} From 407559fb6789edf0800adce6eccff877d3086d36 Mon Sep 17 00:00:00 2001 From: gb0101010101 <7369439+gb0101010101@users.noreply.github.com> Date: Thu, 16 Jan 2020 14:29:38 -0800 Subject: [PATCH 2/4] Mobile UI improvements: Remove extra closing div from EOF, remove extra closing brackets from JavaScript action calls, Add controls div for styling, Add feather icons, fix button layout, Remove 'Dist to move text' to optimize space, Move 'Def. Home' button. --- templates/frontpage3d_mobile.html | 178 +++++++++++++++--------------- templates/zaxis_mobile.html | 10 +- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/templates/frontpage3d_mobile.html b/templates/frontpage3d_mobile.html index 1d9a1125..5bdbef57 100644 --- a/templates/frontpage3d_mobile.html +++ b/templates/frontpage3d_mobile.html @@ -11,90 +11,89 @@ - + {% endblock %} {% block content %}
-

Controls

-
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
- +
+

Controls

+
+
+ +
+
+ +
+
+ +
-
-
-
- +
+
+ +
+
+ +
+
+ +
-
-
-
- +
+
+ +
+
+ +
+
+ +
-
- +
+
+ +
+
+ +
+
+ +
-
- +
+
+ +
+
+ +
+
+ +
+
No alerts
@@ -112,29 +111,29 @@

Controls

-
+
-
+
-
+
-
+
-
+
Line #:
-
- +
+
@@ -147,7 +146,7 @@
Line:
-
Position
+
Position:
@@ -205,7 +204,7 @@
State:
- +
@@ -224,14 +223,13 @@
State:
-
-

Controller Messages

-
+
+

Controller Messages

-
-
-
-
+
+
+
+
diff --git a/templates/zaxis_mobile.html b/templates/zaxis_mobile.html index 53f7889b..1c7a9f09 100644 --- a/templates/zaxis_mobile.html +++ b/templates/zaxis_mobile.html @@ -13,7 +13,7 @@
- +
@@ -21,14 +21,14 @@
- +
- +
- +
@@ -37,4 +37,6 @@ {% block javascript %} + + {% endblock %} From 7500e77ba8b84ee371ad32c89dd14607a2ef3768 Mon Sep 17 00:00:00 2001 From: gb0101010101 <7369439+gb0101010101@users.noreply.github.com> Date: Thu, 16 Jan 2020 14:30:26 -0800 Subject: [PATCH 3/4] Hide 'Web Control' text from navbar so that all elements fit on one line. --- static/scripts/base.js | 1 + 1 file changed, 1 insertion(+) diff --git a/static/scripts/base.js b/static/scripts/base.js index c57eb008..f11cba63 100644 --- a/static/scripts/base.js +++ b/static/scripts/base.js @@ -230,6 +230,7 @@ function setupStatusButtons(){ $('#mobileClientStatus').show(); $('#mobileCPUUsage').show(); $('#mobileControllerStatusAlert').show(); + $('.navbar-brand').hide(); } else { $('#mobileClientStatus').hide(); $('#mobileCPUUsage').hide(); From 74569693da2e62c8154860f75018f60e4f8a0d38 Mon Sep 17 00:00:00 2001 From: gb0101010101 <7369439+gb0101010101@users.noreply.github.com> Date: Thu, 16 Jan 2020 19:54:09 -0800 Subject: [PATCH 4/4] Proof of concept to detect and skip through gcode comment sections. --- Actions/actions.py | 27 +++++++++++++++++++++++++++ DataStructures/data.py | 2 ++ File/gcodeFile.py | 5 +++++ static/styles/frontpage.css | 5 +++++ templates/frontpage3d.html | 8 +++++++- 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Actions/actions.py b/Actions/actions.py index 68ed9f05..f5a885bd 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -133,6 +133,9 @@ def processAction(self, msg): elif msg["data"]["command"] == "moveGcodeZ": if not self.moveGcodeZ(int(msg["data"]["arg"])): self.data.ui_queue1.put("Alert", "Alert", "Error with moving to Z move") + elif msg["data"]["command"] == "moveGcodeSection": + if not self.moveGcodeSection(int(msg["data"]["arg"])): + self.data.ui_queue1.put("Alert", "Alert", "Error with moving to comment section") elif msg["data"]["command"] == "moveGcodeGoto": if not self.moveGcodeIndex(int(msg["data"]["arg"]), True): self.data.ui_queue1.put("Alert", "Alert", "Error with moving to Z move") @@ -644,6 +647,30 @@ def moveGcodeZ(self, moves): self.data.console_queue.put(str(e)) return False + def moveGcodeSection(self, moves): + ''' + Moves the gcode index to the next comment section. + :param moves: + :return: + ''' + try: + dist = 0 + #determine the number of lines to move to reach the next comment section. + for index, sectionComments in enumerate(self.data.sectionIndex): + if moves > 0 and sectionComments > self.data.gcodeIndex: + dist = self.data.sectionIndex[index + moves - 1] - self.data.gcodeIndex + break + if moves < 0 and sectionComments < self.data.gcodeIndex: + dist = self.data.sectionIndex[index + moves + 1] - self.data.gcodeIndex + if self.moveGcodeIndex(dist): + # this command will continue on in the moveGcodeIndex "if" + return True + else: + return False + except Exception as e: + self.data.console_queue.put(str(e)) + return False + def moveGcodeIndex(self, dist, index=False): ''' Moves the gcodeIndex by either the distance or, in index is True, uses the dist as the index. diff --git a/DataStructures/data.py b/DataStructures/data.py index e9ede004..e08de69a 100644 --- a/DataStructures/data.py +++ b/DataStructures/data.py @@ -57,6 +57,8 @@ class Data: gcodeIndex = 0 # Index of changes in z zMoves = [] + # Index of section comments + sectionIndex = [] # Holds the current value of the feed rate feedRate = 20 # holds the address of the g-code file so that the gcode can be refreshed diff --git a/File/gcodeFile.py b/File/gcodeFile.py index 137b0447..833424c2 100644 --- a/File/gcodeFile.py +++ b/File/gcodeFile.py @@ -146,8 +146,13 @@ def loadUpdateFile(self, gcode=""): # Find gcode indicies of z moves self.data.zMoves = [0] + self.data.sectionIndex = [0] zList = [] for index, line in enumerate(self.data.gcode): + # Matches text "(" + any alphanumeric characters + ")" but ignores "(MSG, gcode message text)" + s = re.search("^\((?!MSG,).+\)", line) + if s: + self.data.sectionIndex.append(index) filtersparsed = re.sub(r'\(([^)]*)\)', '', line) # replace mach3 style gcode comments with newline line = re.sub(r';([^.]*)?', '',filtersparsed) # replace standard ; initiated gcode comments with newline if not line.isspace(): # if all spaces, don't send. likely a comment. #if line.find("(") == -1: diff --git a/static/styles/frontpage.css b/static/styles/frontpage.css index e56f5b6d..8f03420b 100644 --- a/static/styles/frontpage.css +++ b/static/styles/frontpage.css @@ -144,3 +144,8 @@ html, body{ } #controllerMessage { overflow-wrap: anywhere; } + +.moveButtons .btn { + padding-left: .125rem; + padding-left: .125rem; +} diff --git a/templates/frontpage3d.html b/templates/frontpage3d.html index 1636e279..116e624c 100644 --- a/templates/frontpage3d.html +++ b/templates/frontpage3d.html @@ -89,7 +89,10 @@

Controls

-
+
+
+ +
@@ -102,6 +105,9 @@

Controls

+
+ +