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
09b7718f
Commit
09b7718f
authored
Jun 29, 2011
by
kliment
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only redraw when necessary in gviz
parent
1febba48
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
gviz.py
gviz.py
+25
-4
No files found.
gviz.py
View file @
09b7718f
...
...
@@ -50,6 +50,8 @@ class gviz(wx.Panel):
self
.
fades
=
[
wx
.
Pen
(
wx
.
Colour
(
150
+
20
*
i
,
150
+
20
*
i
,
150
+
20
*
i
))
for
i
in
xrange
(
6
)]
self
.
showall
=
0
self
.
hilight
=
[]
self
.
dirty
=
1
self
.
blitmap
=
wx
.
EmptyBitmap
(
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
],
-
1
)
def
clear
(
self
):
self
.
lastpos
=
[
0
,
0
,
0
,
0
,
0
]
...
...
@@ -59,33 +61,43 @@ class gviz(wx.Panel):
self
.
layers
=
[]
self
.
layerindex
=
0
self
.
showall
=
0
self
.
dirty
=
1
self
.
repaint
()
def
layerup
(
self
):
if
(
self
.
layerindex
+
1
<
len
(
self
.
layers
)):
self
.
layerindex
+=
1
self
.
repaint
()
self
.
Refresh
()
def
layerdown
(
self
):
if
(
self
.
layerindex
>
0
):
self
.
layerindex
-=
1
self
.
repaint
()
self
.
Refresh
()
def
setlayer
(
self
,
layer
):
try
:
self
.
layerindex
=
self
.
layers
.
index
(
layer
)
self
.
repaint
()
wx
.
CallAfter
(
self
.
Refresh
)
self
.
showall
=
0
except
:
pass
def
zoom
(
self
,
x
,
y
,
factor
):
self
.
scale
=
[
s
*
factor
for
s
in
self
.
scale
]
self
.
translate
=
[
x
-
(
x
-
self
.
translate
[
0
])
*
factor
,
y
-
(
y
-
self
.
translate
[
1
])
*
factor
]
#self.dirty=1
self
.
repaint
()
self
.
Refresh
()
def
paint
(
self
,
event
):
dc
=
wx
.
PaintDC
(
self
)
def
repaint
(
self
):
self
.
blitmap
=
wx
.
EmptyBitmap
(
self
.
GetClientSize
()[
0
],
self
.
GetClientSize
()[
1
],
-
1
)
dc
=
wx
.
MemoryDC
()
dc
.
SelectObject
(
self
.
blitmap
)
dc
.
SetBackground
(
wx
.
Brush
((
250
,
250
,
200
)))
dc
.
Clear
()
if
not
self
.
showall
:
...
...
@@ -115,6 +127,15 @@ class gviz(wx.Panel):
dc
.
DrawLineList
(
l
,
self
.
pens
[
self
.
layers
[
self
.
layerindex
]])
l
=
map
(
scaler
,
self
.
hilight
)
dc
.
DrawLineList
(
l
,
self
.
hlpen
)
dc
.
SelectObject
(
wx
.
NullBitmap
)
def
paint
(
self
,
event
):
dc
=
wx
.
PaintDC
(
self
)
if
(
self
.
dirty
):
self
.
repaint
()
self
.
dirty
=
0
sz
=
self
.
GetClientSize
()
dc
.
DrawBitmap
(
self
.
blitmap
,
0
,
0
)
del
dc
def
addgcode
(
self
,
gcode
=
"M105"
,
hilight
=
0
):
...
...
@@ -147,7 +168,7 @@ class gviz(wx.Panel):
else
:
self
.
hilight
+=
[(
self
.
hilightpos
[
0
],
self
.
bedsize
[
1
]
-
self
.
hilightpos
[
1
],
target
[
0
],
self
.
bedsize
[
1
]
-
target
[
1
])]
self
.
hilightpos
=
target
self
.
dirty
=
1
if
__name__
==
'__main__'
:
...
...
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