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/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(); diff --git a/static/styles/frontpage.css b/static/styles/frontpage.css index e56f5b6d..ab48c8f2 100644 --- a/static/styles/frontpage.css +++ b/static/styles/frontpage.css @@ -143,4 +143,28 @@ 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; +} + #controllerMessage { overflow-wrap: anywhere; } + +.moveButtons .btn { + padding-left: .125rem; + padding-left: .125rem; +} diff --git a/templates/frontpage3d.html b/templates/frontpage3d.html index 1636e279..a4fba2fa 100644 --- a/templates/frontpage3d.html +++ b/templates/frontpage3d.html @@ -19,58 +19,57 @@

Controls

-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
- +
+
+
-
+
-
- +
+
@@ -89,7 +88,10 @@

Controls

-
+
+
+ +
@@ -102,6 +104,9 @@

Controls

+
+ +
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.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 %} 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 %}