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
50e4a9bf
Commit
50e4a9bf
authored
May 24, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store all hilights as we might need to repaint everything
parent
cb2f6616
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
gviz.py
printrun/gviz.py
+24
-12
No files found.
printrun/gviz.py
View file @
50e4a9bf
...
...
@@ -14,6 +14,7 @@
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
from
Queue
import
Queue
from
collections
import
deque
import
wx
,
time
from
printrun
import
gcoder
...
...
@@ -157,8 +158,10 @@ class gviz(wx.Panel):
self
.
fades
=
[
wx
.
Pen
(
wx
.
Colour
(
250
-
0.6
**
i
*
100
,
250
-
0.6
**
i
*
100
,
200
-
0.4
**
i
*
50
),
penwidth
)
for
i
in
xrange
(
6
)]
self
.
penslist
=
[
self
.
mainpen
,
self
.
travelpen
,
self
.
hlpen
]
+
self
.
fades
self
.
showall
=
0
self
.
hilight
=
Queue
(
0
)
self
.
hilightarcs
=
Queue
(
0
)
self
.
hilight
=
deque
()
self
.
hilightarcs
=
deque
()
self
.
hilightqueue
=
Queue
(
0
)
self
.
hilightarcsqueue
=
Queue
(
0
)
self
.
dirty
=
1
self
.
blitmap
=
wx
.
EmptyBitmap
(
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
],
-
1
)
...
...
@@ -168,10 +171,12 @@ class gviz(wx.Panel):
print
"Layer "
+
str
(
self
.
layerindex
+
1
)
+
" - Z = "
+
str
(
self
.
layers
[
self
.
layerindex
])
+
" mm"
def
clearhilights
(
self
):
while
not
self
.
hilight
.
empty
():
self
.
hilight
.
get_nowait
()
while
not
self
.
hilightarcs
.
empty
():
self
.
hilightarcs
.
get_nowait
()
self
.
hilight
.
clear
()
self
.
hilightarcs
.
clear
()
while
not
self
.
hilightqueue
.
empty
():
self
.
hilightqueue
.
get_nowait
()
while
not
self
.
hilightarcsqueue
.
empty
():
self
.
hilightarcsqueue
.
get_nowait
()
def
clear
(
self
):
self
.
lastpos
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
]
...
...
@@ -294,21 +299,26 @@ class gviz(wx.Panel):
self
.
_drawlines
(
dc
,
self
.
lines
[
self
.
layers
[
self
.
layerindex
]],
self
.
pens
[
self
.
layers
[
self
.
layerindex
]])
self
.
_drawarcs
(
dc
,
self
.
arcs
[
self
.
layers
[
self
.
layerindex
]],
self
.
arcpens
[
self
.
layers
[
self
.
layerindex
]])
self
.
_drawlines
(
dc
,
self
.
hilight
,
self
.
hlpen
)
self
.
_drawarcs
(
dc
,
self
.
hilightarcs
,
self
.
hlpen
)
self
.
paint_hilights
(
dc
)
dc
.
SelectObject
(
wx
.
NullBitmap
)
def
paint_hilights
(
self
,
dc
=
None
):
if
self
.
hilightqueue
.
empty
()
and
self
.
hilightarcsqueue
.
empty
():
return
hl
=
[]
if
not
dc
:
dc
=
wx
.
MemoryDC
()
dc
.
SelectObject
(
self
.
blitmap
)
while
not
self
.
hilight
.
empty
():
hl
.
append
(
self
.
hilight
.
get_nowait
())
while
not
self
.
hilight
queue
.
empty
():
hl
.
append
(
self
.
hilight
queue
.
get_nowait
())
self
.
_drawlines
(
dc
,
hl
,
self
.
hlpen
)
hlarcs
=
[]
while
not
self
.
hilightarcs
.
empty
():
hlarcs
.
append
(
self
.
hilightarcs
.
get_nowait
())
while
not
self
.
hilightarcs
queue
.
empty
():
hlarcs
.
append
(
self
.
hilightarcs
queue
.
get_nowait
())
self
.
_drawarcs
(
dc
,
hlarcs
,
self
.
hlpen
)
def
paint
(
self
,
event
):
...
...
@@ -428,7 +438,8 @@ class gviz(wx.Panel):
self
.
lines
[
z
]
.
append
((
_x
(
start_pos
[
0
]),
_y
(
start_pos
[
1
]),
_x
(
target
[
0
]),
_y
(
target
[
1
])))
self
.
pens
[
z
]
.
append
(
self
.
mainpen
if
target
[
3
]
!=
self
.
lastpos
[
3
]
else
self
.
travelpen
)
else
:
self
.
hilight
.
put_nowait
(
line
)
self
.
hilight
.
append
(
line
)
self
.
hilightqueue
.
put_nowait
(
line
)
elif
gline
.
command
in
[
"G2"
,
"G3"
]:
# startpos, endpos, arc center
arc
=
[
_x
(
start_pos
[
0
]),
_y
(
start_pos
[
1
]),
...
...
@@ -441,7 +452,8 @@ class gviz(wx.Panel):
self
.
arcs
[
z
]
.
append
(
arc
)
self
.
arcpens
[
z
]
.
append
(
self
.
arcpen
)
else
:
self
.
hilightarcs
.
put_nowait
(
arc
)
self
.
hilightarcs
.
append
(
arc
)
self
.
hilightarcsqueue
.
put_nowait
(
arc
)
if
not
hilight
:
self
.
lastpos
=
target
...
...
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