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
437f0699
Commit
437f0699
authored
Nov 08, 2011
by
Duane Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue with XYButtons stealing keys. Added ESC key to blur.
parent
50d340f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
pronterface.py
pronterface.py
+1
-1
xybuttons.py
xybuttons.py
+14
-2
No files found.
pronterface.py
View file @
437f0699
...
@@ -67,6 +67,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -67,6 +67,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
_
(
"Printer Interface"
),
size
=
size
);
wx
.
Frame
.
__init__
(
self
,
None
,
title
=
_
(
"Printer Interface"
),
size
=
size
);
self
.
SetIcon
(
wx
.
Icon
(
"P-face.ico"
,
wx
.
BITMAP_TYPE_ICO
))
self
.
SetIcon
(
wx
.
Icon
(
"P-face.ico"
,
wx
.
BITMAP_TYPE_ICO
))
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
size
)
self
.
panel
=
wx
.
Panel
(
self
,
-
1
,
size
=
size
)
self
.
panel
.
SetBackgroundColour
(
"white"
)
self
.
statuscheck
=
False
self
.
statuscheck
=
False
self
.
tempreport
=
""
self
.
tempreport
=
""
self
.
monitor
=
0
self
.
monitor
=
0
...
@@ -120,7 +121,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -120,7 +121,6 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
starttime
=
0
self
.
starttime
=
0
self
.
curlayer
=
0
self
.
curlayer
=
0
self
.
cur_button
=
None
self
.
cur_button
=
None
self
.
SetBackgroundColour
(
"white"
)
def
startcb
(
self
):
def
startcb
(
self
):
self
.
starttime
=
time
.
time
()
self
.
starttime
=
time
.
time
()
...
...
xybuttons.py
View file @
437f0699
...
@@ -36,8 +36,15 @@ class XYButtons(BufferedCanvas):
...
@@ -36,8 +36,15 @@ class XYButtons(BufferedCanvas):
self
.
Bind
(
wx
.
EVT_LEFT_DCLICK
,
self
.
OnLeftDown
)
self
.
Bind
(
wx
.
EVT_LEFT_DCLICK
,
self
.
OnLeftDown
)
self
.
Bind
(
wx
.
EVT_MOTION
,
self
.
OnMotion
)
self
.
Bind
(
wx
.
EVT_MOTION
,
self
.
OnMotion
)
self
.
Bind
(
wx
.
EVT_LEAVE_WINDOW
,
self
.
OnLeaveWindow
)
self
.
Bind
(
wx
.
EVT_LEAVE_WINDOW
,
self
.
OnLeaveWindow
)
wx
.
GetTopLevelParent
(
self
)
.
Bind
(
wx
.
EVT_CHAR_HOOK
,
self
.
onKey
)
self
.
Bind
(
wx
.
EVT_KEY_UP
,
self
.
onKey
)
wx
.
GetTopLevelParent
(
self
)
.
Bind
(
wx
.
EVT_CHAR_HOOK
,
self
.
onTopLevelKey
)
def
onTopLevelKey
(
self
,
evt
):
# Let user press escape on any control, and return focus here
if
evt
.
GetKeyCode
()
==
wx
.
WXK_ESCAPE
:
self
.
SetFocus
()
evt
.
Skip
()
def
onKey
(
self
,
evt
):
def
onKey
(
self
,
evt
):
if
self
.
keypad_idx
>=
0
:
if
self
.
keypad_idx
>=
0
:
if
evt
.
GetKeyCode
()
==
wx
.
WXK_TAB
:
if
evt
.
GetKeyCode
()
==
wx
.
WXK_TAB
:
...
@@ -52,11 +59,13 @@ class XYButtons(BufferedCanvas):
...
@@ -52,11 +59,13 @@ class XYButtons(BufferedCanvas):
self
.
quadrant
=
0
self
.
quadrant
=
0
else
:
else
:
evt
.
Skip
()
evt
.
Skip
()
return
False
return
if
self
.
moveCallback
:
if
self
.
moveCallback
:
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
)
evt
.
Skip
()
def
rotateKeypadIndex
(
self
):
def
rotateKeypadIndex
(
self
):
...
@@ -124,6 +133,9 @@ class XYButtons(BufferedCanvas):
...
@@ -124,6 +133,9 @@ class XYButtons(BufferedCanvas):
self
.
update
()
self
.
update
()
def
OnLeftDown
(
self
,
event
):
def
OnLeftDown
(
self
,
event
):
# Take focus when clicked so that arrow keys can control movement
self
.
SetFocus
()
mpos
=
event
.
GetPosition
()
mpos
=
event
.
GetPosition
()
idx
=
self
.
mouseOverKeypad
(
mpos
)
idx
=
self
.
mouseOverKeypad
(
mpos
)
...
...
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