mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
use logger in deck classes
This commit is contained in:
parent
d6b26eda21
commit
d67ccdbad2
4 changed files with 12 additions and 9 deletions
|
@ -115,7 +115,10 @@ func connect_nodes(from_node_id: String, to_node_id: String, from_output_port: i
|
|||
var type_a: DeckType.Types = from_node.get_output_ports()[from_output_port].type
|
||||
var type_b: DeckType.Types = to_node.get_input_ports()[to_input_port].type
|
||||
if !DeckType.can_convert(type_a, type_b):
|
||||
print("Can not convert from %s to %s." % [DeckType.type_str(type_a), DeckType.type_str(type_b)])
|
||||
DeckHolder.logger.log_deck(
|
||||
"Can not convert from %s to %s." % [DeckType.type_str(type_a), DeckType.type_str(type_b)],
|
||||
Logger.LogType.ERROR
|
||||
)
|
||||
return false
|
||||
|
||||
# TODO: prevent duplicate connections
|
||||
|
|
|
@ -29,7 +29,7 @@ func _init() -> void:
|
|||
dir.list_dir_begin()
|
||||
var current_file := dir.get_next()
|
||||
while current_file != "":
|
||||
print(current_file)
|
||||
#print(current_file)
|
||||
if current_file.ends_with(".gd"):
|
||||
var script_path := BASE_NODE_PATH.path_join(current_file)
|
||||
var node: DeckNode = load(script_path).new() as DeckNode
|
||||
|
@ -74,12 +74,12 @@ func save_node_index() -> void:
|
|||
func load_node_index() -> bool:
|
||||
var f := FileAccess.open(NODE_INDEX_CACHE_PATH, FileAccess.READ)
|
||||
if f == null:
|
||||
print("node index file does not exist")
|
||||
DeckHolder.logger.log_system("node index file does not exist", Logger.LogType.ERROR)
|
||||
return false
|
||||
|
||||
var data: Dictionary = JSON.parse_string(f.get_as_text()) as Dictionary
|
||||
if data.is_empty():
|
||||
print("node index file exists, but is empty")
|
||||
DeckHolder.logger.log_system("node index file exists, but is empty", Logger.LogType.ERROR)
|
||||
return false
|
||||
|
||||
for node_type in data:
|
||||
|
@ -87,7 +87,7 @@ func load_node_index() -> bool:
|
|||
var nd := NodeDescriptor.from_dictionary(nd_dict)
|
||||
nodes[node_type] = nd
|
||||
|
||||
print("node index file exists, loaded")
|
||||
DeckHolder.logger.log_system("node index file exists, loaded")
|
||||
return true
|
||||
|
||||
## Sets a specific [member DeckNode.node_type] to be a "favorite" for use in
|
||||
|
|
|
@ -22,7 +22,7 @@ static func init_namespace(name_space: String) -> bool:
|
|||
|
||||
var err := _create_namespace_folder(n)
|
||||
if err != OK:
|
||||
print("Could not create namespace: error %s" % err)
|
||||
DeckHolder.logger.log_system("Could not create namespace: error %s" % err, Logger.LogType.ERROR)
|
||||
return false
|
||||
_data[name_space] = {}
|
||||
return false
|
||||
|
@ -102,7 +102,7 @@ static func _lazy_load_channel(name_space: String, channel: String) -> void:
|
|||
var validated_name := name_space.validate_filename()
|
||||
var validated_channel := channel.validate_filename()
|
||||
if !_data.has(validated_name):
|
||||
print("Namespace %s is not initialized" % name_space)
|
||||
DeckHolder.logger.log_system("Namespace %s is not initialized" % name_space, Logger.LogType.ERROR)
|
||||
return
|
||||
|
||||
if (_data[validated_name] as Dictionary).has(validated_channel):
|
||||
|
|
|
@ -30,7 +30,7 @@ static var filters: Array[Filter] = [
|
|||
func(element: NodeDB.NodeDescriptor, _search_string: String, pre_strip_string: String) -> bool:
|
||||
const p := r"#c\s[\w]+"
|
||||
var r := RegEx.create_from_string(p)
|
||||
print("pre: ", pre_strip_string)
|
||||
#print("pre: ", pre_strip_string)
|
||||
var c := r.search(pre_strip_string).get_string().split("#c ", false)[0]
|
||||
|
||||
return c.is_subsequence_ofn(element.category),
|
||||
|
@ -39,7 +39,7 @@ static var filters: Array[Filter] = [
|
|||
const p := r"#c\s[\w]+"
|
||||
var r := RegEx.create_from_string(p)
|
||||
var c := r.search(search_string).get_string()
|
||||
prints("c:", c, "r:", search_string.replace(c, ""))
|
||||
#prints("c:", c, "r:", search_string.replace(c, ""))
|
||||
return search_string.replace(c, "")
|
||||
),
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue