Set file size text
This commit is contained in:
parent
56614d3b1d
commit
fbacfccd13
|
@ -28,6 +28,7 @@ public partial class TextureBrowser : Node
|
||||||
private OptionButton _filterOptions;
|
private OptionButton _filterOptions;
|
||||||
private LineEdit _fileType;
|
private LineEdit _fileType;
|
||||||
private LineEdit _resolutionBox;
|
private LineEdit _resolutionBox;
|
||||||
|
private LineEdit _fileSizeBox;
|
||||||
|
|
||||||
private string _searchFilterPrefix = "";
|
private string _searchFilterPrefix = "";
|
||||||
|
|
||||||
|
@ -48,6 +49,7 @@ public partial class TextureBrowser : Node
|
||||||
_filterOptions = GetNode<OptionButton>("%FilterOptions");
|
_filterOptions = GetNode<OptionButton>("%FilterOptions");
|
||||||
_fileType = GetNode<LineEdit>("%FileTypeBox");
|
_fileType = GetNode<LineEdit>("%FileTypeBox");
|
||||||
_resolutionBox = GetNode<LineEdit>("%ResolutionBox");
|
_resolutionBox = GetNode<LineEdit>("%ResolutionBox");
|
||||||
|
_fileSizeBox = GetNode<LineEdit>("%FileSizeBox");
|
||||||
|
|
||||||
_searchBar.TextChanged += ApplySearchFilter;
|
_searchBar.TextChanged += ApplySearchFilter;
|
||||||
_sortMenu.GetPopup().IdPressed += ApplySortMode;
|
_sortMenu.GetPopup().IdPressed += ApplySortMode;
|
||||||
|
@ -132,8 +134,12 @@ public partial class TextureBrowser : Node
|
||||||
_previewTexture.Texture = texture;
|
_previewTexture.Texture = texture;
|
||||||
_texturePath.Text = name;
|
_texturePath.Text = name;
|
||||||
_fileType.Text = Path.GetExtension(path).ToUpper();
|
_fileType.Text = Path.GetExtension(path).ToUpper();
|
||||||
|
|
||||||
var resolution = texture.GetSize();
|
var resolution = texture.GetSize();
|
||||||
_resolutionBox.Text = $"{resolution.X}x{resolution.Y}";
|
_resolutionBox.Text = $"{resolution.X}x{resolution.Y}";
|
||||||
|
|
||||||
|
var fileInfo = new FileInfo(path);
|
||||||
|
_fileSizeBox.Text = $"{(fileInfo.Length / 1000.0f).ToString("0.0")} kb";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplySearchFilter(string filter)
|
private void ApplySearchFilter(string filter)
|
||||||
|
|
|
@ -297,6 +297,7 @@ layout_mode = 2
|
||||||
text = "File Size"
|
text = "File Size"
|
||||||
|
|
||||||
[node name="FileSizeBox" type="LineEdit" parent="TabContainer/Textures/VBoxContainer/HSplitContainer/HSplitContainer/Preview/VBoxContainer/PanelContainer/MarginContainer/Details"]
|
[node name="FileSizeBox" type="LineEdit" parent="TabContainer/Textures/VBoxContainer/HSplitContainer/HSplitContainer/Preview/VBoxContainer/PanelContainer/MarginContainer/Details"]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
editable = false
|
editable = false
|
||||||
|
|
Loading…
Reference in New Issue