Remove support for deprecated theme item names

This commit is contained in:
Leroy Hopson 2022-08-26 12:30:07 +12:00
parent 7e65be4cf9
commit b2f190d29a
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
4 changed files with 2 additions and 75 deletions

View file

@ -175,43 +175,15 @@ func _update_theme():
# inheritance to work we can pass through the theme variables manually. # inheritance to work we can pass through the theme variables manually.
for color in _default_theme.get_color_list("Terminal"): for color in _default_theme.get_color_list("Terminal"):
var c: Color var c: Color
var deprecated_color: String = color.replace("bright", "light").replace("_", " ").capitalize()
match deprecated_color:
"White":
deprecated_color = "Light Grey"
"Light Black":
deprecated_color = "Dark Grey"
"Light White":
deprecated_color = "White"
if has_color(color, "Terminal"): if has_color(color, "Terminal"):
c = get_color(color, "Terminal") c = get_color(color, "Terminal")
elif has_color(deprecated_color, "Terminal"):
push_warning(
(
"Color name '%s' is deprecated and will be removed it a future version. Use the name '%s' instead."
% [deprecated_color, color]
)
)
c = get_color(deprecated_color, "Terminal")
else: else:
c = _default_theme.get_color(color, "Terminal") c = _default_theme.get_color(color, "Terminal")
_native_terminal.add_color_override(color, c) _native_terminal.add_color_override(color, c)
for font in _default_theme.get_font_list("Terminal"): for font in _default_theme.get_font_list("Terminal"):
var f: Font var f: Font
var deprecated_font: String = font.replace("_", " ").capitalize()
if has_font(font, "Terminal"): if has_font(font, "Terminal"):
f = get_font(font, "Terminal") f = get_font(font, "Terminal")
elif has_font(deprecated_font, "Terminal"):
push_warning(
(
"Font name '%s' is deprecated and will be removed in a future version. Use the name '%s' instead."
% [deprecated_font, font]
)
)
f = get_font(deprecated_font, "Terminal")
elif has_font("regular", "Terminal"): elif has_font("regular", "Terminal"):
f = get_font("regular", "Terminal") f = get_font("regular", "Terminal")
else: else:

View file

@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased](https://github.com/lihop/godot-xterm/compare/v2.2.0...HEAD) ## [Unreleased](https://github.com/lihop/godot-xterm/compare/v2.2.0...HEAD)
### Removed
- Removed support for deprecated theme item names.
## [v2.2.0](https://github.com/lihop/godot-xterm/compare/v2.1.1...v2.2.0) - 2022-08-26 ## [v2.2.0](https://github.com/lihop/godot-xterm/compare/v2.1.1...v2.2.0) - 2022-08-26

View file

@ -1,28 +0,0 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://addons/godot_xterm/themes/fonts/regular.tres" type="DynamicFont" id=4]
[resource]
default_font = ExtResource( 4 )
Terminal/colors/Background = Color( 0.921569, 0.921569, 0.921569, 1 )
Terminal/colors/Black = Color( 0, 0, 0, 1 )
Terminal/colors/Blue = Color( 0.239216, 0.392157, 0.866667, 1 )
Terminal/colors/Cyan = Color( 0, 0.65098, 0.729412, 1 )
"Terminal/colors/Dark Grey" = Color( 0.25098, 0.25098, 0.25098, 1 )
Terminal/colors/Foreground = Color( 0.25098, 0.25098, 0.25098, 1 )
Terminal/colors/Green = Color( 0, 0.380392, 0.188235, 1 )
"Terminal/colors/Light Blue" = Color( 0.160784, 0.545098, 1, 1 )
"Terminal/colors/Light Cyan" = Color( 0.133333, 0.8, 1, 1 )
"Terminal/colors/Light Green" = Color( 0, 0.760784, 0.380392, 1 )
"Terminal/colors/Light Grey" = Color( 0.898039, 0.898039, 0.898039, 1 )
"Terminal/colors/Light Magenta" = Color( 0.658824, 0.364706, 0.913725, 1 )
"Terminal/colors/Light Red" = Color( 1, 0.439216, 0.521569, 1 )
"Terminal/colors/Light Yellow" = Color( 1, 0.866667, 0.396078, 1 )
Terminal/colors/Magenta = Color( 0.439216, 0.164706, 1, 1 )
Terminal/colors/Red = Color( 0.74902, 0.352941, 0.313726, 1 )
Terminal/colors/White = Color( 1, 1, 1, 1 )
Terminal/colors/Yellow = Color( 0.698039, 0.572549, 0.0627451, 1 )
Terminal/fonts/Bold = null
"Terminal/fonts/Bold Italic" = null
Terminal/fonts/Italic = null
Terminal/fonts/Regular = ExtResource( 4 )

View file

@ -69,11 +69,6 @@ class TestTheme:
var terminal: Terminal var terminal: Terminal
# Current themes don't work with Godot 3.5. So skip tests on this version.
static func _version_gt_3_4() -> bool:
var version := Engine.get_version_info()
return version.major > 3 or (version.major == 3 and version.minor > 4)
func _get_pixelv(src: Vector2) -> Color: func _get_pixelv(src: Vector2) -> Color:
var screen := get_tree().root.get_texture().get_data() var screen := get_tree().root.get_texture().get_data()
screen.lock() screen.lock()
@ -159,17 +154,3 @@ class TestTheme:
terminal.theme = default_theme terminal.theme = default_theme
yield(yield_to(terminal, "theme_changed", 5), YIELD) yield(yield_to(terminal, "theme_changed", 5), YIELD)
_check_colors(default_theme) _check_colors(default_theme)
func test_deprecated_theme_item_names_continue_to_work_until_removed():
# This test can be removed after support for deperacted theme item names is removed.
# Not applicable to version 3.5 as deprecated theme can't be imported in that version.
var version := Engine.get_version_info()
if version.major > 3 or (version.major == 3 and version.minor >= 5):
return
var deprecated_theme := preload("../files/deprecated_theme.tres")
terminal.theme = deprecated_theme
yield(yield_to(terminal, "theme_changed", 5), YIELD)
add_child(terminal)
yield(yield_to(terminal, "theme_changed", 5), YIELD)
_check_colors(alt_theme)