mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-09 05:02:22 +02:00
Index Status Icons
This commit is contained in:
parent
3bb62a5d84
commit
a725508dc8
6 changed files with 99 additions and 8 deletions
scenes
|
@ -1,13 +1,18 @@
|
|||
class_name FileBrowserItem
|
||||
extends Control
|
||||
|
||||
signal clicked(what)
|
||||
|
||||
enum IconStatus {NONE, NEW, REMOVED, CONFLICT, EDIT, UNTRACKED}
|
||||
export(IconStatus) var status setget _set_status
|
||||
export var label: String setget _set_label
|
||||
|
||||
onready var label_node = $VBoxContainer/Label
|
||||
onready var status_icon = $VBoxContainer/Control/TextureRect/StatusIcon
|
||||
|
||||
func _ready():
|
||||
_set_label(label)
|
||||
_set_status(status)
|
||||
|
||||
func _set_label(new_label):
|
||||
label = new_label
|
||||
|
@ -17,3 +22,27 @@ func _set_label(new_label):
|
|||
func _gui_input(event):
|
||||
if event is InputEventMouseButton and event.is_pressed() and event.button_index == BUTTON_LEFT:
|
||||
emit_signal("clicked", self)
|
||||
|
||||
func _set_status(new_status):
|
||||
if status_icon:
|
||||
match new_status:
|
||||
IconStatus.NEW:
|
||||
status_icon.texture = preload("res://images/new.svg")
|
||||
status_icon.modulate = Color("33BB33")
|
||||
IconStatus.REMOVED:
|
||||
status_icon.texture = preload("res://images/removed.svg")
|
||||
status_icon.modulate = Color("D10F0F")
|
||||
IconStatus.CONFLICT:
|
||||
status_icon.texture = preload("res://images/conflict.svg")
|
||||
status_icon.modulate = Color("DE5E09")
|
||||
IconStatus.EDIT:
|
||||
status_icon.texture = preload("res://images/modified.svg")
|
||||
status_icon.modulate = Color("344DED")
|
||||
IconStatus.UNTRACKED:
|
||||
status_icon.texture = preload("res://images/untracked.svg")
|
||||
status_icon.modulate = Color("9209B8")
|
||||
IconStatus.NONE:
|
||||
status_icon.texture = null
|
||||
|
||||
status = new_status
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue