QModList: implement removing mods
This commit is contained in:
parent
cf8e77d844
commit
a2789b1704
1 changed files with 13 additions and 0 deletions
|
|
@ -48,3 +48,16 @@ class QModListModel(QAbstractListModel):
|
|||
else:
|
||||
result = None
|
||||
return result
|
||||
|
||||
def removeRows(self, row, count, parent=QModelIndex()) -> bool:
|
||||
super().beginRemoveRows(parent, row, row + count - 1)
|
||||
for index in range(row, row + count):
|
||||
deleted_mod: QMod = self.mods.pop(index)
|
||||
for root, dirs, files in deleted_mod.pathlib_path.walk(top_down=False):
|
||||
for name in files:
|
||||
(root / name).unlink()
|
||||
for name in dirs:
|
||||
(root / name).rmdir()
|
||||
deleted_mod.pathlib_path.rmdir()
|
||||
super().endRemoveRows()
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue