2023-03-18 16:34:12 +01:00
|
|
|
# corelog.gd
|
|
|
|
# CORE Log
|
|
|
|
#
|
|
|
|
# This file is part of StarOpenSource CORE (SOSCORE)
|
|
|
|
# Made by the StarOpenSource Project and Contributers
|
|
|
|
# Licensed under GNU GPLv3
|
|
|
|
extends RichTextLabel
|
|
|
|
|
|
|
|
var log_first = true
|
|
|
|
var log_prefix = ""
|
|
|
|
var log_suffix = ""
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
# Enable recieving of log messages
|
|
|
|
Logger.connect("logevent",Callable(self,"logevent"))
|
|
|
|
# Disable VScrollBar functionality & visibility
|
|
|
|
get_child(0,true).add_theme_stylebox_override("grabber",StyleBoxEmpty.new())
|
|
|
|
get_child(0,true).add_theme_stylebox_override("grabber_highlight",StyleBoxEmpty.new())
|
|
|
|
get_child(0,true).add_theme_stylebox_override("grabber_pressed",StyleBoxEmpty.new())
|
|
|
|
get_child(0,true).add_theme_stylebox_override("scroll",StyleBoxEmpty.new())
|
|
|
|
get_child(0,true).add_theme_stylebox_override("scroll_focus",StyleBoxEmpty.new())
|
2023-03-19 13:14:30 +01:00
|
|
|
get_child(0,true).set_deferred("size",Vector2i(0,0))
|
2023-03-18 16:34:12 +01:00
|
|
|
get_child(0,true).mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
# Make RichTextLabel ignore all mouse events (to disable scrolling)
|
|
|
|
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
2023-05-30 02:44:10 +02:00
|
|
|
func _process(_delta):
|
|
|
|
var windowsize = DisplayServer.window_get_size()
|
|
|
|
$".".size = windowsize
|
|
|
|
get_parent().size = windowsize
|
|
|
|
get_parent().get_parent().size = windowsize
|
|
|
|
|
2023-03-18 16:34:12 +01:00
|
|
|
func logevent(_type:String,_script:String,_message:String,logcomp:String) -> void:
|
|
|
|
# Appends log to RichTextLabel
|
|
|
|
if log_first:
|
|
|
|
log_first = false
|
|
|
|
text = text + log_prefix + logcomp + log_suffix
|
|
|
|
else:
|
|
|
|
text = text + "\n" + log_prefix + logcomp + log_suffix
|
|
|
|
|
|
|
|
func rmconnect() -> void:
|
|
|
|
# Disables recieving of log messages
|
|
|
|
Logger.disconnect("logevent",Callable(self,"logevent"))
|