You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
934 B
36 lines
934 B
extends Control
|
|
|
|
|
|
onready var LaunchButton = find_node("LaunchButton", true)
|
|
|
|
func _ready():
|
|
LaunchButton.grab_focus()
|
|
|
|
|
|
func _on_CancelButton_pressed():
|
|
var _done = get_tree().change_scene("res://gui/MainMenu.tscn")
|
|
|
|
|
|
func _on_LaunchButton_pressed():
|
|
var poll = collect_poll_from_form(self)
|
|
if poll:
|
|
App.start_poll(poll)
|
|
|
|
|
|
func collect_poll_from_form(form:Control) -> MajorityJudgmentPoll:
|
|
var poll = MajorityJudgmentPoll.new()
|
|
|
|
var title_line_edit = form.find_node("TitleLineEdit", true, false)
|
|
if title_line_edit.text:
|
|
poll.set_title(title_line_edit.text)
|
|
|
|
var candidates_tree = form.find_node("CandidatesTree", true, false)
|
|
var candidate_item = candidates_tree.get_root().get_children()
|
|
while (candidate_item):
|
|
poll.add_candidate(MajorityJudgmentCandidate.make(candidate_item.get_text(0)))
|
|
candidate_item = candidate_item.get_next()
|
|
|
|
poll.set_grading(MajorityJudgmentGrading.make_quality_6())
|
|
|
|
return poll
|