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
4e8c0188
Commit
4e8c0188
authored
Sep 19, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move startcb and endcb to pronsole
parent
7facb94c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
19 deletions
+29
-19
pronsole.py
printrun/pronsole.py
+26
-1
pronterface.py
printrun/pronterface.py
+3
-18
No files found.
printrun/pronsole.py
View file @
4e8c0188
...
...
@@ -28,7 +28,7 @@ import locale
import
logging
from
.
import
printcore
from
printrun.printrun_utils
import
install_locale
from
printrun.printrun_utils
import
install_locale
,
format_time
,
format_duration
install_locale
(
'pronterface'
)
from
printrun
import
gcoder
...
...
@@ -361,6 +361,8 @@ class pronsole(cmd.Cmd):
self
.
dynamic_temp
=
False
self
.
p
=
printcore
.
printcore
()
self
.
p
.
recvcb
=
self
.
recvcb
self
.
p
.
startcb
=
self
.
startcb
self
.
p
.
endcb
=
self
.
endcb
self
.
recvlisteners
=
[]
self
.
in_macro
=
False
self
.
p
.
onlinecb
=
self
.
online
...
...
@@ -384,6 +386,8 @@ class pronsole(cmd.Cmd):
self
.
settings
.
_bedtemp_abs_cb
=
self
.
set_temp_preset
self
.
settings
.
_bedtemp_pla_cb
=
self
.
set_temp_preset
self
.
monitoring
=
0
self
.
starttime
=
0
self
.
extra_print_time
=
0
self
.
silent
=
False
self
.
commandprefixes
=
'MGT$'
self
.
promptstrs
=
{
"offline"
:
"
%(bold)
suninitialized>
%(normal)
s "
,
...
...
@@ -1049,6 +1053,27 @@ class pronsole(cmd.Cmd):
for
i
in
self
.
recvlisteners
:
i
(
l
)
def
startcb
(
self
,
resuming
=
False
):
self
.
starttime
=
time
.
time
()
if
resuming
:
print
_
(
"Print resumed at:
%
s"
)
%
format_time
(
self
.
starttime
)
else
:
print
_
(
"Print started at:
%
s"
)
%
format_time
(
self
.
starttime
)
def
endcb
(
self
):
if
self
.
p
.
queueindex
==
0
:
print_duration
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
print
_
(
"Print ended at:
%(end_time)
s and took
%(duration)
s"
)
%
{
"end_time"
:
format_time
(
time
.
time
()),
"duration"
:
format_duration
(
print_duration
)}
self
.
p
.
runSmallScript
(
self
.
endScript
)
param
=
self
.
settings
.
final_command
if
not
param
:
return
pararray
=
[
i
.
replace
(
"$s"
,
str
(
self
.
filename
))
.
replace
(
"$t"
,
format_duration
(
print_duration
))
.
encode
()
for
i
in
shlex
.
split
(
param
.
replace
(
"
\\
"
,
"
\\\\
"
)
.
encode
())]
self
.
finalp
=
subprocess
.
Popen
(
pararray
,
stderr
=
subprocess
.
STDOUT
,
stdout
=
subprocess
.
PIPE
)
def
help_shell
(
self
):
self
.
log
(
"Executes a python command. Example:"
)
self
.
log
(
"! os.listdir('.')"
)
...
...
printrun/pronterface.py
View file @
4e8c0188
...
...
@@ -316,8 +316,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
p
.
startcb
=
self
.
startcb
self
.
p
.
endcb
=
self
.
endcb
self
.
compute_eta
=
None
self
.
starttime
=
0
self
.
extra_print_time
=
0
self
.
curlayer
=
0
self
.
cur_button
=
None
self
.
predisconnect_mainqueue
=
None
...
...
@@ -341,31 +339,18 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self
.
autoconnect
=
args
.
autoconnect
def
startcb
(
self
,
resuming
=
False
):
self
.
starttime
=
time
.
time
()
if
resuming
:
print
_
(
"Print resumed at:
%
s"
)
%
format_time
(
self
.
starttime
)
else
:
print
_
(
"Print started at:
%
s"
)
%
format_time
(
self
.
starttime
)
pronsole
.
pronsole
.
startcb
(
self
,
resuming
)
if
not
resuming
:
self
.
compute_eta
=
RemainingTimeEstimator
(
self
.
fgcode
)
if
self
.
settings
.
lockbox
and
self
.
settings
.
lockonstart
:
wx
.
CallAfter
(
self
.
lock
,
force
=
True
)
def
endcb
(
self
):
pronsole
.
pronsole
.
endcb
(
self
)
if
self
.
p
.
queueindex
==
0
:
print_duration
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
print
_
(
"Print ended at:
%(end_time)
s and took
%(duration)
s"
)
%
{
"end_time"
:
format_time
(
time
.
time
()),
"duration"
:
format_duration
(
print_duration
)}
wx
.
CallAfter
(
self
.
pausebtn
.
Disable
)
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
self
.
p
.
runSmallScript
(
self
.
endScript
)
param
=
self
.
settings
.
final_command
if
not
param
:
return
pararray
=
[
i
.
replace
(
"$s"
,
str
(
self
.
filename
))
.
replace
(
"$t"
,
format_duration
(
print_duration
))
.
encode
()
for
i
in
shlex
.
split
(
param
.
replace
(
"
\\
"
,
"
\\\\
"
)
.
encode
())]
self
.
finalp
=
subprocess
.
Popen
(
pararray
,
stderr
=
subprocess
.
STDOUT
,
stdout
=
subprocess
.
PIPE
)
def
online
(
self
):
print
_
(
"Printer is now online."
)
wx
.
CallAfter
(
self
.
online_gui
)
...
...
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