diff --git a/qt_ui/liberation_theme.py b/qt_ui/liberation_theme.py index 258a8683..79714209 100644 --- a/qt_ui/liberation_theme.py +++ b/qt_ui/liberation_theme.py @@ -1,4 +1,5 @@ import json +import logging import os from typing import Dict @@ -28,25 +29,25 @@ def init(): global __theme_index __theme_index = DEFAULT_THEME_INDEX - print("init setting theme index to " + str(__theme_index)) if os.path.isfile(THEME_PREFERENCES_FILE_PATH): try: with(open(THEME_PREFERENCES_FILE_PATH)) as prefs: pref_data = json.loads(prefs.read()) __theme_index = pref_data["theme_index"] - print(__theme_index) set_theme_index(__theme_index) save_theme_config() - print("file setting theme index to " + str(__theme_index)) except: # is this necessary? set_theme_index(DEFAULT_THEME_INDEX) - print("except setting theme index to " + str(__theme_index)) + logging.exception("Unable to change theme") else: # is this necessary? 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 diff --git a/qt_ui/uiconstants.py b/qt_ui/uiconstants.py index 706ff3ab..5c97dc72 100644 --- a/qt_ui/uiconstants.py +++ b/qt_ui/uiconstants.py @@ -111,15 +111,12 @@ EVENT_ICONS: Dict[str, QPixmap] = {} def load_event_icons(): for image in os.listdir("./resources/ui/events/"): - print(image) if image.endswith(".PNG"): EVENT_ICONS[image[:-4]] = QPixmap(os.path.join("./resources/ui/events/", image)) def load_aircraft_icons(): for aircraft in os.listdir("./resources/ui/units/aircrafts/"): - print(aircraft) 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["F-16C_50"] = AIRCRAFT_ICONS["F-16C"] AIRCRAFT_ICONS["FA-18C_hornet"] = AIRCRAFT_ICONS["FA-18C"] @@ -128,7 +125,5 @@ def load_aircraft_icons(): def load_vehicle_icons(): for vehicle in os.listdir("./resources/ui/units/vehicles/"): - print(vehicle) 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)) diff --git a/qt_ui/widgets/map/QLiberationMap.py b/qt_ui/widgets/map/QLiberationMap.py index 8654a364..3d775367 100644 --- a/qt_ui/widgets/map/QLiberationMap.py +++ b/qt_ui/widgets/map/QLiberationMap.py @@ -1,3 +1,4 @@ +import logging from typing import Dict, List, Optional, Tuple from PySide2.QtCore import Qt @@ -74,7 +75,7 @@ class QLiberationMap(QGraphicsView): def setGame(self, game: Optional[Game]): self.game = game - print("Reloading Map Canvas") + logging.debug("Reloading Map Canvas") if self.game is not None: self.reload_scene()