Files
uarep-ctl/scenes/tabs-switch/tab-switch.gd
2026-01-21 09:40:43 +03:00

40 lines
1.4 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

extends TabContainer
const TAB_TOSIGNAL_NAME = {
0: 'режим_работа',
1: 'режим_контроль',
2: 'режим_журнал',
3: 'режим_эмс',
4: 'режим_эмс2',
5: 'режим_настройки' }
func on_ems2_hide_pressed(state): set_tab_hidden(4, state)
func _on_tab_changed(tab) -> void: signaller.emit_signal(TAB_TOSIGNAL_NAME[tab])
func _on_button_trenazh_toggled(toggled_mode: bool) -> void: signaller.emit_signal('режим_тренаж', toggled_mode)
func _enter_tree() -> void:
network.logger_page = $Журнал
signaller.connect('ems2_hide_pressed', on_ems2_hide_pressed)
ProjectSettings.connect('settings_changed', on_setting_changed)
func on_setting_changed():
var ext_cu = ProjectSettings.get_setting('application/config/Внешнее управление', false)
get_parent().get_node('remote_control').visible = ext_cu
apply_colors()
func apply_colors():
var is_light: bool = ProjectSettings.get_setting('application/config/Цвет темы программы', false)
var style = StyleBoxFlat.new()
if is_light:
style.bg_color = Color.DARK_GRAY
add_theme_stylebox_override('tabbar_background', style)
add_theme_stylebox_override('panel', style)
else:
style.bg_color = Color(0.12, 0.12, 0.12)
add_theme_stylebox_override('tabbar_background', style)
add_theme_stylebox_override('panel', style)