|
|
|
@ -13,13 +13,18 @@ var root_tree
|
|
|
|
|
onready var Tree = $Panel/Tree
|
|
|
|
|
onready var ConsoleDisplay = $ConsolePanel/RichTextLabel
|
|
|
|
|
|
|
|
|
|
var color_delete = Color(0.9,0.2,0.2,0.6)
|
|
|
|
|
var color_installed = Color(0.7, 0.7,0.2,0.5)
|
|
|
|
|
var color_toinstall = Color(0.5,1,0.5,1)
|
|
|
|
|
|
|
|
|
|
func get_installed_packages():
|
|
|
|
|
var buffer = []
|
|
|
|
|
installed_packages = []
|
|
|
|
|
# warning-ignore:return_value_discarded
|
|
|
|
|
OS.execute("pkg_info", [], true, buffer, true)
|
|
|
|
|
for p in buffer[0].split("\n"):
|
|
|
|
|
installed_packages.append(p.split(" ")[0])
|
|
|
|
|
if buffer:
|
|
|
|
|
for p in buffer[0].split("\n"):
|
|
|
|
|
installed_packages.append(p.split(" ")[0])
|
|
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
|
get_installed_packages()
|
|
|
|
@ -62,18 +67,16 @@ func _on_Tree_multi_selected():
|
|
|
|
|
packages.erase(item.get_text(0))
|
|
|
|
|
elif not status: # we install it
|
|
|
|
|
packages.append(item.get_text(0))
|
|
|
|
|
item.set_custom_bg_color(0, Color(0.5,1,0.5,1))
|
|
|
|
|
item.set_custom_bg_color(0, color_toinstall)
|
|
|
|
|
item.set_metadata(0, "for_install")
|
|
|
|
|
elif status == "installed": # we delete it
|
|
|
|
|
packages_to_delete.append(item.get_text(0))
|
|
|
|
|
item.set_custom_bg_color(0, Color(0.9,0.2,0.2,0.6))
|
|
|
|
|
item.set_custom_bg_color(0, color_delete)
|
|
|
|
|
item.set_metadata(0, "to_delete")
|
|
|
|
|
elif status == "to_delete": # we keep it
|
|
|
|
|
packages_to_delete.erase(item.get_text(0))
|
|
|
|
|
item.set_custom_bg_color(0, Color(0.7, 0.7,0.2,0.5))
|
|
|
|
|
item.set_custom_bg_color(0, color_installed)
|
|
|
|
|
item.set_metadata(0, "installed")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_LineEdit_text_entered(text):
|
|
|
|
|
Tree.clear()
|
|
|
|
@ -119,7 +122,7 @@ func _on_LineEdit_text_entered(text):
|
|
|
|
|
root.set_text(1, s["descr"])
|
|
|
|
|
if s["pkgname"] in installed_packages:
|
|
|
|
|
root.set_metadata(0, "installed")
|
|
|
|
|
root.set_custom_bg_color(0, Color(0.7, 0.7,0.2,0.5))
|
|
|
|
|
root.set_custom_bg_color(0, color_installed)
|
|
|
|
|
|
|
|
|
|
func reset_display():
|
|
|
|
|
$ConsolePanel.hide()
|
|
|
|
|