dcs-retribution/qt_ui/widgets/clientslots.py
Dan Albert 2a75d14e0e Revert upgrade to pyside6.
This appears to be incompatible with pyinstaller. I get the following
when trying to run the executable generated with pyside6:

```
Traceback (most recent call last):
  File "qt_ui\main.py", line 29, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
  File "qt_ui\windows\QLiberationWindow.py", line 28, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 476, in exec_module
  File "qt_ui\widgets\map\QLiberationMap.py", line 11, in <module>
ImportError: could not import module 'PySide6.QtPrintSupport'
```
2021-11-21 17:39:43 -08:00

32 lines
1019 B
Python

"""Widgets for displaying client slots."""
from PySide2.QtWidgets import QLabel
from qt_ui.models import AtoModel
from qt_ui.widgets.QLabeledWidget import QLabeledWidget
class MaxPlayerCount(QLabeledWidget):
def __init__(self, ato_model: AtoModel) -> None:
self.ato_model = ato_model
self.slots_label = QLabel(str(self.count_client_slots))
self.ato_model.client_slots_changed.connect(self.update_count)
super().__init__(
"Max Players:",
self.slots_label,
(
"Total number of client slots. To add client slots, edit a flight "
"using the panel on the left."
),
)
@property
def count_client_slots(self) -> int:
slots = 0
for package in self.ato_model.packages:
for flight in package.flights:
slots += flight.client_count
return slots
def update_count(self) -> None:
self.slots_label.setText(str(self.count_client_slots))