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):
...
@@ -273,7 +273,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
temppanel
.
Destroy
()
temppanel
.
Destroy
()
self
.
panel
.
Layout
()
self
.
panel
.
Layout
()
if
self
.
fgcode
:
if
self
.
fgcode
:
self
.
post_gcode_load
(
print_stats
=
False
)
self
.
start_viz_thread
(
)
self
.
ui_ready
=
True
self
.
ui_ready
=
True
self
.
Thaw
()
self
.
Thaw
()
...
@@ -1363,10 +1363,13 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -1363,10 +1363,13 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
def
layer_ready_cb
(
self
,
gcode
,
layer
):
def
layer_ready_cb
(
self
,
gcode
,
layer
):
self
.
viz_last_layer
=
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
):
def
pre_gcode_load
(
self
):
gcode
=
gcoder
.
GCode
(
deferred
=
True
)
gcode
=
gcoder
.
GCode
(
deferred
=
True
)
self
.
viz_last_layer
=
-
1
self
.
viz_last_layer
=
-
1
threading
.
Thread
(
target
=
self
.
loadviz
,
args
=
(
gcode
,))
.
start
(
)
self
.
start_viz_thread
(
gcode
)
return
gcode
return
gcode
def
post_gcode_load
(
self
,
print_stats
=
True
):
def
post_gcode_load
(
self
,
print_stats
=
True
):
...
@@ -1384,32 +1387,38 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
...
@@ -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
_
(
"- 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
()
print
_
(
"Estimated duration:
%
d layers,
%
s"
)
%
gcode
.
estimate_duration
()
def
loadviz
(
self
,
gcode
):
def
loadviz
(
self
,
gcode
=
None
):
self
.
gviz
.
clear
()
self
.
gviz
.
clear
()
self
.
gwindow
.
p
.
clear
()
self
.
gwindow
.
p
.
clear
()
generator
=
self
.
gviz
.
addfile_perlayer
(
gcode
,
True
)
if
gcode
is
not
None
:
next_layer
=
0
generator
=
self
.
gviz
.
addfile_perlayer
(
gcode
,
True
)
# Progressive loading of visualization
next_layer
=
0
# We load layers up to the last one which has been processed in GCoder
# Progressive loading of visualization
# (self.viz_last_layer)
# We load layers up to the last one which has been processed in GCoder
# Once the GCode has been entirely loaded, this variable becomes None,
# (self.viz_last_layer)
# indicating that we can do the last generator call to finish the
# Once the GCode has been entirely loaded, this variable becomes None,
# loading of the visualization, which will itself return None.
# indicating that we can do the last generator call to finish the
# During preloading we verify that the layer we added is the one we
# loading of the visualization, which will itself return None.
# expected through the assert call.
# During preloading we verify that the layer we added is the one we
while
True
:
# expected through the assert call.
max_layer
=
self
.
viz_last_layer
while
True
:
if
max_layer
is
None
:
max_layer
=
self
.
viz_last_layer
break
if
max_layer
is
None
:
while
next_layer
<=
max_layer
:
break
assert
(
generator
.
next
()
==
next_layer
)
while
next_layer
<=
max_layer
:
next_layer
+=
1
assert
(
generator
.
next
()
==
next_layer
)
time
.
sleep
(
0.1
)
next_layer
+=
1
generator_output
=
generator
.
next
()
time
.
sleep
(
0.1
)
while
generator_output
is
not
None
:
assert
(
generator_output
in
(
None
,
next_layer
))
next_layer
+=
1
generator_output
=
generator
.
next
()
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
)
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
# Load external window sequentially now that everything is ready.
# Load external window sequentially now that everything is ready.
# We can't really do any better as the 3D viewer might clone the
# 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