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
08c42443
Commit
08c42443
authored
Aug 07, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve (and fix) time displays
parent
aba88486
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
pronsole.py
pronsole.py
+2
-2
pronterface.py
pronterface.py
+10
-6
No files found.
pronsole.py
View file @
08c42443
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
import
cmd
,
sys
import
cmd
,
sys
import
glob
,
os
,
time
import
glob
,
os
,
time
,
datetime
import
sys
,
subprocess
import
sys
,
subprocess
import
math
,
codecs
import
math
,
codecs
from
math
import
sqrt
from
math
import
sqrt
...
@@ -178,7 +178,7 @@ def estimate_duration(g):
...
@@ -178,7 +178,7 @@ def estimate_duration(g):
lastf
=
f
lastf
=
f
#print "Total Duration: " #, time.strftime('%H:%M:%S', time.gmtime(totalduration))
#print "Total Duration: " #, time.strftime('%H:%M:%S', time.gmtime(totalduration))
return
"{0:d} layers, "
.
format
(
int
(
layercount
))
+
time
.
strftime
(
'
%
H:
%
M:
%
S'
,
time
.
gmtime
(
totalduration
))
return
"{0:d} layers, "
.
format
(
int
(
layercount
))
+
str
(
datetime
.
timedelta
(
seconds
=
int
(
totalduration
)
))
class
Settings
:
class
Settings
:
#def _temperature_alias(self): return {"pla":210,"abs":230,"off":0}
#def _temperature_alias(self): return {"pla":210,"abs":230,"off":0}
...
...
pronterface.py
View file @
08c42443
...
@@ -25,7 +25,7 @@ try:
...
@@ -25,7 +25,7 @@ try:
except
:
except
:
print
_
(
"WX is not installed. This program requires WX to run."
)
print
_
(
"WX is not installed. This program requires WX to run."
)
raise
raise
import
sys
,
glob
,
time
,
threading
,
traceback
,
cStringIO
,
subprocess
import
sys
,
glob
,
time
,
datetime
,
threading
,
traceback
,
cStringIO
,
subprocess
from
printrun.pronterface_widgets
import
*
from
printrun.pronterface_widgets
import
*
...
@@ -57,7 +57,10 @@ def parse_temperature_report(report, key):
...
@@ -57,7 +57,10 @@ def parse_temperature_report(report, key):
return
float
(
filter
(
lambda
x
:
x
.
startswith
(
key
),
report
.
split
())[
0
]
.
split
(
":"
)[
1
]
.
split
(
"/"
)[
0
])
return
float
(
filter
(
lambda
x
:
x
.
startswith
(
key
),
report
.
split
())[
0
]
.
split
(
":"
)[
1
]
.
split
(
"/"
)[
0
])
def
format_time
(
timestamp
):
def
format_time
(
timestamp
):
return
time
.
strftime
(
'
%
H:
%
M:
%
S'
,
timestamp
)
return
datetime
.
datetime
.
fromtimestamp
(
timestamp
)
.
strftime
(
"
%
H:
%
M:
%
S"
)
def
format_duration
(
delta
):
return
str
(
datetime
.
timedelta
(
seconds
=
int
(
delta
)))
class
Tee
(
object
):
class
Tee
(
object
):
def
__init__
(
self
,
target
):
def
__init__
(
self
,
target
):
...
@@ -188,7 +191,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -188,7 +191,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
def
endcb
(
self
):
def
endcb
(
self
):
if
(
self
.
p
.
queueindex
==
0
):
if
(
self
.
p
.
queueindex
==
0
):
print
"Print ended at: "
+
format_time
(
time
.
time
())
print
"Print ended at: "
+
format_time
(
time
.
time
())
print
"and took: "
+
format_time
(
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
))
print_duration
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
print
"and took: "
+
format_duration
(
print_duration
)
wx
.
CallAfter
(
self
.
pausebtn
.
Disable
)
wx
.
CallAfter
(
self
.
pausebtn
.
Disable
)
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
wx
.
CallAfter
(
self
.
printbtn
.
SetLabel
,
_
(
"Print"
))
...
@@ -196,7 +200,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -196,7 +200,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if
not
param
:
if
not
param
:
return
return
import
shlex
import
shlex
pararray
=
[
i
.
replace
(
"$s"
,
str
(
self
.
filename
))
.
replace
(
"$t"
,
format_
time
(
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
))
.
encode
()
for
i
in
shlex
.
split
(
param
.
replace
(
"
\\
"
,
"
\\\\
"
)
.
encode
())]
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
)
self
.
finalp
=
subprocess
.
Popen
(
pararray
,
stderr
=
subprocess
.
STDOUT
,
stdout
=
subprocess
.
PIPE
)
def
online
(
self
):
def
online
(
self
):
...
@@ -1357,8 +1361,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -1357,8 +1361,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
secondselapsed
=
int
(
time
.
time
()
-
self
.
starttime
+
self
.
extra_print_time
)
secondsestimate
=
secondselapsed
/
fractioncomplete
secondsestimate
=
secondselapsed
/
fractioncomplete
secondsremain
=
secondsestimate
-
secondselapsed
secondsremain
=
secondsestimate
-
secondselapsed
string
+=
_
(
" Est:
%
s of
%
s remaining | "
)
%
(
format_
time
(
secondsremain
),
string
+=
_
(
" Est:
%
s of
%
s remaining | "
)
%
(
format_
duration
(
secondsremain
),
format_time
(
secondsestimate
))
format_duration
(
secondsestimate
))
string
+=
_
(
" Z:
%0.2
f mm"
)
%
self
.
curlayer
string
+=
_
(
" Z:
%0.2
f mm"
)
%
self
.
curlayer
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
string
)
wx
.
CallAfter
(
self
.
status
.
SetStatusText
,
string
)
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
wx
.
CallAfter
(
self
.
gviz
.
Refresh
)
...
...
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