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
64326315
Commit
64326315
authored
May 24, 2013
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use page up and page down keys to move Z axis if keyboard mode for XY is selected.
parent
c3e50ed5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
gui.py
printrun/gui.py
+1
-1
xybuttons.py
printrun/xybuttons.py
+19
-8
No files found.
printrun/gui.py
View file @
64326315
...
...
@@ -48,7 +48,7 @@ class XYZControlsSizer(wx.GridBagSizer):
def
__init__
(
self
,
root
):
super
(
XYZControlsSizer
,
self
)
.
__init__
()
root
.
xyb
=
XYButtons
(
root
.
panel
,
root
.
moveXY
,
root
.
homeButtonClicked
,
root
.
spacebarAction
,
root
.
settings
.
bgcolor
)
root
.
xyb
=
XYButtons
(
root
.
panel
,
root
.
moveXY
,
root
.
homeButtonClicked
,
root
.
spacebarAction
,
root
.
settings
.
bgcolor
,
zcallback
=
root
.
moveZ
)
self
.
Add
(
root
.
xyb
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALIGN_CENTER
)
root
.
zb
=
ZButtons
(
root
.
panel
,
root
.
moveZ
,
root
.
settings
.
bgcolor
)
self
.
Add
(
root
.
zb
,
pos
=
(
0
,
2
),
flag
=
wx
.
ALIGN_CENTER
)
...
...
printrun/xybuttons.py
View file @
64326315
...
...
@@ -41,7 +41,7 @@ class XYButtons(BufferedCanvas):
center
=
(
124
,
121
)
spacer
=
7
def
__init__
(
self
,
parent
,
moveCallback
=
None
,
cornerCallback
=
None
,
spacebarCallback
=
None
,
bgcolor
=
"#FFFFFF"
,
ID
=-
1
):
def
__init__
(
self
,
parent
,
moveCallback
=
None
,
cornerCallback
=
None
,
spacebarCallback
=
None
,
bgcolor
=
"#FFFFFF"
,
ID
=-
1
,
zcallback
=
None
):
self
.
bg_bmp
=
wx
.
Image
(
imagefile
(
"control_xy.png"
),
wx
.
BITMAP_TYPE_PNG
)
.
ConvertToBitmap
()
self
.
keypad_bmp
=
wx
.
Image
(
imagefile
(
"arrow_keys.png"
),
wx
.
BITMAP_TYPE_PNG
)
.
ConvertToBitmap
()
self
.
keypad_idx
=
-
1
...
...
@@ -51,6 +51,7 @@ class XYButtons(BufferedCanvas):
self
.
moveCallback
=
moveCallback
self
.
cornerCallback
=
cornerCallback
self
.
spacebarCallback
=
spacebarCallback
self
.
zCallback
=
zcallback
self
.
enabled
=
False
# Remember the last clicked buttons, so we can repeat when spacebar pressed
self
.
lastMove
=
None
...
...
@@ -108,10 +109,13 @@ class XYButtons(BufferedCanvas):
self
.
update
()
def
getMovement
(
self
):
xdir
=
[
1
,
0
,
-
1
,
0
][
self
.
quadrant
]
ydir
=
[
0
,
1
,
0
,
-
1
][
self
.
quadrant
]
xdir
=
[
1
,
0
,
-
1
,
0
,
0
,
0
][
self
.
quadrant
]
ydir
=
[
0
,
1
,
0
,
-
1
,
0
,
0
][
self
.
quadrant
]
zdir
=
[
0
,
0
,
0
,
0
,
1
,
-
1
][
self
.
quadrant
]
magnitude
=
math
.
pow
(
10
,
self
.
concentric
-
1
)
return
(
magnitude
*
xdir
,
magnitude
*
ydir
)
if
not
zdir
==
0
:
magnitude
=
min
(
magnitude
,
10
)
return
(
magnitude
*
xdir
,
magnitude
*
ydir
,
magnitude
*
zdir
)
def
lookupConcentric
(
self
,
radius
):
idx
=
0
...
...
@@ -285,14 +289,21 @@ class XYButtons(BufferedCanvas):
self
.
quadrant
=
2
elif
evt
.
GetKeyCode
()
==
wx
.
WXK_RIGHT
:
self
.
quadrant
=
0
elif
evt
.
GetKeyCode
()
==
wx
.
WXK_PAGEUP
:
self
.
quadrant
=
4
elif
evt
.
GetKeyCode
()
==
wx
.
WXK_PAGEDOWN
:
self
.
quadrant
=
5
else
:
evt
.
Skip
()
return
self
.
concentric
=
self
.
keypad_idx
x
,
y
,
z
=
self
.
getMovement
()
if
self
.
moveCallback
:
self
.
concentric
=
self
.
keypad_idx
x
,
y
=
self
.
getMovement
()
if
x
!=
0
or
y
!=
0
and
self
.
moveCallback
:
self
.
moveCallback
(
x
,
y
)
if
z
!=
0
and
self
.
zCallback
:
self
.
zCallback
(
z
)
elif
evt
.
GetKeyCode
()
==
wx
.
WXK_SPACE
:
self
.
spacebarCallback
()
...
...
@@ -346,7 +357,7 @@ class XYButtons(BufferedCanvas):
if
self
.
concentric
!=
None
:
if
self
.
concentric
<
len
(
XYButtons
.
concentric_circle_radii
):
if
self
.
quadrant
!=
None
:
x
,
y
=
self
.
getMovement
()
x
,
y
,
z
=
self
.
getMovement
()
if
self
.
moveCallback
:
self
.
lastMove
=
(
x
,
y
)
self
.
lastCorner
=
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