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
74df4e20
Commit
74df4e20
authored
Jul 16, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework gcview a little bit
parent
6f7c26f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
gcview.py
printrun/gcview.py
+10
-4
panel.py
printrun/gl/panel.py
+5
-0
No files found.
printrun/gcview.py
View file @
74df4e20
...
@@ -189,6 +189,7 @@ class GcodeViewPanel(wxGLPanel):
...
@@ -189,6 +189,7 @@ class GcodeViewPanel(wxGLPanel):
def
fit
(
self
):
def
fit
(
self
):
if
not
self
.
parent
.
model
or
not
self
.
parent
.
model
.
loaded
:
if
not
self
.
parent
.
model
or
not
self
.
parent
.
model
.
loaded
:
return
return
self
.
canvas
.
SetCurrent
(
self
.
context
)
dims
=
self
.
parent
.
model
.
dims
dims
=
self
.
parent
.
model
.
dims
self
.
reset_mview
(
1.0
)
self
.
reset_mview
(
1.0
)
center_x
=
(
dims
[
0
][
0
]
+
dims
[
0
][
1
])
/
2
center_x
=
(
dims
[
0
][
0
]
+
dims
[
0
][
1
])
/
2
...
@@ -199,6 +200,7 @@ class GcodeViewPanel(wxGLPanel):
...
@@ -199,6 +200,7 @@ class GcodeViewPanel(wxGLPanel):
ratio
=
float
(
self
.
dist
)
/
max
(
dims
[
0
][
2
],
dims
[
1
][
2
])
ratio
=
float
(
self
.
dist
)
/
max
(
dims
[
0
][
2
],
dims
[
1
][
2
])
glScalef
(
ratio
,
ratio
,
1
)
glScalef
(
ratio
,
ratio
,
1
)
glTranslatef
(
center_x
,
center_y
,
0
)
glTranslatef
(
center_x
,
center_y
,
0
)
wx
.
CallAfter
(
self
.
Refresh
)
def
keypress
(
self
,
event
):
def
keypress
(
self
,
event
):
"""gets keypress events and moves/rotates acive shape"""
"""gets keypress events and moves/rotates acive shape"""
...
@@ -219,9 +221,9 @@ class GcodeViewPanel(wxGLPanel):
...
@@ -219,9 +221,9 @@ class GcodeViewPanel(wxGLPanel):
self
.
layerdown
()
self
.
layerdown
()
x
,
y
,
_
=
self
.
mouse_to_3d
(
self
.
width
/
2
,
self
.
height
/
2
)
x
,
y
,
_
=
self
.
mouse_to_3d
(
self
.
width
/
2
,
self
.
height
/
2
)
if
key
in
kzi
:
if
key
in
kzi
:
self
.
zoom
(
step
,
(
x
,
y
)
)
self
.
zoom
_to_center
(
step
)
if
key
in
kzo
:
if
key
in
kzo
:
self
.
zoom
(
1
/
step
,
(
x
,
y
)
)
self
.
zoom
_to_center
(
1
/
step
)
if
key
in
kfit
:
if
key
in
kfit
:
self
.
fit
()
self
.
fit
()
if
key
in
kshowcurrent
:
if
key
in
kshowcurrent
:
...
@@ -229,9 +231,13 @@ class GcodeViewPanel(wxGLPanel):
...
@@ -229,9 +231,13 @@ class GcodeViewPanel(wxGLPanel):
return
return
self
.
parent
.
model
.
only_current
=
not
self
.
parent
.
model
.
only_current
self
.
parent
.
model
.
only_current
=
not
self
.
parent
.
model
.
only_current
if
key
in
kreset
:
if
key
in
kreset
:
self
.
reset_mview
(
0.9
)
self
.
resetview
()
self
.
basequat
=
[
0
,
0
,
0
,
1
]
event
.
Skip
()
event
.
Skip
()
def
resetview
(
self
):
self
.
canvas
.
SetCurrent
(
self
.
context
)
self
.
reset_mview
(
0.9
)
self
.
basequat
=
[
0
,
0
,
0
,
1
]
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
class
GCObject
(
object
):
class
GCObject
(
object
):
...
...
printrun/gl/panel.py
View file @
74df4e20
...
@@ -199,3 +199,8 @@ class wxGLPanel(wx.Panel):
...
@@ -199,3 +199,8 @@ class wxGLPanel(wx.Panel):
if
to
:
if
to
:
glTranslatef
(
-
delta_x
,
-
delta_y
,
0
)
glTranslatef
(
-
delta_x
,
-
delta_y
,
0
)
wx
.
CallAfter
(
self
.
Refresh
)
wx
.
CallAfter
(
self
.
Refresh
)
def
zoom_to_center
(
self
,
factor
):
self
.
canvas
.
SetCurrent
(
self
.
context
)
x
,
y
,
_
=
self
.
mouse_to_3d
(
self
.
width
/
2
,
self
.
height
/
2
)
self
.
zoom
(
factor
,
(
x
,
y
))
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