Silence some useless generation warnings.

This commit is contained in:
Dan Albert 2021-11-21 13:52:44 -08:00
parent acd63fdeac
commit f3bf9c0c3c
2 changed files with 28 additions and 17 deletions

View File

@ -487,7 +487,12 @@ REFUELING_CAPABALE = [
def dcs_types_for_task(task: FlightType) -> Sequence[Type[FlyingType]]: def dcs_types_for_task(task: FlightType) -> Sequence[Type[FlyingType]]:
cap_missions = (FlightType.BARCAP, FlightType.TARCAP, FlightType.SWEEP) cap_missions = (
FlightType.BARCAP,
FlightType.INTERCEPTION,
FlightType.SWEEP,
FlightType.TARCAP,
)
if task in cap_missions: if task in cap_missions:
return CAP_CAPABLE return CAP_CAPABLE
elif task == FlightType.ANTISHIP: elif task == FlightType.ANTISHIP:
@ -530,8 +535,11 @@ def aircraft_for_task(task: FlightType) -> list[AircraftType]:
def tasks_for_aircraft(aircraft: AircraftType) -> list[FlightType]: def tasks_for_aircraft(aircraft: AircraftType) -> list[FlightType]:
tasks = [] tasks: list[FlightType] = []
for task in FlightType: for task in FlightType:
if task is FlightType.FERRY:
# Not a plannable task, so skip it.
continue
if aircraft in aircraft_for_task(task): if aircraft in aircraft_for_task(task):
tasks.append(task) tasks.append(task)
return tasks return tasks

View File

@ -1,36 +1,36 @@
from typing import Optional, Callable, Iterable from typing import Callable, Iterable, Optional
from PySide6.QtCore import ( from PySide6.QtCore import (
QItemSelection,
QItemSelectionModel, QItemSelectionModel,
QModelIndex, QModelIndex,
QSize, QSize,
Qt, Qt,
QItemSelection,
Signal, Signal,
) )
from PySide6.QtGui import QStandardItemModel, QStandardItem, QIcon from PySide6.QtGui import QIcon, QStandardItem, QStandardItemModel
from PySide6.QtWidgets import ( from PySide6.QtWidgets import (
QDialog,
QListView,
QVBoxLayout,
QGroupBox,
QLabel,
QWidget,
QScrollArea,
QLineEdit,
QTextEdit,
QCheckBox, QCheckBox,
QComboBox,
QDialog,
QGroupBox,
QHBoxLayout, QHBoxLayout,
QLabel,
QLineEdit,
QListView,
QScrollArea,
QStackedLayout, QStackedLayout,
QTabWidget, QTabWidget,
QComboBox, QTextEdit,
QVBoxLayout,
QWidget,
) )
from game import Game from game import Game
from game.ato.flighttype import FlightType
from game.dcs.aircrafttype import AircraftType from game.dcs.aircrafttype import AircraftType
from game.squadrons import AirWing, Pilot, Squadron from game.squadrons import AirWing, Pilot, Squadron
from game.theater import ControlPoint, ConflictTheater from game.theater import ConflictTheater, ControlPoint
from game.ato.flighttype import FlightType
from qt_ui.uiconstants import AIRCRAFT_ICONS from qt_ui.uiconstants import AIRCRAFT_ICONS
@ -49,6 +49,9 @@ class AllowedMissionTypeControls(QVBoxLayout):
return callback return callback
for task in FlightType: for task in FlightType:
if task is FlightType.FERRY:
# Not plannable so just skip it.
continue
enabled = task in squadron.mission_types enabled = task in squadron.mission_types
if enabled: if enabled:
self.allowed_mission_types.add(task) self.allowed_mission_types.add(task)