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
c1a9f8d6
Commit
c1a9f8d6
authored
Jul 15, 2012
by
Kliment Yanev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save commands entered into command box and retrieve them when up/down key is pressed.
parent
193347b6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
pronterface.py
pronterface.py
+25
-0
No files found.
pronterface.py
View file @
c1a9f8d6
...
@@ -613,6 +613,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -613,6 +613,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
commandbox
=
wx
.
TextCtrl
(
self
.
panel
,
style
=
wx
.
TE_PROCESS_ENTER
)
self
.
commandbox
=
wx
.
TextCtrl
(
self
.
panel
,
style
=
wx
.
TE_PROCESS_ENTER
)
self
.
commandbox
.
SetToolTip
(
wx
.
ToolTip
(
"Send commands to printer
\n
(Type 'help' for simple
\n
help function)"
))
self
.
commandbox
.
SetToolTip
(
wx
.
ToolTip
(
"Send commands to printer
\n
(Type 'help' for simple
\n
help function)"
))
self
.
commandbox
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
self
.
sendline
)
self
.
commandbox
.
Bind
(
wx
.
EVT_TEXT_ENTER
,
self
.
sendline
)
self
.
commandbox
.
Bind
(
wx
.
EVT_CHAR
,
self
.
cbkey
)
self
.
commandbox
.
history
=
[]
self
.
commandbox
.
histindex
=
1
#self.printerControls.append(self.commandbox)
#self.printerControls.append(self.commandbox)
lbrs
.
Add
(
self
.
commandbox
,
1
)
lbrs
.
Add
(
self
.
commandbox
,
1
)
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Send"
),
style
=
wx
.
BU_EXACTFIT
)
self
.
sendbtn
=
wx
.
Button
(
self
.
panel
,
-
1
,
_
(
"Send"
),
style
=
wx
.
BU_EXACTFIT
)
...
@@ -824,6 +827,26 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -824,6 +827,26 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
#uts.Layout()
#uts.Layout()
self
.
cbuttons_reload
()
self
.
cbuttons_reload
()
def
cbkey
(
self
,
e
):
if
e
.
GetKeyCode
()
==
wx
.
WXK_UP
:
print
self
.
commandbox
.
history
,
self
.
commandbox
.
histindex
#if len(self.commandbox.history)==0 or self.commandbox.histindex<len(self.commandbox.history)-1:
# self.commandbox.history+=[self.commandbox.GetValue()] #save current command
if
len
(
self
.
commandbox
.
history
):
self
.
commandbox
.
histindex
=
(
self
.
commandbox
.
histindex
-
1
)
%
len
(
self
.
commandbox
.
history
)
self
.
commandbox
.
SetValue
(
self
.
commandbox
.
history
[
self
.
commandbox
.
histindex
])
self
.
commandbox
.
SetSelection
(
0
,
len
(
self
.
commandbox
.
history
[
self
.
commandbox
.
histindex
]))
elif
e
.
GetKeyCode
()
==
wx
.
WXK_DOWN
:
#if len(self.commandbox.history)==0 or self.commandbox.histindex<len(self.commandbox.history)-1:
# self.commandbox.history+=[self.commandbox.GetValue()] #save current command
if
len
(
self
.
commandbox
.
history
):
self
.
commandbox
.
histindex
=
(
self
.
commandbox
.
histindex
+
1
)
%
len
(
self
.
commandbox
.
history
)
self
.
commandbox
.
SetValue
(
self
.
commandbox
.
history
[
self
.
commandbox
.
histindex
])
self
.
commandbox
.
SetSelection
(
0
,
len
(
self
.
commandbox
.
history
[
self
.
commandbox
.
histindex
]))
else
:
e
.
Skip
()
def
plate
(
self
,
e
):
def
plate
(
self
,
e
):
import
plater
import
plater
print
"plate function activated"
print
"plate function activated"
...
@@ -1293,6 +1316,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1293,6 +1316,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
webInterface
.
AppendLog
(
">>>"
+
command
+
"
\n
"
)
self
.
webInterface
.
AppendLog
(
">>>"
+
command
+
"
\n
"
)
self
.
onecmd
(
str
(
command
))
self
.
onecmd
(
str
(
command
))
self
.
commandbox
.
SetSelection
(
0
,
len
(
command
))
self
.
commandbox
.
SetSelection
(
0
,
len
(
command
))
self
.
commandbox
.
history
+=
[
command
]
self
.
commandbox
.
histindex
=
len
(
self
.
commandbox
.
history
)
-
1
def
clearOutput
(
self
,
e
):
def
clearOutput
(
self
,
e
):
self
.
logbox
.
Clear
()
self
.
logbox
.
Clear
()
...
...
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