From e9de204736a5af530f2234735a1255ab0f043d81 Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Thu, 3 Dec 2020 23:40:09 +0200 Subject: [PATCH] Update AboutDialog.gd Clean code by putting `create_item` lines of code into their own methods and update missing translators --- src/UI/Dialogs/AboutDialog.gd | 164 +++++++++++++++++++--------------- 1 file changed, 91 insertions(+), 73 deletions(-) diff --git a/src/UI/Dialogs/AboutDialog.gd b/src/UI/Dialogs/AboutDialog.gd index fcadb1958..1acd0ad8b 100644 --- a/src/UI/Dialogs/AboutDialog.gd +++ b/src/UI/Dialogs/AboutDialog.gd @@ -22,6 +22,91 @@ onready var cjk_font_small = preload("res://assets/fonts/CJK/DroidSansFallback-S func _ready() -> void: + create_donors() + create_contributors() + + +func _on_AboutDialog_about_to_show() -> void: + window_title = tr("About Pixelorama") + " " + Global.current_version + + if Global.is_cjk(TranslationServer.get_locale()): + slogan_label.add_font_override("font", cjk_font) + copyright_label.add_font_override("font", cjk_font_small) + else: + slogan_label.add_font_override("font", latin_font_italic) + copyright_label.add_font_override("font", latin_font_small) + + var groups_root := groups.create_item() + var developers_button := groups.create_item(groups_root) + var contributors_button := groups.create_item(groups_root) + var donors_button := groups.create_item(groups_root) + var translators_button := groups.create_item(groups_root) + + developers_button.set_text(0, " " + tr("Developers")) + # We use metadata to avoid being affected by translations + developers_button.set_metadata(0, "Developers") + developers_button.select(0) + contributors_button.set_text(0, " " + tr("Contributors")) + contributors_button.set_metadata(0, "Contributors") + donors_button.set_text(0, " " + tr("Donors")) + donors_button.set_metadata(0, "Donors") + translators_button.set_text(0, " " + tr("Translators")) + translators_button.set_metadata(0, "Translators") + + create_developers() + create_translators() + +func _on_AboutDialog_popup_hide() -> void: + groups.clear() + developers.clear() + translators.clear() + + +func _on_Groups_item_selected() -> void: + for child in credits.get_children(): + if child != groups: + child.visible = false + + var selected : String = groups.get_selected().get_metadata(0) + if "Developers" in selected: + developer_container.visible = true + elif "Contributors" in selected: + contributors_container.visible = true + elif "Donors" in selected: + donors_container.visible = true + elif "Translators" in selected: + translators_container.visible = true + + +func _on_Website_pressed() -> void: + OS.shell_open("https://www.orama-interactive.com") + + +func _on_GitHub_pressed() -> void: + OS.shell_open("https://github.com/Orama-Interactive/Pixelorama") + + +func _on_Donate_pressed() -> void: + OS.shell_open("https://www.patreon.com/OramaInteractive") + + +func create_developers() -> void: + var dev_root := developers.create_item() + developers.create_item(dev_root).set_text(0, " Manolis Papadeas (Overloaded) - " + tr("Lead Programmer")) + developers.create_item(dev_root).set_text(0, " John Nikitakis (Erevos) - " + tr("UI Designer")) + + +func create_donors() -> void: + var donors_root := donors.create_item() + donors.create_item(donors_root).set_text(0, " pcmxms - https://www.nonamefornowsoft.com.br/") + donors.create_item(donors_root).set_text(0, " Mike King") + donors.create_item(donors_root).set_text(0, " Guillaume Gautier") + donors.create_item(donors_root).set_text(0, " Isambard") + donors.create_item(donors_root).set_text(0, " Hugo Locurcio") + donors.create_item(donors_root).set_text(0, " MysteryStudio") + + +func create_contributors() -> void: var contributor_root := contributors.create_item() contributors.create_item(contributor_root).set_text(0, " Hugo Locurcio (Calinou)") contributors.create_item(contributor_root).set_text(0, " CheetoHead (greusser)") @@ -52,54 +137,18 @@ func _ready() -> void: contributors.create_item(contributor_root).set_text(0, " Rémi Verschelde (akien-mga)") contributors.create_item(contributor_root).set_text(0, " gschwind") - var donors_root := donors.create_item() - donors.create_item(donors_root).set_text(0, " pcmxms - https://www.nonamefornowsoft.com.br/") - donors.create_item(donors_root).set_text(0, " Mike King") - donors.create_item(donors_root).set_text(0, " Guillaume Gautier") - donors.create_item(donors_root).set_text(0, " Isambard") - donors.create_item(donors_root).set_text(0, " Hugo Locurcio") - donors.create_item(donors_root).set_text(0, " MysteryStudio") - -func _on_AboutDialog_about_to_show() -> void: - window_title = tr("About Pixelorama") + " " + Global.current_version - - if Global.is_cjk(TranslationServer.get_locale()): - slogan_label.add_font_override("font", cjk_font) - copyright_label.add_font_override("font", cjk_font_small) - else: - slogan_label.add_font_override("font", latin_font_italic) - copyright_label.add_font_override("font", latin_font_small) - - var groups_root := groups.create_item() - var developers_button := groups.create_item(groups_root) - var contributors_button := groups.create_item(groups_root) - var donors_button := groups.create_item(groups_root) - var translators_button := groups.create_item(groups_root) - - developers_button.set_text(0, " " + tr("Developers")) - # We use metadata to avoid being affected by translations - developers_button.set_metadata(0, "Developers") - developers_button.select(0) - contributors_button.set_text(0, " " + tr("Contributors")) - contributors_button.set_metadata(0, "Contributors") - donors_button.set_text(0, " " + tr("Donors")) - donors_button.set_metadata(0, "Donors") - translators_button.set_text(0, " " + tr("Translators")) - translators_button.set_metadata(0, "Translators") - - var dev_root := developers.create_item() - developers.create_item(dev_root).set_text(0, " Manolis Papadeas (Overloaded) - " + tr("Lead Programmer")) - developers.create_item(dev_root).set_text(0, " John Nikitakis (Erevos) - " + tr("UI Designer")) - - # Translators +func create_translators() -> void: var translators_root := translators.create_item() translators.create_item(translators_root).set_text(0, " Manolis Papadeas (Overloaded) - " + tr("Greek")) translators.create_item(translators_root).set_text(0, " Xenofon Konitsas (huskee) - " + tr("Greek")) translators.create_item(translators_root).set_text(0, " Lena Louloudaki (Soliscital) - " + tr("Greek")) translators.create_item(translators_root).set_text(0, " Hugo Locurcio (Calinou) - " + tr("French")) translators.create_item(translators_root).set_text(0, " blackjoker77777 - " + tr("French")) + translators.create_item(translators_root).set_text(0, " Yoshiip (myoshipro) - " + tr("French")) translators.create_item(translators_root).set_text(0, " Iorvethe - " + tr("French")) + translators.create_item(translators_root).set_text(0, " Paul Coral (lepaincestbon) - " + tr("French")) + translators.create_item(translators_root).set_text(0, " RED (REDOOO) - " + tr("French")) translators.create_item(translators_root).set_text(0, " Aidan Olsen (PossiblyAShrub) - " + tr("French")) translators.create_item(translators_root).set_text(0, " Jean-Loup Macarit (leyk973) - " + tr("French")) translators.create_item(translators_root).set_text(0, " Schweini07 - " + tr("German")) @@ -114,6 +163,7 @@ func _on_AboutDialog_about_to_show() -> void: translators.create_item(translators_root).set_text(0, " chacal_exodius - " + tr("Brazilian Portuguese")) translators.create_item(translators_root).set_text(0, " Lucas Santiago (lu.santi.oli) - " + tr("Brazilian Portuguese")) translators.create_item(translators_root).set_text(0, " TheNoobPro44 - " + tr("Brazilian Portuguese")) + translators.create_item(translators_root).set_text(0, " DippoZz - " + tr("Brazilian Portuguese")) translators.create_item(translators_root).set_text(0, " Andreev Andrei - " + tr("Russian")) translators.create_item(translators_root).set_text(0, " ax trifonov (ax34) - " + tr("Russian")) translators.create_item(translators_root).set_text(0, " Artem (blinovartem) - " + tr("Russian")) @@ -128,6 +178,7 @@ func _on_AboutDialog_about_to_show() -> void: translators.create_item(translators_root).set_text(0, " UncleFangs - " + tr("Spanish")) translators.create_item(translators_root).set_text(0, " Jaime Arancibia Soto - " + tr("Spanish") + " " + tr("and") + " " + tr("Catalan")) translators.create_item(translators_root).set_text(0, " Agnis Aldiņš (NeZvers) - " + tr("Latvian")) + translators.create_item(translators_root).set_text(0, " Edgars Korns (Eddy11) - " + tr("Latvian")) translators.create_item(translators_root).set_text(0, " Teashrock - " + tr("Esperanto")) translators.create_item(translators_root).set_text(0, " Blend_Smile - " + tr("Indonesian")) translators.create_item(translators_root).set_text(0, " Martin Novák (novhack) - " + tr("Czech")) @@ -137,36 +188,3 @@ func _on_AboutDialog_about_to_show() -> void: translators.create_item(translators_root).set_text(0, " sfun_G - " + tr("Korean")) translators.create_item(translators_root).set_text(0, " KripC2160 - " + tr("Korean")) translators.create_item(translators_root).set_text(0, " M. Gabriel Lup - " + tr("Romanian")) - - -func _on_AboutDialog_popup_hide() -> void: - groups.clear() - developers.clear() - - -func _on_Groups_item_selected() -> void: - for child in credits.get_children(): - if child != groups: - child.visible = false - - var selected : String = groups.get_selected().get_metadata(0) - if "Developers" in selected: - developer_container.visible = true - elif "Contributors" in selected: - contributors_container.visible = true - elif "Donors" in selected: - donors_container.visible = true - elif "Translators" in selected: - translators_container.visible = true - - -func _on_Website_pressed() -> void: - OS.shell_open("https://www.orama-interactive.com") - - -func _on_GitHub_pressed() -> void: - OS.shell_open("https://github.com/Orama-Interactive/Pixelorama") - - -func _on_Donate_pressed() -> void: - OS.shell_open("https://www.patreon.com/OramaInteractive")