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
b3658bfe
Commit
b3658bfe
authored
Nov 12, 2011
by
Duane Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added visual indication to highlight XY and Z increment values on mouse over
parent
4e1e71d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
4 deletions
+33
-4
xybuttons.py
xybuttons.py
+18
-3
zbuttons.py
zbuttons.py
+15
-1
No files found.
xybuttons.py
View file @
b3658bfe
...
@@ -18,6 +18,12 @@ class XYButtons(BufferedCanvas):
...
@@ -18,6 +18,12 @@ class XYButtons(BufferedCanvas):
}
}
corner_size
=
(
49
,
49
)
corner_size
=
(
49
,
49
)
corner_inset
=
(
8
,
6
)
corner_inset
=
(
8
,
6
)
label_overlay_positions
=
{
0
:
(
142
,
105
,
11
),
1
:
(
160
,
85
,
13
),
2
:
(
179
,
65
,
15
),
3
:
(
201
,
42
,
16
)
}
concentric_circle_radii
=
[
11
,
45
,
69
,
94
,
115
]
concentric_circle_radii
=
[
11
,
45
,
69
,
94
,
115
]
center
=
(
124
,
121
)
center
=
(
124
,
121
)
spacer
=
7
spacer
=
7
...
@@ -31,7 +37,7 @@ class XYButtons(BufferedCanvas):
...
@@ -31,7 +37,7 @@ class XYButtons(BufferedCanvas):
self
.
corner
=
None
self
.
corner
=
None
self
.
moveCallback
=
moveCallback
self
.
moveCallback
=
moveCallback
self
.
cornerCallback
=
cornerCallback
self
.
cornerCallback
=
cornerCallback
self
.
enabled
=
Fals
e
self
.
enabled
=
Tru
e
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
...
@@ -206,14 +212,23 @@ class XYButtons(BufferedCanvas):
...
@@ -206,14 +212,23 @@ class XYButtons(BufferedCanvas):
pos
=
XYButtons
.
keypad_positions
[
self
.
keypad_idx
]
pos
=
XYButtons
.
keypad_positions
[
self
.
keypad_idx
]
pos
=
(
pos
[
0
]
-
padw
/
2
-
3
,
pos
[
1
]
-
padh
/
2
-
3
)
pos
=
(
pos
[
0
]
-
padw
/
2
-
3
,
pos
[
1
]
-
padh
/
2
-
3
)
gc
.
DrawBitmap
(
self
.
keypad_bmp
,
pos
[
0
],
pos
[
1
],
padw
,
padh
)
gc
.
DrawBitmap
(
self
.
keypad_bmp
,
pos
[
0
],
pos
[
1
],
padw
,
padh
)
# Draw label overlays
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
255
,
255
,
255
,
128
),
1
))
gc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
255
,
255
,
255
,
128
+
64
)))
for
idx
,
kpos
in
XYButtons
.
label_overlay_positions
.
items
():
if
idx
!=
self
.
concentric
:
r
=
kpos
[
2
]
gc
.
DrawEllipse
(
kpos
[
0
]
-
r
,
kpos
[
1
]
-
r
,
r
*
2
,
r
*
2
)
else
:
else
:
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
255
,
255
,
255
,
0
),
4
))
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
255
,
255
,
255
,
0
),
4
))
gc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
255
,
255
,
255
,
128
)))
gc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
255
,
255
,
255
,
128
)))
gc
.
DrawRectangle
(
0
,
0
,
w
,
h
)
gc
.
DrawRectangle
(
0
,
0
,
w
,
h
)
# Used to check exact position of keypad dots, should we ever resize the bg image
# Used to check exact position of keypad dots, should we ever resize the bg image
# for idx, kpos in XYButtons.
keypad
_positions.items():
# for idx, kpos in XYButtons.
label_overlay
_positions.items():
# dc.DrawCircle(kpos[0], kpos[1],
6
)
# dc.DrawCircle(kpos[0], kpos[1],
kpos[2]
)
## ------ ##
## ------ ##
## Events ##
## Events ##
...
...
zbuttons.py
View file @
b3658bfe
...
@@ -12,6 +12,12 @@ def sign(n):
...
@@ -12,6 +12,12 @@ def sign(n):
class
ZButtons
(
BufferedCanvas
):
class
ZButtons
(
BufferedCanvas
):
button_ydistances
=
[
7
,
30
,
55
,
83
,
112
]
button_ydistances
=
[
7
,
30
,
55
,
83
,
112
]
center
=
(
30
,
118
)
center
=
(
30
,
118
)
label_overlay_positions
=
{
0
:
(
1
,
18
,
11
),
1
:
(
1
,
41
,
13
),
2
:
(
1
,
67
,
15
),
3
:
None
}
def
__init__
(
self
,
parent
,
moveCallback
=
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
.
bg_bmp
=
wx
.
Image
(
imagefile
(
"control_z.png"
),
wx
.
BITMAP_TYPE_PNG
)
.
ConvertToBitmap
()
...
@@ -74,9 +80,17 @@ class ZButtons(BufferedCanvas):
...
@@ -74,9 +80,17 @@ class ZButtons(BufferedCanvas):
gc
.
DrawBitmap
(
self
.
bg_bmp
,
0
,
0
,
w
,
h
)
gc
.
DrawBitmap
(
self
.
bg_bmp
,
0
,
0
,
w
,
h
)
if
self
.
enabled
:
if
self
.
enabled
:
# Draw label overlays
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
255
,
255
,
255
,
128
),
1
))
gc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
255
,
255
,
255
,
128
+
64
)))
for
idx
,
kpos
in
ZButtons
.
label_overlay_positions
.
items
():
if
kpos
and
idx
!=
self
.
range
:
r
=
kpos
[
2
]
gc
.
DrawEllipse
(
ZButtons
.
center
[
0
]
-
kpos
[
0
]
-
r
,
ZButtons
.
center
[
1
]
-
kpos
[
1
]
-
r
,
r
*
2
,
r
*
2
)
# Top 'layer' is the mouse-over highlights
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
100
,
100
,
100
,
172
),
4
))
gc
.
SetPen
(
wx
.
Pen
(
wx
.
Colour
(
100
,
100
,
100
,
172
),
4
))
gc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
0
,
0
,
0
,
128
)))
gc
.
SetBrush
(
wx
.
Brush
(
wx
.
Colour
(
0
,
0
,
0
,
128
)))
if
self
.
range
!=
None
and
self
.
direction
!=
None
:
if
self
.
range
!=
None
and
self
.
direction
!=
None
:
self
.
highlight
(
gc
,
self
.
range
,
self
.
direction
)
self
.
highlight
(
gc
,
self
.
range
,
self
.
direction
)
else
:
else
:
...
...
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