Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
510f85cc
Commit
510f85cc
authored
Mar 30, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix reloading of visualization after UI change
parent
f810f246
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
25 deletions
+34
-25
pronterface.py
printrun/pronterface.py
+34
-25
No files found.
printrun/pronterface.py
View file @
510f85cc
...
...
@@ -273,7 +273,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
temppanel
.
Destroy
()
self
.
panel
.
Layout
()
if
self
.
fgcode
:
self
.
post_gcode_load
(
print_stats
=
False
)
self
.
start_viz_thread
(
)
self
.
ui_ready
=
True
self
.
Thaw
()
...
...
@@ -1363,10 +1363,13 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
def
layer_ready_cb
(
self
,
gcode
,
layer
):
self
.
viz_last_layer
=
layer
def
start_viz_thread
(
self
,
gcode
=
None
):
threading
.
Thread
(
target
=
self
.
loadviz
,
args
=
(
gcode
,))
.
start
()
def
pre_gcode_load
(
self
):
gcode
=
gcoder
.
GCode
(
deferred
=
True
)
self
.
viz_last_layer
=
-
1
threading
.
Thread
(
target
=
self
.
loadviz
,
args
=
(
gcode
,))
.
start
(
)
self
.
start_viz_thread
(
gcode
)
return
gcode
def
post_gcode_load
(
self
,
print_stats
=
True
):
...
...
@@ -1384,32 +1387,38 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
print
_
(
"- from
%.2
f mm to
%.2
f mm in Z and is
%.2
f mm high"
)
%
(
gcode
.
zmin
,
gcode
.
zmax
,
gcode
.
height
)
print
_
(
"Estimated duration:
%
d layers,
%
s"
)
%
gcode
.
estimate_duration
()
def
loadviz
(
self
,
gcode
):
def
loadviz
(
self
,
gcode
=
None
):
self
.
gviz
.
clear
()
self
.
gwindow
.
p
.
clear
()
generator
=
self
.
gviz
.
addfile_perlayer
(
gcode
,
True
)
next_layer
=
0
# Progressive loading of visualization
# We load layers up to the last one which has been processed in GCoder
# (self.viz_last_layer)
# Once the GCode has been entirely loaded, this variable becomes None,
# indicating that we can do the last generator call to finish the
# loading of the visualization, which will itself return None.
# During preloading we verify that the layer we added is the one we
# expected through the assert call.
while
True
:
max_layer
=
self
.
viz_last_layer
if
max_layer
is
None
:
break
while
next_layer
<=
max_layer
:
assert
(
generator
.
next
()
==
next_layer
)
next_layer
+=
1
time
.
sleep
(
0.1
)
generator_output
=
generator
.
next
()
while
generator_output
is
not
None
:
assert
(
generator_output
in
(
None
,
next_layer
))
next_layer
+=
1
if
gcode
is
not
None
:
generator
=
self
.
gviz
.
addfile_perlayer
(
gcode
,
True
)
next_layer
=
0
# Progressive loading of visualization
# We load layers up to the last one which has been processed in GCoder
# (self.viz_last_layer)
# Once the GCode has been entirely loaded, this variable becomes None,
# indicating that we can do the last generator call to finish the
# loading of the visualization, which will itself return None.
# During preloading we verify that the layer we added is the one we
# expected through the assert call.
while
True
:
max_layer
=
self
.
viz_last_layer
if
max_layer
is
None
:
break
while
next_layer
<=
max_layer
:
assert
(
generator
.
next
()
==
next_layer
)
next_layer
+=
1
time
.
sleep
(
0.1
)
generator_output
=
generator
.
next
()
while
generator_output
is
not
None
:
assert
(
generator_output
in
(
None
,
next_layer
))
next_layer
+=
1
generator_output
=
generator
.
next
()
else
:
# If GCode is not being loaded asynchroneously, it is already
# loaded, so let's make visualization sequentially
gcode
=
self
.
fgcode
self
.
gviz
.
addfile
(
gcode
)
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
# Load external window sequentially now that everything is ready.
# We can't really do any better as the 3D viewer might clone the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment