mirror of
https://github.com/bkerler/mtkclient.git
synced 2024-12-03 12:46:56 -05:00
Optimize code for toolkit.py
This commit is contained in:
parent
01f593953a
commit
51d25f060e
1 changed files with 3 additions and 4 deletions
|
@ -16,8 +16,7 @@ class TimeEstim:
|
||||||
testimated = (telapsed / cur_iter) * max_iter
|
testimated = (telapsed / cur_iter) * max_iter
|
||||||
finishtime = starttime + testimated
|
finishtime = starttime + testimated
|
||||||
finishtime = dt.datetime.fromtimestamp(finishtime).strftime("%H:%M:%S") # in time
|
finishtime = dt.datetime.fromtimestamp(finishtime).strftime("%H:%M:%S") # in time
|
||||||
lefttime = testimated - telapsed # in seconds
|
return int(telapsed), int(testimated - telapsed), finishtime
|
||||||
return int(telapsed), int(lefttime), finishtime
|
|
||||||
else:
|
else:
|
||||||
return 0, 0, ""
|
return 0, 0, ""
|
||||||
|
|
||||||
|
@ -97,7 +96,7 @@ def convert_size(size_bytes):
|
||||||
i = int(math.floor(math.log(size_bytes, 1024)))
|
i = int(math.floor(math.log(size_bytes, 1024)))
|
||||||
p = math.pow(1024, i)
|
p = math.pow(1024, i)
|
||||||
s = round(size_bytes / p, 2)
|
s = round(size_bytes / p, 2)
|
||||||
return "%s %s" % (s, size_name[i])
|
return f"{s} {size_name[i]}"
|
||||||
|
|
||||||
|
|
||||||
class asyncThread(QThread):
|
class asyncThread(QThread):
|
||||||
|
@ -116,7 +115,7 @@ class asyncThread(QThread):
|
||||||
self.function(self, self.parameters)
|
self.function(self, self.parameters)
|
||||||
|
|
||||||
|
|
||||||
class FDialog():
|
class FDialog:
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
pc = pathconfig()
|
pc = pathconfig()
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
Loading…
Reference in a new issue