Damn, forgot named tuples cannot be updated. Use a class instead
This commit is contained in:
parent
9c27add968
commit
7a0fb52c83
@ -29,7 +29,13 @@ from libcalamares import *
|
|||||||
|
|
||||||
UnpackEntry = namedtuple(
|
UnpackEntry = namedtuple(
|
||||||
'UnpackEntry', ['source', 'destination'])
|
'UnpackEntry', ['source', 'destination'])
|
||||||
UnpackStatusEntry = namedtuple('UnpackStatusEntry', ['copied', 'total'])
|
|
||||||
|
class UnpackStatusEntry:
|
||||||
|
__slots__= ['copied', 'total']
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.copied = 0
|
||||||
|
self.total = 0
|
||||||
|
|
||||||
ON_POSIX = 'posix' in sys.builtin_module_names
|
ON_POSIX = 'posix' in sys.builtin_module_names
|
||||||
|
|
||||||
@ -78,8 +84,7 @@ class UnsquashOperation:
|
|||||||
self.unpacklist = unpack
|
self.unpacklist = unpack
|
||||||
self.unpackstatus = dict()
|
self.unpackstatus = dict()
|
||||||
for entry in unpack:
|
for entry in unpack:
|
||||||
self.unpackstatus[entry.source] = UnpackStatusEntry(
|
self.unpackstatus[entry.source] = UnpackStatusEntry()
|
||||||
copied=0, total=0)
|
|
||||||
|
|
||||||
def update_copy_progress(self, source, nfiles):
|
def update_copy_progress(self, source, nfiles):
|
||||||
if source in self.unpackstatus:
|
if source in self.unpackstatus:
|
||||||
|
Loading…
Reference in New Issue
Block a user