mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix exception when changing campaigns
Calling setCurrentText with an Enum will obviously cause issues...
This commit is contained in:
parent
7e6a6cc61a
commit
28deb36f2c
@ -2,6 +2,7 @@ import json
|
||||
import logging
|
||||
import textwrap
|
||||
import zipfile
|
||||
from enum import Enum
|
||||
from typing import Callable, Optional, Dict
|
||||
|
||||
from PySide2 import QtWidgets
|
||||
@ -237,7 +238,14 @@ class AutoSettingsLayout(QGridLayout):
|
||||
if isinstance(widget, QCheckBox):
|
||||
widget.setChecked(value)
|
||||
elif isinstance(widget, QComboBox):
|
||||
widget.setCurrentText(description.text_for_value(value))
|
||||
if isinstance(value, Enum):
|
||||
widget.setCurrentText(value.value)
|
||||
elif isinstance(value, str):
|
||||
widget.setCurrentText(value)
|
||||
else:
|
||||
logging.error(
|
||||
f"Incompatible type '{type(value)}' for ComboBox option {name}"
|
||||
)
|
||||
elif isinstance(widget, FloatSpinSlider):
|
||||
widget.spinner.setValue(int(value * widget.spinner.divisor))
|
||||
elif isinstance(widget, QSpinBox):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user