mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 14:13:55 -06:00
T466: Added progress indicator
This commit is contained in:
parent
ba9d7fa1e2
commit
2d2b8601a0
1 changed files with 23 additions and 0 deletions
|
@ -9,6 +9,10 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
|||
from UM.Math.Vector import Vector
|
||||
from UM.Math.AxisAlignedBox import AxisAlignedBox
|
||||
from UM.Application import Application
|
||||
from UM.Message import Message
|
||||
|
||||
from UM.i18n import i18nCatalog
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
|
||||
from cura import LayerDataBuilder
|
||||
|
@ -16,6 +20,7 @@ from cura import LayerDataDecorator
|
|||
from cura import LayerPolygon
|
||||
|
||||
import numpy
|
||||
import math
|
||||
|
||||
|
||||
class GCODEReader(MeshReader):
|
||||
|
@ -92,6 +97,14 @@ class GCODEReader(MeshReader):
|
|||
|
||||
file = open(file_name, "r")
|
||||
|
||||
file_lines = 0
|
||||
current_line = 0
|
||||
for line in file:
|
||||
file_lines += 1
|
||||
file.seek(0)
|
||||
|
||||
file_step = math.floor(file_lines / 100)
|
||||
|
||||
layer_data = LayerDataBuilder.LayerDataBuilder()
|
||||
|
||||
current_extruder = 1
|
||||
|
@ -102,6 +115,10 @@ class GCODEReader(MeshReader):
|
|||
current_e = 0
|
||||
current_layer = 0
|
||||
|
||||
message = Message(catalog.i18nc("@info:status", "Parsing GCODE"), lifetime=0, dismissable=False)
|
||||
message.setProgress(0)
|
||||
message.show()
|
||||
|
||||
def CreatePolygon():
|
||||
countvalid = False
|
||||
for point in current_path:
|
||||
|
@ -142,6 +159,10 @@ class GCODEReader(MeshReader):
|
|||
return True
|
||||
|
||||
for line in file:
|
||||
current_line += 1
|
||||
if current_line % file_step == 0:
|
||||
# print(current_line/file_lines*100)
|
||||
message.setProgress(math.floor(current_line/file_lines*100))
|
||||
if len(line) == 0:
|
||||
continue
|
||||
if line[0] == ";":
|
||||
|
@ -204,6 +225,8 @@ class GCODEReader(MeshReader):
|
|||
decorator.setLayerData(layer_mesh)
|
||||
scene_node.addDecorator(decorator)
|
||||
|
||||
message.hide()
|
||||
|
||||
Application.getInstance().getPrintInformation()._pre_sliced = True
|
||||
|
||||
scene_node.parentChanged.connect(self.parent_changed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue