mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
30 lines
903 B
Python
30 lines
903 B
Python
from typing import Optional
|
|
|
|
from PySide6.QtWidgets import QHBoxLayout, QLabel, QComboBox
|
|
from dcs.weather import Weather as PydcsWeather, CloudPreset
|
|
|
|
from game.weather.clouds import Clouds
|
|
|
|
|
|
class DcsPrecipitationSelector(QHBoxLayout):
|
|
def __init__(self, clouds: Clouds) -> None:
|
|
super().__init__()
|
|
self.unit_changing = False
|
|
|
|
self.label = QLabel("Precipitation : ")
|
|
self.addWidget(self.label)
|
|
|
|
self.selector = QComboBox()
|
|
for p in PydcsWeather.Preceptions:
|
|
self.selector.addItem(p.name.replace("_", ""), p)
|
|
|
|
if clouds:
|
|
self.selector.setCurrentText(clouds.precipitation.name.replace("_", ""))
|
|
self.addWidget(self.selector, 1)
|
|
|
|
def update_ui(self, preset: Optional[CloudPreset]) -> None:
|
|
self.selector.setEnabled(preset is None)
|
|
|
|
if preset:
|
|
self.selector.setCurrentText("None")
|