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
f4d18e4d
Commit
f4d18e4d
authored
Nov 08, 2011
by
Duane Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed keypad toggle for XY controls. Defaults to off.
parent
37cdd323
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
70 deletions
+50
-70
bufferedcanvas.py
bufferedcanvas.py
+1
-1
pronterface.py
pronterface.py
+19
-38
xybuttons.py
xybuttons.py
+29
-26
zbuttons.py
zbuttons.py
+1
-5
No files found.
bufferedcanvas.py
View file @
f4d18e4d
pronterface.py
View file @
f4d18e4d
...
...
@@ -76,36 +76,14 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
ycol
=
(
180
,
180
,
255
)
zcol
=
(
180
,
255
,
180
)
self
.
cpbuttons
=
[
# [_("X+100"),("move X 100"),(2,0),xcol,(1,3)],
# [_("X+10"),("move X 10"),(3,0),xcol,(1,3)],
# [_("X+1"),("move X 1"),(4,0),xcol,(1,3)],
# [_("X+0.1"),("move X 0.1"),(5,0),xcol,(1,3)],
# [_("HomeX"),("home X"),(6,0),(205,205,78),(1,3)],
# [_("X-0.1"),("move X -0.1"),(7,0),xcol,(1,3)],
# [_("X-1"),("move X -1"),(8,0),xcol,(1,3)],
# [_("X-10"),("move X -10"),(9,0),xcol,(1,3)],
# [_("X-100"),("move X -100"),(10,0),xcol,(1,3)],
# [_("Y+100"),("move Y 100"),(2,3),ycol,(1,3)],
# [_("Y+10"),("move Y 10"),(3,3),ycol,(1,3)],
# [_("Y+1"),("move Y 1"),(4,3),ycol,(1,3)],
# [_("Y+0.1"),("move Y 0.1"),(5,3),ycol,(1,3)],
# [_("HomeY"),("home Y"),(6,3),(150,150,205),(1,3)],
# [_("Y-0.1"),("move Y -0.1"),(7,3),ycol,(1,3)],
# [_("Y-1"),("move Y -1"),(8,3),ycol,(1,3)],
# [_("Y-10"),("move Y -10"),(9,3),ycol,(1,3)],
# [_("Y-100"),("move Y -100"),(10,3),ycol,(1,3)],
# [_("Motors off"),("M84"),(2,6),(250,250,250),(1,3)],
# [_("Z+10"),("move Z 10"),(3,6),zcol,(1,3)],
# [_("Z+1"),("move Z 1"),(4,6),zcol,(1,3)],
# [_("Z+0.1"),("move Z 0.1"),(5,6),zcol,(1,3)],
# [_("HomeZ"),("home Z"),(6,6),(150,205,150),(1,3)],
# [_("Z-0.1"),("move Z -0.1"),(7,6),zcol,(1,3)],
# [_("Z-1"),("move Z -1"),(8,6),zcol,(1,3)],
# [_("Z-10"),("move Z -10"),(9,6),zcol,(1,3)],
# [_("Home"),("home"),(10,6),(250,250,250),(1,3)],
[
_
(
"Check temp"
),(
"M105"
),(
11
,
6
),(
225
,
200
,
200
),(
1
,
3
)],
[
_
(
"Extrude"
),(
"extrude"
),(
13
,
0
),(
225
,
200
,
200
),(
1
,
2
)],
[
_
(
"Reverse"
),(
"reverse"
),(
14
,
0
),(
225
,
200
,
200
),(
1
,
2
)],
[
_
(
"Home"
),(
"home"
),(
3
,
0
),(
250
,
250
,
250
),(
1
,
2
)],
[
_
(
"HomeX"
),(
"home X"
),(
3
,
2
),(
205
,
205
,
78
),(
1
,
2
)],
[
_
(
"HomeY"
),(
"home Y"
),(
3
,
4
),(
150
,
150
,
205
),(
1
,
2
)],
[
_
(
"HomeZ"
),(
"home Z"
),(
3
,
6
),(
150
,
205
,
150
),(
1
,
2
)],
[
_
(
"Motors off"
),(
"M84"
),(
3
,
8
),(
250
,
250
,
250
),(
1
,
2
)],
[
_
(
"Check temp"
),(
"M105"
),(
6
,
6
),(
225
,
200
,
200
),(
1
,
3
)],
[
_
(
"Extrude"
),(
"extrude"
),(
7
,
0
),(
225
,
200
,
200
),(
1
,
2
)],
[
_
(
"Reverse"
),(
"reverse"
),(
8
,
0
),(
225
,
200
,
200
),(
1
,
2
)],
]
self
.
custombuttons
=
[]
self
.
btndict
=
{}
...
...
@@ -388,7 +366,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
portslist
+=
[
self
.
settings
.
port
]
self
.
serialport
=
wx
.
ComboBox
(
self
.
panel
,
-
1
,
choices
=
portslist
,
style
=
wx
.
CB_DROPDOWN
|
wx
.
CB_SORT
,
pos
=
(
50
,
0
))
style
=
wx
.
CB_DROPDOWN
|
wx
.
CB_SORT
|
wx
.
CB_READONLY
,
pos
=
(
50
,
0
))
try
:
if
self
.
settings
.
port
in
scan
:
self
.
serialport
.
SetValue
(
self
.
settings
.
port
)
...
...
@@ -400,7 +378,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
uts
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
"@"
,
pos
=
(
250
,
5
)),
wx
.
RIGHT
,
5
)
self
.
baud
=
wx
.
ComboBox
(
self
.
panel
,
-
1
,
choices
=
[
"2400"
,
"9600"
,
"19200"
,
"38400"
,
"57600"
,
"115200"
],
style
=
wx
.
CB_DROPDOWN
|
wx
.
CB_SORT
,
size
=
(
110
,
30
),
pos
=
(
275
,
0
))
style
=
wx
.
CB_DROPDOWN
|
wx
.
CB_SORT
|
wx
.
CB_READONLY
,
size
=
(
110
,
30
),
pos
=
(
275
,
0
))
try
:
self
.
baud
.
SetValue
(
"115200"
)
self
.
baud
.
SetValue
(
str
(
self
.
settings
.
baudrate
))
...
...
@@ -480,8 +458,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#lls.Add((200,375))
lls
.
Add
(
XYButtons
(
self
.
panel
,
self
.
moveXY
,
self
.
home
),
pos
=
(
2
,
0
),
span
=
(
9
,
6
))
lls
.
Add
(
ZButtons
(
self
.
panel
,
self
.
moveZ
,
self
.
home
),
pos
=
(
2
,
7
),
span
=
(
9
,
2
))
xyb
=
XYButtons
(
self
.
panel
,
self
.
moveXY
)
lls
.
Add
(
xyb
,
pos
=
(
2
,
0
),
span
=
(
1
,
6
),
flag
=
wx
.
ALIGN_CENTER
)
zb
=
ZButtons
(
self
.
panel
,
self
.
moveZ
)
lls
.
Add
(
zb
,
pos
=
(
2
,
7
),
span
=
(
1
,
2
),
flag
=
wx
.
ALIGN_CENTER
)
wx
.
CallAfter
(
xyb
.
SetFocus
)
for
i
in
self
.
cpbuttons
:
btn
=
wx
.
Button
(
self
.
panel
,
-
1
,
i
[
0
])
#,size=(60,-1))
...
...
@@ -494,7 +475,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
lls
.
Add
(
btn
,
pos
=
i
[
2
],
span
=
i
[
4
])
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"Heater:"
),
pos
=
(
0
,
343
)),
pos
=
(
11
,
0
),
span
=
(
1
,
1
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"Heater:"
),
pos
=
(
0
,
343
)),
pos
=
(
4
,
0
),
span
=
(
1
,
1
))
htemp_choices
=
[
self
.
temps
[
i
]
+
" ("
+
i
+
")"
for
i
in
sorted
(
self
.
temps
.
keys
(),
key
=
lambda
x
:
self
.
temps
[
x
])]
if
self
.
settings
.
last_temperature
not
in
map
(
float
,
self
.
temps
.
values
()):
...
...
@@ -503,12 +484,12 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
choices
=
htemp_choices
,
style
=
wx
.
CB_DROPDOWN
,
size
=
(
90
,
25
),
pos
=
(
45
,
337
))
lls
.
Add
(
self
.
htemp
,
pos
=
(
11
,
1
),
span
=
(
1
,
3
))
lls
.
Add
(
self
.
htemp
,
pos
=
(
4
,
1
),
span
=
(
1
,
3
))
self
.
settbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Set"
),
size
=
(
38
,
-
1
),
pos
=
(
135
,
335
))
self
.
settbtn
.
Bind
(
wx
.
EVT_BUTTON
,
self
.
do_settemp
)
self
.
printerControls
.
append
(
self
.
settbtn
)
lls
.
Add
(
self
.
settbtn
,
pos
=
(
11
,
4
),
span
=
(
1
,
2
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"Bed:"
),
pos
=
(
0
,
343
)),
pos
=
(
12
,
0
),
span
=
(
1
,
1
))
lls
.
Add
(
self
.
settbtn
,
pos
=
(
4
,
4
),
span
=
(
1
,
2
))
lls
.
Add
(
wx
.
StaticText
(
self
.
panel
,
-
1
,
_
(
"Bed:"
),
pos
=
(
0
,
343
)),
pos
=
(
5
,
0
),
span
=
(
1
,
1
))
btemp_choices
=
[
self
.
bedtemps
[
i
]
+
" ("
+
i
+
")"
for
i
in
sorted
(
self
.
bedtemps
.
keys
(),
key
=
lambda
x
:
self
.
temps
[
x
])]
if
self
.
settings
.
last_bed_temperature
not
in
map
(
float
,
self
.
bedtemps
.
values
()):
btemp_choices
=
[
str
(
self
.
settings
.
last_bed_temperature
)]
+
btemp_choices
...
...
xybuttons.py
View file @
f4d18e4d
...
...
@@ -19,15 +19,13 @@ class XYButtons(BufferedCanvas):
concentric_circle_radii
=
[
15
,
55
,
86
,
117
,
142
]
center
=
(
166
,
164
)
def
__init__
(
self
,
parent
,
moveCallback
=
None
,
homeCallback
=
None
,
ID
=-
1
):
def
__init__
(
self
,
parent
,
moveCallback
=
None
,
ID
=-
1
):
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
=
0
self
.
orderOfMagnitudeIdx
=
0
self
.
keypad_idx
=
-
1
self
.
quadrant
=
None
self
.
concentric
=
None
self
.
moveCallback
=
moveCallback
self
.
homeCallback
=
homeCallback
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
...
...
@@ -38,9 +36,10 @@ class XYButtons(BufferedCanvas):
self
.
Bind
(
wx
.
EVT_LEFT_DCLICK
,
self
.
OnLeftDown
)
self
.
Bind
(
wx
.
EVT_MOTION
,
self
.
OnMotion
)
self
.
Bind
(
wx
.
EVT_LEAVE_WINDOW
,
self
.
OnLeaveWindow
)
parent
.
Bind
(
wx
.
EVT_CHAR_HOOK
,
self
.
onKey
)
wx
.
GetTopLevelParent
(
self
)
.
Bind
(
wx
.
EVT_CHAR_HOOK
,
self
.
onKey
)
def
onKey
(
self
,
evt
):
if
self
.
keypad_idx
>=
0
:
if
evt
.
GetKeyCode
()
==
wx
.
WXK_TAB
:
self
.
setKeypadIndex
(
self
.
rotateKeypadIndex
())
elif
evt
.
GetKeyCode
()
==
wx
.
WXK_UP
:
...
...
@@ -53,7 +52,7 @@ class XYButtons(BufferedCanvas):
self
.
quadrant
=
0
else
:
evt
.
Skip
()
return
return
False
if
self
.
moveCallback
:
self
.
concentric
=
self
.
keypad_idx
x
,
y
=
self
.
getMovement
()
...
...
@@ -134,6 +133,9 @@ class XYButtons(BufferedCanvas):
x
,
y
=
self
.
getMovement
()
if
self
.
moveCallback
:
self
.
moveCallback
(
x
,
y
)
else
:
if
self
.
keypad_idx
==
idx
:
self
.
setKeypadIndex
(
-
1
)
else
:
self
.
setKeypadIndex
(
idx
)
...
...
@@ -208,6 +210,7 @@ class XYButtons(BufferedCanvas):
if
self
.
quadrant
!=
None
and
self
.
concentric
!=
None
:
self
.
highlightQuadrant
(
dc
,
self
.
quadrant
,
self
.
concentric
)
if
self
.
keypad_idx
>=
0
:
pos
=
XYButtons
.
keypad_positions
[
self
.
keypad_idx
]
dc
.
DrawBitmap
(
self
.
keypad_bmp
,
pos
[
0
],
pos
[
1
])
...
...
zbuttons.py
View file @
f4d18e4d
...
...
@@ -13,13 +13,12 @@ class ZButtons(BufferedCanvas):
button_ydistances
=
[
8
,
30
,
56
,
84
,
118
]
center
=
(
32
,
146
)
def
__init__
(
self
,
parent
,
moveCallback
=
None
,
homeCallback
=
None
,
ID
=-
1
):
def
__init__
(
self
,
parent
,
moveCallback
=
None
,
ID
=-
1
):
self
.
bg_bmp
=
wx
.
Image
(
imagefile
(
"control_z.png"
),
wx
.
BITMAP_TYPE_PNG
)
.
ConvertToBitmap
()
self
.
range
=
None
self
.
direction
=
None
self
.
orderOfMagnitudeIdx
=
0
# 0 means '1', 1 means '10', 2 means '100', etc.
self
.
moveCallback
=
moveCallback
self
.
homeCallback
=
homeCallback
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
...
...
@@ -73,9 +72,6 @@ class ZButtons(BufferedCanvas):
value
=
math
.
pow
(
10
,
self
.
orderOfMagnitudeIdx
)
*
math
.
pow
(
10
,
r
-
1
)
*
d
if
self
.
moveCallback
:
self
.
moveCallback
(
value
)
else
:
if
self
.
homeCallback
:
self
.
homeCallback
()
def
OnLeaveWindow
(
self
,
evt
):
self
.
range
=
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