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
3a0ab157
Commit
3a0ab157
authored
Apr 22, 2012
by
Jeremy Hammett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update gviz.py
parent
a06669fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
gviz.py
gviz.py
+12
-3
No files found.
gviz.py
View file @
3a0ab157
...
@@ -12,13 +12,15 @@
...
@@ -12,13 +12,15 @@
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
import
wx
,
time
import
wx
,
time
ID_ABOUT
=
101
ID_EXIT
=
110
class
window
(
wx
.
Frame
):
class
window
(
wx
.
Frame
):
def
__init__
(
self
,
f
,
size
=
(
600
,
600
),
build_dimensions
=
[
200
,
200
,
100
,
0
,
0
,
0
],
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
def
__init__
(
self
,
f
,
size
=
(
600
,
600
),
build_dimensions
=
[
200
,
200
,
100
,
0
,
0
,
0
],
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Gcode view, shift to move view, mousewheel to set layer"
,
size
=
(
size
[
0
],
size
[
1
]))
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
"Gcode view, shift to move view, mousewheel to set layer"
,
size
=
(
size
[
0
],
size
[
1
]))
self
.
p
=
gviz
(
self
,
size
=
size
,
build_dimensions
=
build_dimensions
,
grid
=
grid
,
extrusion_width
=
extrusion_width
)
self
.
p
=
gviz
(
self
,
size
=
size
,
build_dimensions
=
build_dimensions
,
grid
=
grid
,
extrusion_width
=
extrusion_width
)
self
.
CreateStatusBar
(
1
);
self
.
SetStatusText
(
"Layer number and Z position show here when you scroll"
);
s
=
time
.
time
()
s
=
time
.
time
()
#print time.time()-s
#print time.time()-s
self
.
initpos
=
[
0
,
0
]
self
.
initpos
=
[
0
,
0
]
...
@@ -28,7 +30,7 @@ class window(wx.Frame):
...
@@ -28,7 +30,7 @@ class window(wx.Frame):
self
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
self
.
zoom
)
self
.
Bind
(
wx
.
EVT_MOUSEWHEEL
,
self
.
zoom
)
self
.
p
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
self
.
p
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
self
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
self
.
Bind
(
wx
.
EVT_MOUSE_EVENTS
,
self
.
mouse
)
def
mouse
(
self
,
event
):
def
mouse
(
self
,
event
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
event
.
ButtonUp
(
wx
.
MOUSE_BTN_LEFT
):
if
(
self
.
initpos
is
not
None
):
if
(
self
.
initpos
is
not
None
):
...
@@ -76,6 +78,7 @@ class window(wx.Frame):
...
@@ -76,6 +78,7 @@ class window(wx.Frame):
class
gviz
(
wx
.
Panel
):
class
gviz
(
wx
.
Panel
):
def
__init__
(
self
,
parent
,
size
=
(
200
,
200
),
build_dimensions
=
[
200
,
200
,
100
,
0
,
0
,
0
],
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
def
__init__
(
self
,
parent
,
size
=
(
200
,
200
),
build_dimensions
=
[
200
,
200
,
100
,
0
,
0
,
0
],
grid
=
(
10
,
50
),
extrusion_width
=
0.5
):
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
(
size
[
0
],
size
[
1
]))
wx
.
Panel
.
__init__
(
self
,
parent
,
-
1
,
size
=
(
size
[
0
],
size
[
1
]))
self
.
parent
=
parent
self
.
size
=
size
self
.
size
=
size
self
.
build_dimensions
=
build_dimensions
self
.
build_dimensions
=
build_dimensions
self
.
grid
=
grid
self
.
grid
=
grid
...
@@ -122,12 +125,18 @@ class gviz(wx.Panel):
...
@@ -122,12 +125,18 @@ class gviz(wx.Panel):
def
layerup
(
self
):
def
layerup
(
self
):
if
(
self
.
layerindex
+
1
<
len
(
self
.
layers
)):
if
(
self
.
layerindex
+
1
<
len
(
self
.
layers
)):
self
.
layerindex
+=
1
self
.
layerindex
+=
1
self
.
parent
.
SetStatusText
(
"Layer "
+
str
(
self
.
layerindex
+
1
)
+
" - Going Up - Z = "
+
str
(
self
.
layers
[
self
.
layerindex
])
+
" mm"
,
0
)
# self.parent.setstatustext("Layer = "+str(self.layerindex) , 0)
self
.
repaint
()
self
.
repaint
()
self
.
Refresh
()
self
.
Refresh
()
def
layerdown
(
self
):
def
layerdown
(
self
):
if
(
self
.
layerindex
>
0
):
if
(
self
.
layerindex
>
0
):
self
.
layerindex
-=
1
self
.
layerindex
-=
1
self
.
parent
.
SetStatusText
(
"Layer "
+
str
(
self
.
layerindex
+
1
)
+
" - Going Down - Z = "
+
str
(
self
.
layers
[
self
.
layerindex
])
+
" mm"
,
0
)
# self.parent.setstatustext("Layer = "+str(self.layerindex), 0)
self
.
repaint
()
self
.
repaint
()
self
.
Refresh
()
self
.
Refresh
()
...
...
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