Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gee <bostwickenator@gmail.com>2020-07-08 08:30:19 +0300
committerGitHub <noreply@github.com>2020-07-08 08:30:19 +0300
commit0a97511d3a8320e5d5d9b62617d646af667bae78 (patch)
tree72ffbd82e049486ae1198103d5e9f5a632f856ae /plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py
parent18098ae89364345476a360600baf083d89d0bedf (diff)
Apply suggestions from code review
Co-authored-by: Konstantinos Karmas <konskarm@gmail.com>
Diffstat (limited to 'plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py')
-rw-r--r--plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py b/plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py
index ac195b3b6c..a445fb3a6e 100644
--- a/plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py
+++ b/plugins/PostProcessingPlugin/scripts/DisplayProgressOnLCD.py
@@ -59,7 +59,7 @@ class DisplayProgressOnLCD(Script):
output_time = self.getSettingValueByKey("time_remaining")
output_percentage = self.getSettingValueByKey("percentage")
line_set = {}
- if (output_percentage or output_time) == True:
+ if output_percentage or output_time:
total_time = -1
previous_layer_end_percentage = 0
for layer in data:
@@ -72,35 +72,34 @@ class DisplayProgressOnLCD(Script):
total_time = self.getTimeValue(line)
line_index = lines.index(line)
- if (output_time):
+ if output_time:
self.outputTime(lines, line_index, total_time)
- if (output_percentage):
+ if output_percentage:
# Emit 0 percent to sure Marlin knows we are overriding the completion percentage
lines.insert(line_index, "M73 P0")
-
elif line.startswith(";TIME_ELAPSED:"):
# We've found one of the time elapsed values which are added at the end of layers
# If we have seen this line before then skip processing it. We can see lines multiple times because we are adding
# intermediate percentages before the line being processed. This can cause the current line to shift back and be
# encountered more than once
- if (line in line_set):
+ if line in line_set:
continue
line_set[line] = True
# If total_time was not already found then noop
- if (total_time == -1):
+ if total_time == -1:
continue
current_time = self.getTimeValue(line)
line_index = lines.index(line)
- if (output_time):
+ if output_time:
# Here we calculate remaining time
self.outputTime(lines, line_index, total_time - current_time)
- if (output_percentage):
+ if output_percentage:
# Calculate percentage value this layer ends at
layer_end_percentage = int((current_time / total_time) * 100)
@@ -108,7 +107,7 @@ class DisplayProgressOnLCD(Script):
layer_percentage_delta = layer_end_percentage - previous_layer_end_percentage
# If this layer represents less than 1 percent then we don't need to emit anything, continue to the next layer
- if (layer_percentage_delta != 0):
+ if layer_percentage_delta != 0:
# Grab the index of the current line and figure out how many lines represent one percent
step = line_index / layer_percentage_delta
@@ -127,5 +126,5 @@ class DisplayProgressOnLCD(Script):
previous_layer_end_percentage = layer_end_percentage
# Join up the lines for this layer again and store them in the data array
- data[layer_index] = "\n".join(lines)
+ data[layer_index] = "\n".join(lines)
return data