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
f10d6c06
Commit
f10d6c06
authored
May 03, 2012
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'spacebar' of
https://github.com/canadaduane/Printrun
into experimental
parents
3c7b5386
6071c429
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
5 deletions
+43
-5
pronterface.py
pronterface.py
+11
-2
xybuttons.py
xybuttons.py
+22
-3
zbuttons.py
zbuttons.py
+10
-0
No files found.
pronterface.py
View file @
f10d6c06
...
@@ -579,7 +579,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -579,7 +579,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
szbuttons
=
wx
.
GridBagSizer
()
szbuttons
=
wx
.
GridBagSizer
()
self
.
xyb
=
XYButtons
(
self
.
panel
,
self
.
moveXY
,
self
.
homeButtonClicked
)
self
.
xyb
=
XYButtons
(
self
.
panel
,
self
.
moveXY
,
self
.
homeButtonClicked
,
self
.
spacebarAction
)
szbuttons
.
Add
(
self
.
xyb
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALIGN_CENTER
)
szbuttons
.
Add
(
self
.
xyb
,
pos
=
(
0
,
1
),
flag
=
wx
.
ALIGN_CENTER
)
self
.
zb
=
ZButtons
(
self
.
panel
,
self
.
moveZ
)
self
.
zb
=
ZButtons
(
self
.
panel
,
self
.
moveZ
)
szbuttons
.
Add
(
self
.
zb
,
pos
=
(
0
,
2
),
flag
=
wx
.
ALIGN_CENTER
)
szbuttons
.
Add
(
self
.
zb
,
pos
=
(
0
,
2
),
flag
=
wx
.
ALIGN_CENTER
)
...
@@ -748,7 +748,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -748,7 +748,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#uts.Layout()
#uts.Layout()
self
.
cbuttons_reload
()
self
.
cbuttons_reload
()
def
plate
(
self
,
e
):
def
plate
(
self
,
e
):
import
plater
import
plater
print
"plate function activated"
print
"plate function activated"
...
@@ -1119,16 +1118,26 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1119,16 +1118,26 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
onecmd
(
'home Z'
)
self
.
onecmd
(
'home Z'
)
if
corner
==
3
:
# lower-left
if
corner
==
3
:
# lower-left
self
.
onecmd
(
'home'
)
self
.
onecmd
(
'home'
)
# When user clicks on the XY control, the Z control no longer gets spacebar/repeat signals
self
.
zb
.
clearRepeat
()
def
moveXY
(
self
,
x
,
y
):
def
moveXY
(
self
,
x
,
y
):
if
x
!=
0
:
if
x
!=
0
:
self
.
onecmd
(
'move X
%
s'
%
x
)
self
.
onecmd
(
'move X
%
s'
%
x
)
if
y
!=
0
:
if
y
!=
0
:
self
.
onecmd
(
'move Y
%
s'
%
y
)
self
.
onecmd
(
'move Y
%
s'
%
y
)
# When user clicks on the XY control, the Z control no longer gets spacebar/repeat signals
self
.
zb
.
clearRepeat
()
def
moveZ
(
self
,
z
):
def
moveZ
(
self
,
z
):
if
z
!=
0
:
if
z
!=
0
:
self
.
onecmd
(
'move Z
%
s'
%
z
)
self
.
onecmd
(
'move Z
%
s'
%
z
)
# When user clicks on the Z control, the XY control no longer gets spacebar/repeat signals
self
.
xyb
.
clearRepeat
()
def
spacebarAction
(
self
):
self
.
zb
.
repeatLast
()
self
.
xyb
.
repeatLast
()
def
procbutton
(
self
,
e
):
def
procbutton
(
self
,
e
):
try
:
try
:
...
...
xybuttons.py
View file @
f10d6c06
...
@@ -47,7 +47,7 @@ class XYButtons(BufferedCanvas):
...
@@ -47,7 +47,7 @@ class XYButtons(BufferedCanvas):
center
=
(
124
,
121
)
center
=
(
124
,
121
)
spacer
=
7
spacer
=
7
def
__init__
(
self
,
parent
,
moveCallback
=
None
,
cornerCallback
=
None
,
ID
=-
1
):
def
__init__
(
self
,
parent
,
moveCallback
=
None
,
cornerCallback
=
None
,
spacebarCallback
=
None
,
ID
=-
1
):
self
.
bg_bmp
=
wx
.
Image
(
imagefile
(
"control_xy.png"
),
wx
.
BITMAP_TYPE_PNG
)
.
ConvertToBitmap
()
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_bmp
=
wx
.
Image
(
imagefile
(
"arrow_keys.png"
),
wx
.
BITMAP_TYPE_PNG
)
.
ConvertToBitmap
()
self
.
keypad_idx
=
-
1
self
.
keypad_idx
=
-
1
...
@@ -56,7 +56,11 @@ class XYButtons(BufferedCanvas):
...
@@ -56,7 +56,11 @@ class XYButtons(BufferedCanvas):
self
.
corner
=
None
self
.
corner
=
None
self
.
moveCallback
=
moveCallback
self
.
moveCallback
=
moveCallback
self
.
cornerCallback
=
cornerCallback
self
.
cornerCallback
=
cornerCallback
self
.
spacebarCallback
=
spacebarCallback
self
.
enabled
=
False
self
.
enabled
=
False
# Remember the last clicked buttons, so we can repeat when spacebar pressed
self
.
lastMove
=
None
self
.
lastCorner
=
None
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
self
.
SetSize
(
self
.
bg_bmp
.
GetSize
())
self
.
SetSize
(
self
.
bg_bmp
.
GetSize
())
...
@@ -77,6 +81,16 @@ class XYButtons(BufferedCanvas):
...
@@ -77,6 +81,16 @@ class XYButtons(BufferedCanvas):
self
.
enabled
=
True
self
.
enabled
=
True
self
.
update
()
self
.
update
()
def
repeatLast
(
self
):
if
self
.
lastMove
:
self
.
moveCallback
(
*
self
.
lastMove
)
if
self
.
lastCorner
:
self
.
cornerCallback
(
self
.
lastCorner
)
def
clearRepeat
(
self
):
self
.
lastMove
=
None
self
.
lastCorner
=
None
def
distanceToLine
(
self
,
pos
,
x1
,
y1
,
x2
,
y2
):
def
distanceToLine
(
self
,
pos
,
x1
,
y1
,
x2
,
y2
):
xlen
=
x2
-
x1
xlen
=
x2
-
x1
ylen
=
y2
-
y1
ylen
=
y2
-
y1
...
@@ -273,8 +287,6 @@ class XYButtons(BufferedCanvas):
...
@@ -273,8 +287,6 @@ class XYButtons(BufferedCanvas):
self
.
quadrant
=
2
self
.
quadrant
=
2
elif
evt
.
GetKeyCode
()
==
wx
.
WXK_RIGHT
:
elif
evt
.
GetKeyCode
()
==
wx
.
WXK_RIGHT
:
self
.
quadrant
=
0
self
.
quadrant
=
0
elif
evt
.
GetKeyCode
()
==
wx
.
WXK_SPACE
:
pass
else
:
else
:
evt
.
Skip
()
evt
.
Skip
()
return
return
...
@@ -283,6 +295,9 @@ class XYButtons(BufferedCanvas):
...
@@ -283,6 +295,9 @@ class XYButtons(BufferedCanvas):
self
.
concentric
=
self
.
keypad_idx
self
.
concentric
=
self
.
keypad_idx
x
,
y
=
self
.
getMovement
()
x
,
y
=
self
.
getMovement
()
self
.
moveCallback
(
x
,
y
)
self
.
moveCallback
(
x
,
y
)
elif
evt
.
GetKeyCode
()
==
wx
.
WXK_SPACE
:
self
.
spacebarCallback
()
def
OnMotion
(
self
,
event
):
def
OnMotion
(
self
,
event
):
if
not
self
.
enabled
:
if
not
self
.
enabled
:
...
@@ -335,9 +350,13 @@ class XYButtons(BufferedCanvas):
...
@@ -335,9 +350,13 @@ class XYButtons(BufferedCanvas):
if
self
.
quadrant
!=
None
:
if
self
.
quadrant
!=
None
:
x
,
y
=
self
.
getMovement
()
x
,
y
=
self
.
getMovement
()
if
self
.
moveCallback
:
if
self
.
moveCallback
:
self
.
lastMove
=
(
x
,
y
)
self
.
lastCorner
=
None
self
.
moveCallback
(
x
,
y
)
self
.
moveCallback
(
x
,
y
)
elif
self
.
corner
!=
None
:
elif
self
.
corner
!=
None
:
if
self
.
cornerCallback
:
if
self
.
cornerCallback
:
self
.
lastCorner
=
self
.
corner
self
.
lastMove
=
None
self
.
cornerCallback
(
self
.
corner
)
self
.
cornerCallback
(
self
.
corner
)
else
:
else
:
if
self
.
keypad_idx
==
idx
:
if
self
.
keypad_idx
==
idx
:
...
...
zbuttons.py
View file @
f10d6c06
...
@@ -46,6 +46,8 @@ class ZButtons(BufferedCanvas):
...
@@ -46,6 +46,8 @@ class ZButtons(BufferedCanvas):
self
.
orderOfMagnitudeIdx
=
0
# 0 means '1', 1 means '10', 2 means '100', etc.
self
.
orderOfMagnitudeIdx
=
0
# 0 means '1', 1 means '10', 2 means '100', etc.
self
.
moveCallback
=
moveCallback
self
.
moveCallback
=
moveCallback
self
.
enabled
=
False
self
.
enabled
=
False
# Remember the last clicked value, so we can repeat when spacebar pressed
self
.
lastValue
=
None
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
...
@@ -65,6 +67,13 @@ class ZButtons(BufferedCanvas):
...
@@ -65,6 +67,13 @@ class ZButtons(BufferedCanvas):
self
.
enabled
=
True
self
.
enabled
=
True
self
.
update
()
self
.
update
()
def
repeatLast
(
self
):
if
self
.
lastValue
:
self
.
moveCallback
(
self
.
lastValue
)
def
clearRepeat
(
self
):
self
.
lastValue
=
None
def
lookupRange
(
self
,
ydist
):
def
lookupRange
(
self
,
ydist
):
idx
=
-
1
idx
=
-
1
for
d
in
ZButtons
.
button_ydistances
:
for
d
in
ZButtons
.
button_ydistances
:
...
@@ -143,6 +152,7 @@ class ZButtons(BufferedCanvas):
...
@@ -143,6 +152,7 @@ class ZButtons(BufferedCanvas):
if
r
>=
0
:
if
r
>=
0
:
value
=
math
.
pow
(
10
,
self
.
orderOfMagnitudeIdx
)
*
math
.
pow
(
10
,
r
-
1
)
*
d
value
=
math
.
pow
(
10
,
self
.
orderOfMagnitudeIdx
)
*
math
.
pow
(
10
,
r
-
1
)
*
d
if
self
.
moveCallback
:
if
self
.
moveCallback
:
self
.
lastValue
=
value
self
.
moveCallback
(
value
)
self
.
moveCallback
(
value
)
def
OnLeaveWindow
(
self
,
evt
):
def
OnLeaveWindow
(
self
,
evt
):
...
...
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