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
44ceb6ff
Commit
44ceb6ff
authored
Nov 03, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP #575: improve // actions behavior in pronsole
parent
122631bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
printcore.py
printrun/printcore.py
+10
-9
pronsole.py
printrun/pronsole.py
+6
-0
No files found.
printrun/printcore.py
View file @
44ceb6ff
...
@@ -19,7 +19,7 @@ __version__ = "2014.08.01"
...
@@ -19,7 +19,7 @@ __version__ = "2014.08.01"
from
serial
import
Serial
,
SerialException
,
PARITY_ODD
,
PARITY_NONE
from
serial
import
Serial
,
SerialException
,
PARITY_ODD
,
PARITY_NONE
from
select
import
error
as
SelectError
from
select
import
error
as
SelectError
from
threading
import
Thread
,
Lock
import
threading
from
Queue
import
Queue
,
Empty
as
QueueEmpty
from
Queue
import
Queue
,
Empty
as
QueueEmpty
import
time
import
time
import
platform
import
platform
...
@@ -44,7 +44,7 @@ def locked(f):
...
@@ -44,7 +44,7 @@ def locked(f):
def
inner
(
*
args
,
**
kw
):
def
inner
(
*
args
,
**
kw
):
with
inner
.
lock
:
with
inner
.
lock
:
return
f
(
*
args
,
**
kw
)
return
f
(
*
args
,
**
kw
)
inner
.
lock
=
Lock
()
inner
.
lock
=
threading
.
Lock
()
return
inner
return
inner
def
control_ttyhup
(
port
,
disable_hup
):
def
control_ttyhup
(
port
,
disable_hup
):
...
@@ -126,7 +126,8 @@ class printcore():
...
@@ -126,7 +126,8 @@ class printcore():
if
self
.
printer
:
if
self
.
printer
:
if
self
.
read_thread
:
if
self
.
read_thread
:
self
.
stop_read_thread
=
True
self
.
stop_read_thread
=
True
self
.
read_thread
.
join
()
if
threading
.
current_thread
()
!=
self
.
read_thread
:
self
.
read_thread
.
join
()
self
.
read_thread
=
None
self
.
read_thread
=
None
if
self
.
print_thread
:
if
self
.
print_thread
:
self
.
printing
=
False
self
.
printing
=
False
...
@@ -205,7 +206,7 @@ class printcore():
...
@@ -205,7 +206,7 @@ class printcore():
self
.
printer
=
None
self
.
printer
=
None
return
return
self
.
stop_read_thread
=
False
self
.
stop_read_thread
=
False
self
.
read_thread
=
Thread
(
target
=
self
.
_listen
)
self
.
read_thread
=
threading
.
Thread
(
target
=
self
.
_listen
)
self
.
read_thread
.
start
()
self
.
read_thread
.
start
()
self
.
_start_sender
()
self
.
_start_sender
()
...
@@ -328,7 +329,7 @@ class printcore():
...
@@ -328,7 +329,7 @@ class printcore():
def
_start_sender
(
self
):
def
_start_sender
(
self
):
self
.
stop_send_thread
=
False
self
.
stop_send_thread
=
False
self
.
send_thread
=
Thread
(
target
=
self
.
_sender
)
self
.
send_thread
=
threading
.
Thread
(
target
=
self
.
_sender
)
self
.
send_thread
.
start
()
self
.
send_thread
.
start
()
def
_stop_sender
(
self
):
def
_stop_sender
(
self
):
...
@@ -371,8 +372,8 @@ class printcore():
...
@@ -371,8 +372,8 @@ class printcore():
return
True
return
True
self
.
clear
=
False
self
.
clear
=
False
resuming
=
(
startindex
!=
0
)
resuming
=
(
startindex
!=
0
)
self
.
print_thread
=
Thread
(
target
=
self
.
_print
,
self
.
print_thread
=
threading
.
Thread
(
target
=
self
.
_print
,
kwargs
=
{
"resuming"
:
resuming
})
kwargs
=
{
"resuming"
:
resuming
})
self
.
print_thread
.
start
()
self
.
print_thread
.
start
()
return
True
return
True
...
@@ -451,8 +452,8 @@ class printcore():
...
@@ -451,8 +452,8 @@ class printcore():
self
.
paused
=
False
self
.
paused
=
False
self
.
printing
=
True
self
.
printing
=
True
self
.
print_thread
=
Thread
(
target
=
self
.
_print
,
self
.
print_thread
=
threading
.
Thread
(
target
=
self
.
_print
,
kwargs
=
{
"resuming"
:
True
})
kwargs
=
{
"resuming"
:
True
})
self
.
print_thread
.
start
()
self
.
print_thread
.
start
()
def
send
(
self
,
command
,
wait
=
0
):
def
send
(
self
,
command
,
wait
=
0
):
...
...
printrun/pronsole.py
View file @
44ceb6ff
...
@@ -1233,12 +1233,18 @@ class pronsole(cmd.Cmd):
...
@@ -1233,12 +1233,18 @@ class pronsole(cmd.Cmd):
command
=
command
[
1
]
command
=
command
[
1
]
if
command
==
"pause"
:
if
command
==
"pause"
:
self
.
do_pause
(
None
)
self
.
do_pause
(
None
)
sys
.
stdout
.
write
(
self
.
promptf
())
sys
.
stdout
.
flush
()
return
True
return
True
elif
command
==
"resume"
:
elif
command
==
"resume"
:
self
.
do_resume
(
None
)
self
.
do_resume
(
None
)
sys
.
stdout
.
write
(
self
.
promptf
())
sys
.
stdout
.
flush
()
return
True
return
True
elif
command
==
"disconnect"
:
elif
command
==
"disconnect"
:
self
.
do_disconnect
(
None
)
self
.
do_disconnect
(
None
)
sys
.
stdout
.
write
(
self
.
promptf
())
sys
.
stdout
.
flush
()
return
True
return
True
return
False
return
False
...
...
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