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
a6f3ec75
Commit
a6f3ec75
authored
Nov 08, 2011
by
Duane Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated XY controls to have 4 rings. Removed 'home' button.
parent
15c980cf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
9 deletions
+21
-9
control_xy.png
images/control_xy.png
+0
-0
control_z.png
images/control_z.png
+0
-0
xybuttons.py
xybuttons.py
+20
-8
zbuttons.py
zbuttons.py
+1
-1
No files found.
images/control_xy.png
View replaced file @
15c980cf
View file @
a6f3ec75
44.1 KB
|
W:
|
H:
56.5 KB
|
W:
|
H:
2-up
Swipe
Onion skin
images/control_z.png
View replaced file @
15c980cf
View file @
a6f3ec75
9.43 KB
|
W:
|
H:
10.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
xybuttons.py
View file @
a6f3ec75
...
...
@@ -15,8 +15,8 @@ class XYButtons(BufferedCanvas):
1
:
(
78
,
86
),
2
:
(
49
,
58
)
}
concentric_circle_radii
=
[
1
7
,
45
,
83
,
12
2
]
center
=
(
1
46
,
149
)
concentric_circle_radii
=
[
1
5
,
55
,
86
,
117
,
14
2
]
center
=
(
1
66
,
164
)
distance
=
[
# Order of Magnitude 0 (i.e. 0.1, 1, 10)
[
...
...
@@ -54,7 +54,7 @@ class XYButtons(BufferedCanvas):
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
self
.
SetSize
(
wx
.
Size
(
297
,
297
))
self
.
SetSize
(
wx
.
Size
(
335
,
328
))
# Set up mouse and keyboard event capture
self
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
self
.
OnLeftDown
)
...
...
@@ -96,7 +96,7 @@ class XYButtons(BufferedCanvas):
if
radius
<
r
:
return
idx
idx
+=
1
return
2
return
None
def
setKeypadIndex
(
self
,
idx
):
self
.
keypad_idx
=
idx
...
...
@@ -131,11 +131,16 @@ class XYButtons(BufferedCanvas):
mpos
=
event
.
GetPosition
()
idx
=
self
.
mouseOverKeypad
(
mpos
)
self
.
quadrant
=
None
self
.
concentric
=
None
if
idx
!=
None
:
self
.
quadrant
=
None
self
.
concentric
=
-
1
else
:
self
.
quadrant
,
self
.
concentric
=
self
.
getQuadrantConcentricFromPosition
(
mpos
)
center
=
wx
.
Point
(
XYButtons
.
center
[
0
],
XYButtons
.
center
[
1
])
riseDist
=
self
.
distanceToLine
(
mpos
,
center
.
x
-
1
,
center
.
y
-
1
,
center
.
x
+
1
,
center
.
y
+
1
)
fallDist
=
self
.
distanceToLine
(
mpos
,
center
.
x
-
1
,
center
.
y
+
1
,
center
.
x
+
1
,
center
.
y
-
1
)
if
riseDist
>
10
and
fallDist
>
10
:
self
.
quadrant
,
self
.
concentric
=
self
.
getQuadrantConcentricFromPosition
(
mpos
)
if
oldq
!=
self
.
quadrant
or
oldc
!=
self
.
concentric
:
self
.
update
()
...
...
@@ -185,13 +190,20 @@ class XYButtons(BufferedCanvas):
center
.
y
+
r2
*
math
.
sin
(
angle1
+
i
*
angle_inc
))
for
i
in
range
(
parts
,
0
,
-
1
)])
dc
.
DrawPolygon
(
points
)
def
distanceToLine
(
self
,
pos
,
x1
,
y1
,
x2
,
y2
):
xlen
=
x2
-
x1
ylen
=
y2
-
y1
pxlen
=
x1
-
pos
.
x
pylen
=
y1
-
pos
.
y
return
abs
(
xlen
*
pylen
-
ylen
*
pxlen
)
/
math
.
sqrt
(
xlen
**
2
+
ylen
**
2
)
def
highlightQuadrant
(
self
,
dc
,
quadrant
,
concentric
):
assert
(
quadrant
>=
0
and
quadrant
<=
3
)
assert
(
concentric
>=
0
and
concentric
<=
2
)
assert
(
concentric
>=
0
and
concentric
<=
3
)
inner_ring_radius
=
XYButtons
.
concentric_circle_radii
[
0
]
# fudge = math.pi*0.002
fudge
=
0
fudge
=
-
0.02
center
=
wx
.
Point
(
XYButtons
.
center
[
0
],
XYButtons
.
center
[
1
])
if
quadrant
==
0
:
a1
,
a2
=
(
-
math
.
pi
*
0.25
,
math
.
pi
*
0.25
)
...
...
zbuttons.py
View file @
a6f3ec75
...
...
@@ -23,7 +23,7 @@ class ZButtons(BufferedCanvas):
BufferedCanvas
.
__init__
(
self
,
parent
,
ID
)
self
.
SetSize
(
wx
.
Size
(
71
,
297
))
self
.
SetSize
(
wx
.
Size
(
84
,
295
))
# Set up mouse and keyboard event capture
self
.
Bind
(
wx
.
EVT_LEFT_DOWN
,
self
.
OnLeftDown
)
...
...
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