aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Tools
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-07-22 09:54:05 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-07-22 09:54:05 +0000
commit67b53c1cb06988394c35a6e965c99b72b67fe1be (patch)
tree1761f6b70a9a6aa349a003842162672a7787c85e /lib/python/Tools
parenta507c89e5f0424b634cb13178c39c56d19945563 (diff)
downloadenigma2-67b53c1cb06988394c35a6e965c99b72b67fe1be.tar.gz
enigma2-67b53c1cb06988394c35a6e965c99b72b67fe1be.zip
cleanup some imports
Diffstat (limited to 'lib/python/Tools')
-rw-r--r--lib/python/Tools/Directories.py20
-rw-r--r--lib/python/Tools/FuzzyDate.py38
-rw-r--r--lib/python/Tools/RedirectTime.py18
-rw-r--r--lib/python/Tools/__init__.py3
4 files changed, 32 insertions, 47 deletions
diff --git a/lib/python/Tools/Directories.py b/lib/python/Tools/Directories.py
index 0a703e7c..975d3ade 100644
--- a/lib/python/Tools/Directories.py
+++ b/lib/python/Tools/Directories.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-import os
+from os import path as os_path, mkdir, system
SCOPE_TRANSPONDERDATA = 0
SCOPE_SYSETC = 1
@@ -49,7 +49,7 @@ def resolveFilename(scope, base = "", path_prefix = None):
if base[0:2] == "~/":
# you can only use the ~/ if we have a prefix directory
assert path_prefix is not None
- base = os.path.join(path_prefix, base[2:])
+ base = os_path.join(path_prefix, base[2:])
# don't resolve absolute paths
if base[0:1] == '/':
@@ -59,7 +59,7 @@ def resolveFilename(scope, base = "", path_prefix = None):
if path[1] == PATH_CREATE:
if (not pathExists(defaultPaths[scope][0])):
- os.mkdir(path[0])
+ mkdir(path[0])
#if len(base) > 0 and base[0] == '/':
#path = ("", None)
@@ -70,21 +70,21 @@ def resolveFilename(scope, base = "", path_prefix = None):
for x in fallbackPaths[scope]:
if x[1] == FILE_COPY:
if fileExists(x[0] + base):
- os.system("cp " + x[0] + base + " " + path[0] + base)
+ system("cp " + x[0] + base + " " + path[0] + base)
break
elif x[1] == FILE_MOVE:
if fileExists(x[0] + base):
- os.system("mv " + x[0] + base + " " + path[0] + base)
+ system("mv " + x[0] + base + " " + path[0] + base)
break
elif x[1] == PATH_COPY:
if pathExists(x[0]):
if not pathExists(defaultPaths[scope][0]):
- os.mkdir(path[0])
- os.system("cp -a " + x[0] + "* " + path[0])
+ mkdir(path[0])
+ system("cp -a " + x[0] + "* " + path[0])
break
elif x[1] == PATH_MOVE:
if pathExists(x[0]):
- os.system("mv " + x[0] + " " + path[0])
+ system("mv " + x[0] + " " + path[0])
break
@@ -94,11 +94,11 @@ def resolveFilename(scope, base = "", path_prefix = None):
# this is only the BASE - an extension must be added later.
def pathExists(path):
- return os.path.exists(path)
+ return os_path.exists(path)
def createDir(path):
try:
- os.mkdir(path)
+ mkdir(path)
except:
ret = 0
else:
diff --git a/lib/python/Tools/FuzzyDate.py b/lib/python/Tools/FuzzyDate.py
index dac72cf0..93990290 100644
--- a/lib/python/Tools/FuzzyDate.py
+++ b/lib/python/Tools/FuzzyDate.py
@@ -1,9 +1,9 @@
-import time
+from time import localtime, time
def FuzzyTime(t):
- d = time.localtime(t)
- nt = time.time()
- n = time.localtime()
+ d = localtime(t)
+ nt = time()
+ n = localtime()
if d[:3] == n[:3]:
# same day
@@ -22,18 +22,18 @@ def FuzzyTime(t):
return (date, timeres)
if __name__ == "__main__":
- print "now: %s %s" % FuzzyTime(time.time())
- print "1 day: %s %s" % FuzzyTime(time.time() + 86400)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *2)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *3)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *4)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *5)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *6)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *7)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *8)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *9)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *10)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *11)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *12)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *13)
- print "2 days: %s %s" % FuzzyTime(time.time() + 86400 *14)
+ print "now: %s %s" % FuzzyTime(time())
+ print "1 day: %s %s" % FuzzyTime(time() + 86400)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *2)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *3)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *4)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *5)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *6)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *7)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *8)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *9)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *10)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *11)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *12)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *13)
+ print "2 days: %s %s" % FuzzyTime(time() + 86400 *14)
diff --git a/lib/python/Tools/RedirectTime.py b/lib/python/Tools/RedirectTime.py
index 91c80022..e69de29b 100644
--- a/lib/python/Tools/RedirectTime.py
+++ b/lib/python/Tools/RedirectTime.py
@@ -1,18 +0,0 @@
-import time
-from enigma import eDVBLocalTimeHandler
-
-org_time = time.time
-time_difference = eDVBLocalTimeHandler.getInstance().difference()
-
-def myTime():
- global time_difference
- t = org_time()
- t += time_difference
- return t
-
-def timeChangedCallback():
- global time_difference
- time_difference = eDVBLocalTimeHandler.getInstance().difference()
-
-eDVBLocalTimeHandler.getInstance().m_timeUpdated.get().append(timeChangedCallback)
-time.time = myTime \ No newline at end of file
diff --git a/lib/python/Tools/__init__.py b/lib/python/Tools/__init__.py
index df8d8873..ae2e875e 100644
--- a/lib/python/Tools/__init__.py
+++ b/lib/python/Tools/__init__.py
@@ -1,2 +1,5 @@
all = ["RedirectTime.py", "FuzzyDate.py", "XMLTools.py", "Directories.py", "KeyBindings.py", "BoundFunction.py", "ISO639.py", "Notifications",
"RedirectOutput.py", "DreamboxHardware.py"]
+
+import RedirectTime
+import RedirectOutput \ No newline at end of file