Refactoring Main.gd. Mostly cutting big methods into smaller ones. (#244)

* Refactoring Main.gd. Mostly cutting big methods into smaller one.

- Reduced size of _ready method in Main.gd
- Moved code from certain parts of old _ready method into seperate methods
- Fixed the translation bug related to CurrentFrame node in TopMenuContainer scene. The CurrentFrame node wasn't updating the language when I was changing language. I've also changed the translation file for this.
- Fixed Global.palette_option_button.selected related warning. Because of some unknown reasons, git didn't push completed line there.
- Moved code from file_menu_id_pressed and view_menu_id_pressed method in Main.gd to separate methods to make it more readable.

* Removed window_title changes from Main.tscn

Co-authored-by: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com>
This commit is contained in:
Igor Santarek 2020-05-23 23:22:06 +02:00 committed by GitHub
parent 852e249143
commit aae3ae0cf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 282 additions and 183 deletions

View file

@ -7,6 +7,9 @@ margin_right = 1280.0
margin_bottom = 28.0
rect_min_size = Vector2( 0, 28 )
custom_styles/panel = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MenuItems" type="HBoxContainer" parent="."]
margin_left = 2.0
@ -17,40 +20,40 @@ __meta__ = {
}
[node name="FileMenu" type="MenuButton" parent="MenuItems"]
margin_right = 29.0
margin_bottom = 21.0
margin_right = 35.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "File"
switch_on_hover = true
[node name="EditMenu" type="MenuButton" parent="MenuItems"]
margin_left = 33.0
margin_right = 64.0
margin_bottom = 21.0
margin_left = 39.0
margin_right = 75.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "Edit"
switch_on_hover = true
[node name="ViewMenu" type="MenuButton" parent="MenuItems"]
margin_left = 68.0
margin_right = 104.0
margin_bottom = 21.0
margin_left = 79.0
margin_right = 121.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "View"
switch_on_hover = true
[node name="ImageMenu" type="MenuButton" parent="MenuItems"]
margin_left = 108.0
margin_right = 152.0
margin_bottom = 21.0
margin_left = 125.0
margin_right = 177.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "Image"
switch_on_hover = true
[node name="HelpMenu" type="MenuButton" parent="MenuItems"]
margin_left = 156.0
margin_right = 191.0
margin_bottom = 21.0
margin_left = 181.0
margin_right = 223.0
margin_bottom = 20.0
mouse_default_cursor_shape = 2
text = "Help"
switch_on_hover = true
@ -67,7 +70,7 @@ __meta__ = {
}
[node name="ZoomLevel" type="Label" parent="TopLabels"]
margin_top = 6.0
margin_top = 7.0
margin_right = 60.0
margin_bottom = 21.0
rect_min_size = Vector2( 60, 0 )
@ -76,8 +79,8 @@ align = 2
[node name="CursorPosition" type="Label" parent="TopLabels"]
margin_left = 80.0
margin_top = 6.0
margin_right = 120.0
margin_top = 7.0
margin_right = 128.0
margin_bottom = 21.0
text = "[64×64]"
align = 2
@ -98,12 +101,20 @@ __meta__ = {
}
[node name="CurrentFrame" type="Label" parent="HBoxContainer"]
margin_left = 113.0
margin_top = 6.0
margin_right = 216.0
margin_bottom = 21.0
text = "Current Frame: 1/1"
margin_left = 106.0
margin_right = 198.0
margin_bottom = 28.0
size_flags_vertical = 1
text = "Current frame:"
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CurrentFrameMark" type="Label" parent="HBoxContainer"]
margin_left = 202.0
margin_right = 223.0
margin_bottom = 28.0
size_flags_vertical = 1
text = "1/2"
valign = 1