Simplify if/else statement

This deduplicates some code and makes it generally easier to read.

Contributes to issue CURA-8219.
This commit is contained in:
Ghostkeeper 2021-05-05 14:50:43 +02:00
parent e1e25d629e
commit bed255ecb9
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -91,9 +91,7 @@ class FilamentChange(Script):
color_change = "M600" color_change = "M600"
if firmware_config: if not firmware_config:
color_change = color_change + " ; Generated by FilamentChange plugin\n"
else:
if initial_retract is not None and initial_retract > 0.: if initial_retract is not None and initial_retract > 0.:
color_change = color_change + (" E%.2f" % initial_retract) color_change = color_change + (" E%.2f" % initial_retract)
@ -106,7 +104,7 @@ class FilamentChange(Script):
if y_pos is not None: if y_pos is not None:
color_change = color_change + (" Y%.2f" % y_pos) color_change = color_change + (" Y%.2f" % y_pos)
color_change = color_change + " ; Generated by FilamentChange plugin\n" color_change = color_change + " ; Generated by FilamentChange plugin\n"
layer_targets = layer_nums.split(",") layer_targets = layer_nums.split(",")
if len(layer_targets) > 0: if len(layer_targets) > 0: