Indent every script with tabs, like the Godot editor does
This commit is contained in:
1 parent
8c1987807c
commit
bad4b3ad8b
35 files changed
+1653
-1653
No files matched your search
+27
-27
@@ -16,42 +16,42 @@ var label: Label
|
||||
|
||||
## The item's text.
|
||||
var text: String:
|
||||
get:
|
||||
return label.text
|
||||
get:
|
||||
return label.text
|
||||
|
||||
|
||||
## Creates the row for item number [param row] (counting from 0) in a list.
|
||||
static func create(
|
||||
item_text: String,
|
||||
row: int,
|
||||
font_size: int,
|
||||
alignment: HorizontalAlignment = HORIZONTAL_ALIGNMENT_LEFT,
|
||||
item_text: String,
|
||||
row: int,
|
||||
font_size: int,
|
||||
alignment: HorizontalAlignment = HORIZONTAL_ALIGNMENT_LEFT,
|
||||
) -> ListRow:
|
||||
var list_row: ListRow = ListRow.new()
|
||||
list_row.add_theme_stylebox_override("panel", _style(row % 2 != 0))
|
||||
list_row.label = Label.new()
|
||||
list_row.label.add_theme_font_size_override("font_size", font_size)
|
||||
list_row.label.text = item_text
|
||||
list_row.label.horizontal_alignment = alignment
|
||||
list_row.label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
list_row.add_child(list_row.label)
|
||||
return list_row
|
||||
var list_row: ListRow = ListRow.new()
|
||||
list_row.add_theme_stylebox_override("panel", _style(row % 2 != 0))
|
||||
list_row.label = Label.new()
|
||||
list_row.label.add_theme_font_size_override("font_size", font_size)
|
||||
list_row.label.text = item_text
|
||||
list_row.label.horizontal_alignment = alignment
|
||||
list_row.label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
list_row.add_child(list_row.label)
|
||||
return list_row
|
||||
|
||||
|
||||
# Rows share two styles instead of each creating its own
|
||||
static func _style(odd: bool) -> StyleBoxFlat:
|
||||
if _even_style == null:
|
||||
_even_style = _make_style(EVEN_BACKGROUND)
|
||||
_odd_style = _make_style(ODD_BACKGROUND)
|
||||
return _odd_style if odd else _even_style
|
||||
if _even_style == null:
|
||||
_even_style = _make_style(EVEN_BACKGROUND)
|
||||
_odd_style = _make_style(ODD_BACKGROUND)
|
||||
return _odd_style if odd else _even_style
|
||||
|
||||
|
||||
static func _make_style(background: Color) -> StyleBoxFlat:
|
||||
var style: StyleBoxFlat = StyleBoxFlat.new()
|
||||
style.bg_color = background
|
||||
style.set_corner_radius_all(4)
|
||||
style.content_margin_left = 8
|
||||
style.content_margin_right = 8
|
||||
style.content_margin_top = 2
|
||||
style.content_margin_bottom = 2
|
||||
return style
|
||||
var style: StyleBoxFlat = StyleBoxFlat.new()
|
||||
style.bg_color = background
|
||||
style.set_corner_radius_all(4)
|
||||
style.content_margin_left = 8
|
||||
style.content_margin_right = 8
|
||||
style.content_margin_top = 2
|
||||
style.content_margin_bottom = 2
|
||||
return style
|
||||
Reference in new issue
Block a user