Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions autoortho/aoconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class AOConfig(object):
simheaven_compat = False
# Using custom generated Ortho4XP tiles along with AutoOrtho.
using_custom_tiles = False
# Color used for missing textures.
missing_color = [66, 77, 55]

[pydds]
# ISPC or STB for dds file compression
Expand Down
76 changes: 74 additions & 2 deletions autoortho/config_ui_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
QTabWidget, QPushButton, QLabel, QLineEdit, QCheckBox, QComboBox,
QSlider, QTextEdit, QFileDialog, QMessageBox, QScrollArea,
QSplashScreen, QGroupBox, QProgressBar, QStatusBar, QFrame, QSpinBox
QSplashScreen, QGroupBox, QProgressBar, QStatusBar, QFrame, QSpinBox,
QColorDialog
)
from PySide6.QtCore import (
Qt, QThread, Signal, QTimer, QSize
)
from PySide6.QtGui import (
QPixmap, QIcon
QPixmap, QIcon, QColor
)

import downloader
Expand Down Expand Up @@ -995,6 +996,35 @@ def refresh_settings_tab(self):
threads_layout.addStretch()
autoortho_layout.addLayout(threads_layout)

missing_color_layout = QHBoxLayout()
missing_color_layout.setSpacing(10)
missing_color_label = QLabel("Missing Tile Color:")
missing_color_label.setToolTip(
"This is the solid color used to fill a texture when\n"
"scenery data cannot be fetched. It can be useful to\n"
"set this to a more visible color when tuning the maxwait\n"
"setting to make it easier to see missing textures."
)
self.missing_color_button = StyledButton("Select")
self.missing_color = QColor(
self.cfg.autoortho.missing_color[0],
self.cfg.autoortho.missing_color[1],
self.cfg.autoortho.missing_color[2],
)
self.update_missing_color_button()
self.missing_color_button.clicked.connect(self.show_missing_color_dialog)

self.reset_color_button = StyledButton("Reset")
self.reset_color_button.setToolTip(
"Reset the missing texture color to the default gray."
)
self.reset_color_button.clicked.connect(self.reset_missing_color)
missing_color_layout.addWidget(missing_color_label)
missing_color_layout.addWidget(self.missing_color_button)
missing_color_layout.addWidget(self.reset_color_button)
missing_color_layout.addStretch()
autoortho_layout.addLayout(missing_color_layout)

if self.cfg.autoortho.using_custom_tiles:
self.info_label = QLabel(
"Note: You are using custom tiles. Max zoom near airports setting is incompatible with custom tiles, all tiles will be capped to the general max zoom level you set.\n\n"
Expand Down Expand Up @@ -1203,6 +1233,45 @@ def refresh_settings_tab(self):

self.settings_layout.addStretch()

def show_missing_color_dialog(self):
color = QColorDialog.getColor(
self.missing_color, self, "Select missing tile color"
)
if color.isValid():
self.missing_color = color
self.update_missing_color_button()

def _get_missing_color_style(self):
return f"""
QPushButton {{
background-color: {self.missing_color.name()};
color: white;
border: 1px solid #555;
padding: 6px 12px;
border-radius: 4px;
font-size: 13px;
}}
QPushButton:hover {{
background-color: #4A4A4A;
border-color: #1d71d1;
}}
QPushButton:pressed {{
background-color: #2A2A2A;
}}
QPushButton:disabled {{
background-color: #2A2A2A;
color: #666;
border-color: #333;
}}
"""

def update_missing_color_button(self):
self.missing_color_button.setStyleSheet(self._get_missing_color_style())

def reset_missing_color(self):
self.missing_color = QColor(66, 77, 55)
self.update_missing_color_button()

def refresh_scenery_list(self):
"""Refresh the scenery list display"""
# Clear existing widgets
Expand Down Expand Up @@ -1740,6 +1809,9 @@ def save_config(self):
self.cfg.autoortho.fetch_threads = str(
self.fetch_threads_spinbox.value()
)
self.cfg.autoortho.missing_color = [self.missing_color.red(),
self.missing_color.green(),
self.missing_color.blue()]

# DDS settings
if not self.system == "darwin":
Expand Down
10 changes: 9 additions & 1 deletion autoortho/getortho.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,15 @@ def get_img(self, mipmap, startrow=0, endrow=None, maxwait=5, min_zoom=None):

log.debug(f"GET_IMG: Create new image: Zoom: {zoom} | {(img_width, img_height)}")

new_im = AoImage.new('RGBA', (img_width, img_height), (66,77,55))
new_im = AoImage.new(
"RGBA",
(img_width, img_height),
(
CFG.autoortho.missing_color[0],
CFG.autoortho.missing_color[1],
CFG.autoortho.missing_color[2],
),
)

log.debug(f"GET_IMG: Will use image {new_im}")

Expand Down
Loading