Fine-tuning some typing issues

This commit is contained in:
Raffson 2023-07-09 22:59:23 +02:00
parent 96828ef3db
commit 8f35546d84
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -1,6 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from copy import deepcopy from copy import deepcopy
from typing import Union
from PySide2 import QtWidgets, QtGui from PySide2 import QtWidgets, QtGui
from PySide2.QtCore import Qt from PySide2.QtCore import Qt
@ -28,7 +29,7 @@ class QFactionUnits(QScrollArea):
self.faction = faction self.faction = faction
self._create_checkboxes() self._create_checkboxes()
def _add_checkboxes(self, units: list, counter: int, grid: QGridLayout) -> int: def _add_checkboxes(self, units: set, counter: int, grid: QGridLayout) -> int:
counter += 1 counter += 1
for i, v in enumerate(sorted(units, key=lambda x: x.name), counter): for i, v in enumerate(sorted(units, key=lambda x: x.name), counter):
cb = QCheckBox(v.name) cb = QCheckBox(v.name)
@ -90,7 +91,7 @@ class QFactionUnits(QScrollArea):
if self.parent: if self.parent:
self.parent.update() self.parent.update()
def updateFactionUnits(self, units: list): def updateFactionUnits(self, units: Union[set, list]):
deletes = [] deletes = []
for a in units: for a in units:
if not self.checkboxes[a.name].isChecked(): if not self.checkboxes[a.name].isChecked():