Commit 7facb94c authored by Guillaume Seguin's avatar Guillaume Seguin

Move format_time and format_duration to printrun_utils

parent b0160015
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment