mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Clean up start-up logging.
Most of this wasn't helpful. What was is now logging instead of print so it can be configured.
This commit is contained in:
parent
e537396fec
commit
1c4aec83cb
@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
@ -28,25 +29,25 @@ def init():
|
|||||||
global __theme_index
|
global __theme_index
|
||||||
|
|
||||||
__theme_index = DEFAULT_THEME_INDEX
|
__theme_index = DEFAULT_THEME_INDEX
|
||||||
print("init setting theme index to " + str(__theme_index))
|
|
||||||
|
|
||||||
if os.path.isfile(THEME_PREFERENCES_FILE_PATH):
|
if os.path.isfile(THEME_PREFERENCES_FILE_PATH):
|
||||||
try:
|
try:
|
||||||
with(open(THEME_PREFERENCES_FILE_PATH)) as prefs:
|
with(open(THEME_PREFERENCES_FILE_PATH)) as prefs:
|
||||||
pref_data = json.loads(prefs.read())
|
pref_data = json.loads(prefs.read())
|
||||||
__theme_index = pref_data["theme_index"]
|
__theme_index = pref_data["theme_index"]
|
||||||
print(__theme_index)
|
|
||||||
set_theme_index(__theme_index)
|
set_theme_index(__theme_index)
|
||||||
save_theme_config()
|
save_theme_config()
|
||||||
print("file setting theme index to " + str(__theme_index))
|
|
||||||
except:
|
except:
|
||||||
# is this necessary?
|
# is this necessary?
|
||||||
set_theme_index(DEFAULT_THEME_INDEX)
|
set_theme_index(DEFAULT_THEME_INDEX)
|
||||||
print("except setting theme index to " + str(__theme_index))
|
logging.exception("Unable to change theme")
|
||||||
else:
|
else:
|
||||||
# is this necessary?
|
# is this necessary?
|
||||||
set_theme_index(DEFAULT_THEME_INDEX)
|
set_theme_index(DEFAULT_THEME_INDEX)
|
||||||
print("else setting theme index to " + str(__theme_index))
|
logging.error(
|
||||||
|
f"Using default theme because {THEME_PREFERENCES_FILE_PATH} "
|
||||||
|
"does not exist"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# set theme index then use save_theme_config to save to file
|
# set theme index then use save_theme_config to save to file
|
||||||
|
|||||||
@ -111,15 +111,12 @@ EVENT_ICONS: Dict[str, QPixmap] = {}
|
|||||||
|
|
||||||
def load_event_icons():
|
def load_event_icons():
|
||||||
for image in os.listdir("./resources/ui/events/"):
|
for image in os.listdir("./resources/ui/events/"):
|
||||||
print(image)
|
|
||||||
if image.endswith(".PNG"):
|
if image.endswith(".PNG"):
|
||||||
EVENT_ICONS[image[:-4]] = QPixmap(os.path.join("./resources/ui/events/", image))
|
EVENT_ICONS[image[:-4]] = QPixmap(os.path.join("./resources/ui/events/", image))
|
||||||
|
|
||||||
def load_aircraft_icons():
|
def load_aircraft_icons():
|
||||||
for aircraft in os.listdir("./resources/ui/units/aircrafts/"):
|
for aircraft in os.listdir("./resources/ui/units/aircrafts/"):
|
||||||
print(aircraft)
|
|
||||||
if aircraft.endswith(".jpg"):
|
if aircraft.endswith(".jpg"):
|
||||||
print(aircraft[:-7] + " : " + os.path.join("./resources/ui/units/aircrafts/", aircraft) + " ")
|
|
||||||
AIRCRAFT_ICONS[aircraft[:-7]] = QPixmap(os.path.join("./resources/ui/units/aircrafts/", aircraft))
|
AIRCRAFT_ICONS[aircraft[:-7]] = QPixmap(os.path.join("./resources/ui/units/aircrafts/", aircraft))
|
||||||
AIRCRAFT_ICONS["F-16C_50"] = AIRCRAFT_ICONS["F-16C"]
|
AIRCRAFT_ICONS["F-16C_50"] = AIRCRAFT_ICONS["F-16C"]
|
||||||
AIRCRAFT_ICONS["FA-18C_hornet"] = AIRCRAFT_ICONS["FA-18C"]
|
AIRCRAFT_ICONS["FA-18C_hornet"] = AIRCRAFT_ICONS["FA-18C"]
|
||||||
@ -128,7 +125,5 @@ def load_aircraft_icons():
|
|||||||
|
|
||||||
def load_vehicle_icons():
|
def load_vehicle_icons():
|
||||||
for vehicle in os.listdir("./resources/ui/units/vehicles/"):
|
for vehicle in os.listdir("./resources/ui/units/vehicles/"):
|
||||||
print(vehicle)
|
|
||||||
if vehicle.endswith(".jpg"):
|
if vehicle.endswith(".jpg"):
|
||||||
print(vehicle[:-7] + " : " + os.path.join("./resources/ui/units/vehicles/", vehicle) + " ")
|
|
||||||
VEHICLES_ICONS[vehicle[:-7]] = QPixmap(os.path.join("./resources/ui/units/vehicles/", vehicle))
|
VEHICLES_ICONS[vehicle[:-7]] = QPixmap(os.path.join("./resources/ui/units/vehicles/", vehicle))
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from typing import Dict, List, Optional, Tuple
|
from typing import Dict, List, Optional, Tuple
|
||||||
|
|
||||||
from PySide2.QtCore import Qt
|
from PySide2.QtCore import Qt
|
||||||
@ -74,7 +75,7 @@ class QLiberationMap(QGraphicsView):
|
|||||||
|
|
||||||
def setGame(self, game: Optional[Game]):
|
def setGame(self, game: Optional[Game]):
|
||||||
self.game = game
|
self.game = game
|
||||||
print("Reloading Map Canvas")
|
logging.debug("Reloading Map Canvas")
|
||||||
if self.game is not None:
|
if self.game is not None:
|
||||||
self.reload_scene()
|
self.reload_scene()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user