Use simple pager for long output

This commit is contained in:
Sebastian Morr 2020-09-29 17:05:04 +02:00
parent 78f324bf68
commit 4b988717e6
5 changed files with 35 additions and 9 deletions

View file

@ -5,7 +5,6 @@
[node name="Arrow" type="Node2D"]
show_behind_parent = true
z_as_relative = false
script = ExtResource( 1 )
[node name="Line" type="Line2D" parent="."]

View file

@ -30,7 +30,10 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Background" type="ColorRect" parent="."]
[node name="CanvasLayer" type="CanvasLayer" parent="."]
layer = -1
[node name="Background" type="ColorRect" parent="CanvasLayer"]
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2

View file

@ -17,9 +17,11 @@ corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[node name="Node" type="Node2D"]
z_index = 1
script = ExtResource( 1 )
[node name="Arrows" type="Node2D" parent="."]
z_index = -1
[node name="Rect" type="ColorRect" parent="."]
margin_left = -29.0
margin_top = -28.0
@ -48,6 +50,9 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Pop" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 4 )
[node name="Content" type="Label" parent="."]
visible = false
margin_left = -22.2898
@ -60,10 +65,5 @@ custom_colors/font_color = Color( 1, 1, 1, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Arrows" type="Node2D" parent="."]
[node name="Pop" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 4 )
[connection signal="mouse_entered" from="Rect" to="." method="_on_hover"]
[connection signal="mouse_exited" from="Rect" to="." method="_on_unhover"]

View file

@ -98,7 +98,12 @@ func run_command_in_a_thread(command):
input.text = ""
input.editable = true
output.text = output.text + "$ " + command + "\n" + o
if o.length() <= 200:
output.text = output.text + "$ " + command + "\n" + o
else:
$Pager/Text.text = o
$Pager.popup()
repository.update_everything()
func receive_output(text):

View file

@ -42,6 +42,8 @@ size_flags_vertical = 3
[node name="Output" type="RichTextLabel" parent="Rows/TopHalf"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -1.92206
margin_bottom = -1.92212
size_flags_vertical = 3
custom_styles/normal = SubResource( 1 )
custom_fonts/normal_font = ExtResource( 4 )
@ -106,6 +108,23 @@ mouse_filter = 1
syntax_highlighting = false
[node name="TCPServer" parent="." instance=ExtResource( 3 )]
[node name="Pager" type="WindowDialog" parent="."]
visible = true
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 18.0
margin_top = 39.0
margin_right = -687.0
margin_bottom = -48.0
[node name="Text" type="RichTextLabel" parent="Pager"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_fonts/normal_font = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="item_selected" from="Rows/TopHalf/Completions" to="." method="_completion_selected"]
[connection signal="text_changed" from="Rows/InputLine/Input" to="." method="_input_changed"]
[connection signal="text_entered" from="Rows/InputLine/Input" to="." method="send_command"]