feat: display their letter besides each candidate on the profiles graph

(we also broke the API, discreetly -- it's okay ; sprint!)
master
Dominique Merle 4 years ago
parent b420127e36
commit 281e70f14d

@ -0,0 +1,21 @@
# Kenney Mini Square
Created & distributed by [Kenney]))(www.kenney.nl)
------------------------------
License: (Creative Commons Zero, CC0)
http://creativecommons.org/publicdomain/zero/1.0/
This content is free to use in personal, educational and commercial projects.
Support us by crediting (Kenney or www.kenney.nl), this is not mandatory.
------------------------------
Donate: http://support.kenney.nl
Request: http://request.kenney.nl
Patreon: http://patreon.com/kenney/
Follow on Twitter for updates:
@KenneyNL

@ -0,0 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://addons/majority_judgment/fonts/KenneyMini.ttf" type="DynamicFontData" id=1]
[resource]
font_data = ExtResource( 1 )

@ -0,0 +1,9 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://addons/majority_judgment/fonts/KenneyMiniSquare.ttf" type="DynamicFontData" id=1]
[resource]
size = 32
outline_size = 6
outline_color = Color( 0.282353, 0.282353, 0.282353, 1 )
font_data = ExtResource( 1 )

@ -21,10 +21,10 @@ var providers:Array # of MajorityJudgmentAbstractJudgmentsProvider
func _input(_event):
if Input.is_action_just_pressed("ui_cancel"):
exit_poll()
exit_scene()
func exit_poll():
func exit_scene():
# Check if we want to save or discard?
# …
# Close things up
@ -39,7 +39,7 @@ func get_poll() -> MajorityJudgmentPoll:
func set_poll(__poll:MajorityJudgmentPoll):
poll = __poll
craft_nodes()
update_nodes()
update_scene()
self.providers = App.get_providers()
for provider in self.providers:
@ -89,7 +89,25 @@ func craft_nodes():
candidate_label.autowrap = true
candidate_label.valign = Label.VALIGN_CENTER
candidate_label.align = Label.ALIGN_RIGHT
var candidate_font = preload("res://addons/majority_judgment/fonts/KenneyMini.tres")
candidate_font.set_size(int(height*0.62))
candidate_label.set("custom_fonts/font", candidate_font)
var candidate_letter := Label.new()
candidate_letter.name = "CandidateLetterLabel"
candidate_letter.text = char(candidate_index+65)
# candidate_letter.size_flags_horizontal = Control.SIZE_EXPAND_FILL
# candidate_letter.size_flags_vertical = Control.SIZE_EXPAND_FILL
candidate_letter.rect_min_size = Vector2(height, height)
# candidate_letter.rect_size = Vector2(candidates_labels_width, height)
candidate_letter.valign = Label.VALIGN_CENTER
candidate_letter.align = Label.ALIGN_CENTER
var letter_font = preload("res://addons/majority_judgment/fonts/KenneyMiniSquare.tres")
letter_font.set_size(height*0.75)
candidate_letter.set("custom_fonts/font", letter_font)
wrapper.add_child(candidate_label)
wrapper.add_child(candidate_letter)
wrapper.add_child(profile)
container.add_child(wrapper)
@ -105,8 +123,7 @@ func craft_nodes():
candidate_index += 1
# perhaps update_scene()?
func update_nodes():
func update_scene():
$Tween.remove_all()
var tally : MajorityJudgmentPollTally = get_poll().tally()
var candidate_index = 0 # as they were initially written, before the sort
@ -207,5 +224,5 @@ func __on_judgment_emitted(author_identifier, grade_index, candidate_index):
j.set_candidate(poll.candidates[candidate_index])
poll.add_judgment(j)
update_nodes()
update_scene()

Loading…
Cancel
Save