Remove the userdata package.

This commit is contained in:
Dan Albert 2020-10-03 13:34:40 -07:00
parent 60ce6658ad
commit 5f1601a2da
17 changed files with 78 additions and 76 deletions

View File

@ -1,25 +1,13 @@
import typing
import logging
from dcs.action import Coalition
from dcs.unittype import UnitType
from dcs.task import *
from dcs.vehicles import AirDefence
from dcs.unittype import UnitType from dcs.unittype import UnitType
from game import * from game import *
from game import persistency
from game.debriefing import Debriefing
from game.infos.information import Information from game.infos.information import Information
from theater import *
from gen.environmentgen import EnvironmentSettings from gen.environmentgen import EnvironmentSettings
from gen.conflictgen import Conflict from theater import *
from game.db import assigned_units_from, unitdict_from
from theater.start_generator import generate_airbase_defense_group from theater.start_generator import generate_airbase_defense_group
from userdata.debriefing import Debriefing
from userdata import persistency
import game.db as db
DIFFICULTY_LOG_BASE = 1.1 DIFFICULTY_LOG_BASE = 1.1
EVENT_DEPARTURE_MAX_DISTANCE = 340000 EVENT_DEPARTURE_MAX_DISTANCE = 340000
@ -28,6 +16,7 @@ MINOR_DEFEAT_INFLUENCE = 0.1
DEFEAT_INFLUENCE = 0.3 DEFEAT_INFLUENCE = 0.3
STRONG_DEFEAT_INFLUENCE = 0.5 STRONG_DEFEAT_INFLUENCE = 0.5
class Event: class Event:
silent = False silent = False
informational = False informational = False

View File

@ -1,6 +1,6 @@
from game.event import * from game.event import *
from game.operation.frontlineattack import FrontlineAttackOperation from game.operation.frontlineattack import FrontlineAttackOperation
from userdata.debriefing import Debriefing from ..debriefing import Debriefing
class FrontlineAttackEvent(Event): class FrontlineAttackEvent(Event):

View File

@ -4,6 +4,7 @@ from game.db import REWARDS, PLAYER_BUDGET_BASE, sys
from game.inventory import GlobalAircraftInventory from game.inventory import GlobalAircraftInventory
from game.models.game_stats import GameStats from game.models.game_stats import GameStats
from gen.ato import AirTaskingOrder from gen.ato import AirTaskingOrder
from gen.conflictgen import Conflict
from gen.flights.ai_flight_planner import CoalitionMissionPlanner from gen.flights.ai_flight_planner import CoalitionMissionPlanner
from gen.flights.closestairfields import ObjectiveDistanceCache from gen.flights.closestairfields import ObjectiveDistanceCache
from gen.ground_forces.ai_ground_planner import GroundPlanner from gen.ground_forces.ai_ground_planner import GroundPlanner

View File

@ -8,7 +8,7 @@ from gen.tacan import TacanRegistry
from dcs.countries import country_dict from dcs.countries import country_dict
from dcs.lua.parse import loads from dcs.lua.parse import loads
from dcs.terrain.terrain import Terrain from dcs.terrain.terrain import Terrain
from userdata.debriefing import * from ..debriefing import Debriefing
class Operation: class Operation:

View File

@ -4,13 +4,14 @@ from shutil import copyfile
import dcs import dcs
from userdata import persistency from game import persistency
global __dcs_saved_game_directory global __dcs_saved_game_directory
global __dcs_installation_directory global __dcs_installation_directory
PREFERENCES_FILE_PATH = "liberation_preferences.json" PREFERENCES_FILE_PATH = "liberation_preferences.json"
def init(): def init():
global __dcs_saved_game_directory global __dcs_saved_game_directory
global __dcs_installation_directory global __dcs_installation_directory

View File

@ -1,7 +1,6 @@
import json import json
import os import os
from typing import Dict
import qt_ui.uiconstants as CONST
global __theme_index global __theme_index
@ -10,6 +9,21 @@ THEME_PREFERENCES_FILE_PATH = "liberation_theme.json"
DEFAULT_THEME_INDEX = 1 DEFAULT_THEME_INDEX = 1
# new themes can be added here
THEMES: Dict[int, Dict[str, str]] = {
0: {'themeName': 'Vanilla',
'themeFile': 'windows-style.css',
'themeIcons': 'medium',
},
1: {'themeName': 'DCS World',
'themeFile': 'style-dcs.css',
'themeIcons': 'light',
},
}
def init(): def init():
global __theme_index global __theme_index
@ -49,19 +63,19 @@ def get_theme_index():
# get theme name based on current index # get theme name based on current index
def get_theme_name(): def get_theme_name():
theme_name = CONST.THEMES[get_theme_index()]['themeName'] theme_name = THEMES[get_theme_index()]['themeName']
return theme_name return theme_name
# get theme icon sub-folder name based on current index # get theme icon sub-folder name based on current index
def get_theme_icons(): def get_theme_icons():
theme_icons = CONST.THEMES[get_theme_index()]['themeIcons'] theme_icons = THEMES[get_theme_index()]['themeIcons']
return str(theme_icons) return str(theme_icons)
# get theme stylesheet css based on current index # get theme stylesheet css based on current index
def get_theme_css_file(): def get_theme_css_file():
theme_file = CONST.THEMES[get_theme_index()]['themeFile'] theme_file = THEMES[get_theme_index()]['themeFile']
return str(theme_file) return str(theme_file)

View File

@ -1,5 +1,3 @@
from userdata import logging_config
import logging import logging
import os import os
import sys import sys
@ -9,11 +7,17 @@ from PySide2 import QtWidgets
from PySide2.QtGui import QPixmap from PySide2.QtGui import QPixmap
from PySide2.QtWidgets import QApplication, QSplashScreen from PySide2.QtWidgets import QApplication, QSplashScreen
from qt_ui import uiconstants from game import persistency
from qt_ui import (
liberation_install,
liberation_theme,
logging_config,
uiconstants,
)
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
from qt_ui.windows.QLiberationWindow import QLiberationWindow from qt_ui.windows.QLiberationWindow import QLiberationWindow
from qt_ui.windows.preferences.QLiberationFirstStartWindow import QLiberationFirstStartWindow from qt_ui.windows.preferences.QLiberationFirstStartWindow import \
from userdata import liberation_install, persistency, liberation_theme QLiberationFirstStartWindow
# Logging setup # Logging setup
logging_config.init_logging(uiconstants.VERSION_STRING) logging_config.init_logging(uiconstants.VERSION_STRING)

View File

@ -1,12 +1,10 @@
# URL for UI links
import os import os
from typing import Dict from typing import Dict
from PySide2.QtGui import QColor, QFont, QPixmap from PySide2.QtGui import QColor, QFont, QPixmap
from game.event import UnitsDeliveryEvent, FrontlineAttackEvent
from theater.theatergroundobject import CATEGORY_MAP from theater.theatergroundobject import CATEGORY_MAP
from userdata.liberation_theme import get_theme_icons from .liberation_theme import get_theme_icons
VERSION_STRING = "2.1.4" VERSION_STRING = "2.1.4"
@ -28,20 +26,6 @@ FONT_PRIMARY_I = QFont(FONT_NAME, FONT_SIZE, weight=5, italic=True)
FONT_PRIMARY_B = QFont(FONT_NAME, FONT_SIZE, weight=75, italic=False) FONT_PRIMARY_B = QFont(FONT_NAME, FONT_SIZE, weight=75, italic=False)
FONT_MAP = QFont(FONT_NAME, 10, weight=75, italic=False) FONT_MAP = QFont(FONT_NAME, 10, weight=75, italic=False)
# new themes can be added here
THEMES: Dict[int, Dict[str, str]] = {
0: {'themeName': 'Vanilla',
'themeFile': 'windows-style.css',
'themeIcons': 'medium',
},
1: {'themeName': 'DCS World',
'themeFile': 'style-dcs.css',
'themeIcons': 'light',
},
}
COLORS: Dict[str, QColor] = { COLORS: Dict[str, QColor] = {
"white": QColor(255, 255, 255), "white": QColor(255, 255, 255),
"white_transparent": QColor(255, 255, 255, 35), "white_transparent": QColor(255, 255, 255, 35),

View File

@ -1,8 +1,15 @@
from PySide2.QtGui import QIcon, QPixmap from PySide2.QtGui import QIcon, QPixmap
from PySide2.QtWidgets import QLabel, QDialog, QVBoxLayout, QGroupBox, QGridLayout, QPushButton from PySide2.QtWidgets import (
QDialog,
QGridLayout,
QGroupBox,
QLabel,
QPushButton,
QVBoxLayout,
)
from game.game import Event, db, Game from game.debriefing import Debriefing
from userdata.debriefing import Debriefing from game.game import Event, Game, db
class QDebriefingWindow(QDialog): class QDebriefingWindow(QDialog):

View File

@ -17,8 +17,7 @@ from PySide2.QtWidgets import (
) )
import qt_ui.uiconstants as CONST import qt_ui.uiconstants as CONST
from game import Game from game import Game, persistency
from game.inventory import GlobalAircraftInventory
from qt_ui.dialogs import Dialog from qt_ui.dialogs import Dialog
from qt_ui.models import GameModel from qt_ui.models import GameModel
from qt_ui.uiconstants import URLS from qt_ui.uiconstants import URLS
@ -31,7 +30,6 @@ from qt_ui.windows.infos.QInfoPanel import QInfoPanel
from qt_ui.windows.newgame.QNewGameWizard import NewGameWizard from qt_ui.windows.newgame.QNewGameWizard import NewGameWizard
from qt_ui.windows.preferences.QLiberationPreferencesWindow import \ from qt_ui.windows.preferences.QLiberationPreferencesWindow import \
QLiberationPreferencesWindow QLiberationPreferencesWindow
from userdata import persistency
class QLiberationWindow(QMainWindow): class QLiberationWindow(QMainWindow):

View File

@ -2,15 +2,24 @@ import json
import os import os
from PySide2 import QtCore from PySide2 import QtCore
from PySide2.QtCore import QObject, Signal, Qt from PySide2.QtCore import QObject, Qt, Signal
from PySide2.QtGui import QMovie, QIcon, QPixmap from PySide2.QtGui import QIcon, QMovie, QPixmap
from PySide2.QtWidgets import QLabel, QDialog, QGroupBox, QGridLayout, QPushButton, QFileDialog, QMessageBox, QTextEdit, \ from PySide2.QtWidgets import (
QHBoxLayout QDialog,
QFileDialog,
QGridLayout,
QGroupBox,
QHBoxLayout,
QLabel,
QMessageBox,
QPushButton,
QTextEdit,
)
from game.debriefing import Debriefing, wait_for_debriefing
from game.game import Event, Game, logging from game.game import Event, Game, logging
from game.persistency import base_path
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
from userdata.debriefing import wait_for_debriefing, Debriefing
from userdata.persistency import base_path
class DebriefingFileWrittenSignal(QObject): class DebriefingFileWrittenSignal(QObject):

View File

@ -1,16 +1,21 @@
import os import os
from PySide2 import QtWidgets
from PySide2.QtCore import QFile
from PySide2.QtGui import Qt from PySide2.QtGui import Qt
from PySide2.QtWidgets import QFrame, QLineEdit, QGridLayout, QVBoxLayout, QLabel, QPushButton, \ from PySide2.QtWidgets import (
QFileDialog, QMessageBox, QDialog, QComboBox, QApplication QComboBox,
import qt_ui.uiconstants as CONST QFileDialog,
import sys QFrame,
QGridLayout,
QLabel,
QLineEdit,
QMessageBox,
QPushButton,
QVBoxLayout,
)
import userdata import qt_ui.uiconstants as CONST
from userdata import liberation_install, liberation_theme from qt_ui import liberation_install, liberation_theme
from userdata.liberation_theme import get_theme_index, set_theme_index from qt_ui.liberation_theme import get_theme_index, set_theme_index
class QLiberationPreferences(QFrame): class QLiberationPreferences(QFrame):

View File

View File

@ -1,10 +0,0 @@
class RunningMissionState:
killed_aircrafts = []
killed_ground_units = []
weapons_fired = []
def __init__(self):
pass