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
7facb94c
Commit
7facb94c
authored
Sep 19, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move format_time and format_duration to printrun_utils
parent
b0160015
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
printrun_utils.py
printrun/printrun_utils.py
+7
-0
pronterface.py
printrun/pronterface.py
+1
-8
No files found.
printrun/printrun_utils.py
View file @
7facb94c
...
...
@@ -16,6 +16,7 @@
import
os
import
sys
import
gettext
import
datetime
# Set up Internationalization using gettext
# searching for installed locales on /usr/share; uses relative folder if not
...
...
@@ -77,6 +78,12 @@ def decode_utf8(s):
pass
return
s
def
format_time
(
timestamp
):
return
datetime
.
datetime
.
fromtimestamp
(
timestamp
)
.
strftime
(
"
%
H:
%
M:
%
S"
)
def
format_duration
(
delta
):
return
str
(
datetime
.
timedelta
(
seconds
=
int
(
delta
)))
class
RemainingTimeEstimator
(
object
):
drift
=
None
...
...
printrun/pronterface.py
View file @
7facb94c
...
...
@@ -20,7 +20,6 @@ import Queue
import
re
import
sys
import
time
import
datetime
import
threading
import
traceback
import
cStringIO
as
StringIO
...
...
@@ -49,7 +48,7 @@ layerindex = 0
if
os
.
name
==
"nt"
:
winsize
=
(
800
,
530
)
from
printrun.printrun_utils
import
iconfile
,
configfile
from
printrun.printrun_utils
import
iconfile
,
configfile
,
format_time
,
format_duration
from
printrun.gui
import
MainWindow
from
printrun.excluder
import
Excluder
from
pronsole
import
dosify
,
wxSetting
,
HiddenSetting
,
StringSetting
,
SpinSetting
,
FloatSpinSetting
,
BooleanSetting
,
StaticTextSetting
...
...
@@ -61,12 +60,6 @@ def parse_temperature_report(report):
matches
=
tempreport_exp
.
findall
(
report
)
return
dict
((
m
[
0
],
(
m
[
1
],
m
[
2
]))
for
m
in
matches
)
def
format_time
(
timestamp
):
return
datetime
.
datetime
.
fromtimestamp
(
timestamp
)
.
strftime
(
"
%
H:
%
M:
%
S"
)
def
format_duration
(
delta
):
return
str
(
datetime
.
timedelta
(
seconds
=
int
(
delta
)))
class
Tee
(
object
):
def
__init__
(
self
,
target
):
self
.
stdout
=
sys
.
stdout
...
...
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