2 # -*- coding: utf-8 -*-
5 ###################################################################################
7 def __init__(self
, Parent
):
11 ("TB", "Terabyte", 8796100000000.0),
12 #("Tb", "Terabit", 1099511627776.0),
13 ("GB", "Gigabyte", 8589600000.0),
14 #("Gb", "Gigabit", 1073700000.0),
15 ("MB", "Megabyte", 8388600.0),
16 #("Mb", "Megabit", 1048600.0),
17 ("kB", "Kilobyte", 8192.0),
18 #("kb", "Kilobit", 1024.0),
23 def convert(self
, amount
, unit
=False):
29 amount
= int(amount
*8)
30 #If we have correct unit selected
31 for i
, line
in enumerate(self
.dataUnits
):
33 output
= amount
/line
[2]
34 output
= "%.2f" % output
35 return minus
+""+str(output
)+""+str(line
[0])
36 #Select unit automaticly
40 for i
, line
in enumerate(self
.dataUnits
):
41 if amount
>= line
[2]/10.240407004:
42 output
= amount
/line
[2]
43 output
= "%.2f" % output
44 return minus
+""+str(output
)+""+str(line
[0])