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
f5a722d5
Commit
f5a722d5
authored
Mar 30, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add partial redrawing of 2D visualization (#423)
parent
7848566a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
11 deletions
+29
-11
gviz.py
printrun/gviz.py
+29
-11
No files found.
printrun/gviz.py
View file @
f5a722d5
...
@@ -103,7 +103,7 @@ class GvizWindow(GvizBaseFrame):
...
@@ -103,7 +103,7 @@ class GvizWindow(GvizBaseFrame):
self
.
p
.
layerindex
=
self
.
layerslider
.
GetValue
()
self
.
p
.
layerindex
=
self
.
layerslider
.
GetValue
()
z
=
self
.
p
.
get_currentz
()
z
=
self
.
p
.
get_currentz
()
self
.
SetStatusText
(
_
(
"Layer
%
d - Going Up - Z =
%.03
f mm"
)
%
(
self
.
p
.
layerindex
+
1
,
z
),
0
)
self
.
SetStatusText
(
_
(
"Layer
%
d - Going Up - Z =
%.03
f mm"
)
%
(
self
.
p
.
layerindex
+
1
,
z
),
0
)
self
.
p
.
dirty
=
1
self
.
p
.
dirty
=
True
wx
.
CallAfter
(
self
.
p
.
Refresh
)
wx
.
CallAfter
(
self
.
p
.
Refresh
)
def
resetview
(
self
,
event
):
def
resetview
(
self
,
event
):
...
@@ -122,7 +122,7 @@ class GvizWindow(GvizBaseFrame):
...
@@ -122,7 +122,7 @@ class GvizWindow(GvizBaseFrame):
self
.
basetrans
=
self
.
p
.
translate
self
.
basetrans
=
self
.
p
.
translate
self
.
p
.
translate
=
[
self
.
basetrans
[
0
]
+
(
e
[
0
]
-
self
.
initpos
[
0
]),
self
.
p
.
translate
=
[
self
.
basetrans
[
0
]
+
(
e
[
0
]
-
self
.
initpos
[
0
]),
self
.
basetrans
[
1
]
+
(
e
[
1
]
-
self
.
initpos
[
1
])]
self
.
basetrans
[
1
]
+
(
e
[
1
]
-
self
.
initpos
[
1
])]
self
.
p
.
dirty
=
1
self
.
p
.
dirty
=
True
wx
.
CallAfter
(
self
.
p
.
Refresh
)
wx
.
CallAfter
(
self
.
p
.
Refresh
)
else
:
else
:
event
.
Skip
()
event
.
Skip
()
...
@@ -163,7 +163,7 @@ class Gviz(wx.Panel):
...
@@ -163,7 +163,7 @@ class Gviz(wx.Panel):
def
_set_showall
(
self
,
showall
):
def
_set_showall
(
self
,
showall
):
if
showall
!=
self
.
_showall
:
if
showall
!=
self
.
_showall
:
self
.
dirty
=
1
self
.
dirty
=
True
self
.
_showall
=
showall
self
.
_showall
=
showall
showall
=
property
(
_get_showall
,
_set_showall
)
showall
=
property
(
_get_showall
,
_set_showall
)
...
@@ -226,7 +226,9 @@ class Gviz(wx.Panel):
...
@@ -226,7 +226,9 @@ class Gviz(wx.Panel):
self
.
clearhilights
()
self
.
clearhilights
()
self
.
layerindex
=
0
self
.
layerindex
=
0
self
.
showall
=
0
self
.
showall
=
0
self
.
dirty
=
1
self
.
dirty
=
True
self
.
partial
=
False
self
.
painted_layers
=
set
()
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
def
get_currentz
(
self
):
def
get_currentz
(
self
):
...
@@ -239,7 +241,7 @@ class Gviz(wx.Panel):
...
@@ -239,7 +241,7 @@ class Gviz(wx.Panel):
self
.
layerindex
+=
1
self
.
layerindex
+=
1
z
=
self
.
get_currentz
()
z
=
self
.
get_currentz
()
self
.
parent
.
SetStatusText
(
_
(
"Layer
%
d - Going Up - Z =
%.03
f mm"
)
%
(
self
.
layerindex
+
1
,
z
),
0
)
self
.
parent
.
SetStatusText
(
_
(
"Layer
%
d - Going Up - Z =
%.03
f mm"
)
%
(
self
.
layerindex
+
1
,
z
),
0
)
self
.
dirty
=
1
self
.
dirty
=
True
self
.
parent
.
setlayercb
(
self
.
layerindex
)
self
.
parent
.
setlayercb
(
self
.
layerindex
)
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
...
@@ -248,7 +250,7 @@ class Gviz(wx.Panel):
...
@@ -248,7 +250,7 @@ class Gviz(wx.Panel):
self
.
layerindex
-=
1
self
.
layerindex
-=
1
z
=
self
.
get_currentz
()
z
=
self
.
get_currentz
()
self
.
parent
.
SetStatusText
(
_
(
"Layer
%
d - Going Down - Z =
%.03
f mm"
)
%
(
self
.
layerindex
+
1
,
z
),
0
)
self
.
parent
.
SetStatusText
(
_
(
"Layer
%
d - Going Down - Z =
%.03
f mm"
)
%
(
self
.
layerindex
+
1
,
z
),
0
)
self
.
dirty
=
1
self
.
dirty
=
True
self
.
parent
.
setlayercb
(
self
.
layerindex
)
self
.
parent
.
setlayercb
(
self
.
layerindex
)
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
...
@@ -256,7 +258,7 @@ class Gviz(wx.Panel):
...
@@ -256,7 +258,7 @@ class Gviz(wx.Panel):
if
layer
in
self
.
layers
:
if
layer
in
self
.
layers
:
self
.
clearhilights
()
self
.
clearhilights
()
self
.
layerindex
=
self
.
layers
[
layer
]
self
.
layerindex
=
self
.
layers
[
layer
]
self
.
dirty
=
1
self
.
dirty
=
True
self
.
showall
=
0
self
.
showall
=
0
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
...
@@ -282,7 +284,7 @@ class Gviz(wx.Panel):
...
@@ -282,7 +284,7 @@ class Gviz(wx.Panel):
penwidth
=
max
(
1.0
,
self
.
filament_width
*
((
self
.
scale
[
0
]
+
self
.
scale
[
1
])
/
2.0
))
penwidth
=
max
(
1.0
,
self
.
filament_width
*
((
self
.
scale
[
0
]
+
self
.
scale
[
1
])
/
2.0
))
for
pen
in
self
.
penslist
:
for
pen
in
self
.
penslist
:
pen
.
SetWidth
(
penwidth
)
pen
.
SetWidth
(
penwidth
)
self
.
dirty
=
1
self
.
dirty
=
True
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
def
_line_scaler
(
self
,
x
):
def
_line_scaler
(
self
,
x
):
...
@@ -339,8 +341,10 @@ class Gviz(wx.Panel):
...
@@ -339,8 +341,10 @@ class Gviz(wx.Panel):
if
self
.
showall
:
if
self
.
showall
:
for
i
in
range
(
len
(
self
.
layersz
)):
for
i
in
range
(
len
(
self
.
layersz
)):
self
.
painted_layers
.
add
(
i
)
self
.
_drawlines
(
dc
,
self
.
lines
[
i
],
self
.
pens
[
i
])
self
.
_drawlines
(
dc
,
self
.
lines
[
i
],
self
.
pens
[
i
])
self
.
_drawarcs
(
dc
,
self
.
arcs
[
i
],
self
.
arcpens
[
i
])
self
.
_drawarcs
(
dc
,
self
.
arcs
[
i
],
self
.
arcpens
[
i
])
dc
.
SelectObject
(
wx
.
NullBitmap
)
return
return
if
self
.
layerindex
<
len
(
self
.
layers
)
and
self
.
layerindex
in
self
.
lines
:
if
self
.
layerindex
<
len
(
self
.
layers
)
and
self
.
layerindex
in
self
.
lines
:
...
@@ -357,6 +361,16 @@ class Gviz(wx.Panel):
...
@@ -357,6 +361,16 @@ class Gviz(wx.Panel):
dc
.
SelectObject
(
wx
.
NullBitmap
)
dc
.
SelectObject
(
wx
.
NullBitmap
)
def
repaint_partial
(
self
):
if
self
.
showall
:
dc
=
wx
.
MemoryDC
()
dc
.
SelectObject
(
self
.
blitmap
)
for
i
in
set
(
range
(
len
(
self
.
layersz
)))
.
difference
(
self
.
painted_layers
):
self
.
painted_layers
.
add
(
i
)
self
.
_drawlines
(
dc
,
self
.
lines
[
i
],
self
.
pens
[
i
])
self
.
_drawarcs
(
dc
,
self
.
arcs
[
i
],
self
.
arcpens
[
i
])
dc
.
SelectObject
(
wx
.
NullBitmap
)
def
paint_hilights
(
self
,
dc
=
None
):
def
paint_hilights
(
self
,
dc
=
None
):
if
self
.
hilightqueue
.
empty
()
and
self
.
hilightarcsqueue
.
empty
():
if
self
.
hilightqueue
.
empty
()
and
self
.
hilightarcsqueue
.
empty
():
return
return
...
@@ -374,8 +388,12 @@ class Gviz(wx.Panel):
...
@@ -374,8 +388,12 @@ class Gviz(wx.Panel):
def
paint
(
self
,
event
):
def
paint
(
self
,
event
):
if
self
.
dirty
:
if
self
.
dirty
:
self
.
dirty
=
0
self
.
dirty
=
False
self
.
partial
=
False
self
.
repaint_everything
()
self
.
repaint_everything
()
elif
self
.
partial
:
self
.
partial
=
False
self
.
repaint_partial
()
self
.
paint_hilights
()
self
.
paint_hilights
()
dc
=
wx
.
PaintDC
(
self
)
dc
=
wx
.
PaintDC
(
self
)
dc
.
SetBackground
(
wx
.
Brush
(
self
.
bgcolor
))
dc
.
SetBackground
(
wx
.
Brush
(
self
.
bgcolor
))
...
@@ -485,13 +503,13 @@ class Gviz(wx.Panel):
...
@@ -485,13 +503,13 @@ class Gviz(wx.Panel):
# Refresh display if more than 0.2s have passed
# Refresh display if more than 0.2s have passed
if
time
.
time
()
-
start_time
>
0.2
:
if
time
.
time
()
-
start_time
>
0.2
:
start_time
=
time
.
time
()
start_time
=
time
.
time
()
self
.
dirty
=
1
self
.
partial
=
True
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
yield
layer_idx
yield
layer_idx
layer_idx
+=
1
layer_idx
+=
1
self
.
dirty
=
1
self
.
dirty
=
True
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
yield
None
yield
None
...
...
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