2022-10-22 02:10:01 +00:00
|
|
|
extends CanvasLayer
|
|
|
|
|
|
|
|
|
|
|
|
var date_time
|
|
|
|
var check_time_var : int
|
|
|
|
|
2022-11-02 13:07:23 +00:00
|
|
|
var ddmmyyyy : String
|
|
|
|
var date
|
2022-11-06 08:31:09 +00:00
|
|
|
var csv_url = "https://raw.githubusercontent.com/hobbesjaap/time-sampling-form/main/version_info.csv"
|
2022-10-22 02:10:01 +00:00
|
|
|
|
|
|
|
onready var date_time_display = $"%CurrentTime"
|
|
|
|
onready var global_ints = $"/root/GlobalInts"
|
|
|
|
onready var minute_label = $"StartScreen/InstructionPanel/MinuteBox/MinuteLabel"
|
|
|
|
|
2022-11-06 08:22:55 +00:00
|
|
|
func check_for_updates():
|
|
|
|
var os_check : String
|
|
|
|
os_check = OS.get_name()
|
|
|
|
print(os_check)
|
2022-11-06 08:30:17 +00:00
|
|
|
if os_check == "X11" and "Windows" and "OSX":
|
2022-11-06 08:22:55 +00:00
|
|
|
print("We're on desktop. So let's check for updates!")
|
2022-11-06 08:30:17 +00:00
|
|
|
$"%HTTPRequest".request(csv_url)
|
|
|
|
|
|
|
|
func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body):
|
|
|
|
var json = JSON.parse(body.get_string_from_utf8())
|
|
|
|
global_ints.web_release_version = json.result
|
|
|
|
if global_ints.web_release_version > global_ints.release_version:
|
|
|
|
print("There's an update!")
|
|
|
|
elif global_ints.web_release_version == global_ints.release_version:
|
|
|
|
print("There is no update!")
|
2022-11-06 08:22:55 +00:00
|
|
|
|
2022-10-23 12:17:43 +00:00
|
|
|
func refresh_descriptors():
|
|
|
|
$"%1Acronym".text = global_ints.one_acronym
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%1AcronymE".text = $"%1Acronym".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%2Acronym".text = global_ints.two_acronym
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%2AcronymE".text = $"%2Acronym".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%3Acronym".text = global_ints.three_acronym
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%3AcronymE".text = $"%3Acronym".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%4Acronym".text = global_ints.four_acronym
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%4AcronymE".text = $"%4Acronym".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%5Acronym".text = global_ints.five_acronym
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%5AcronymE".text = $"%5Acronym".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%1Item".text = global_ints.one_behaviour
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%1ItemE".text = $"%1Item".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%2Item".text = global_ints.two_behaviour
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%2ItemE".text = $"%2Item".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%3Item".text = global_ints.three_behaviour
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%3ItemE".text = $"%3Item".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%4Item".text = global_ints.four_behaviour
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%4ItemE".text = $"%4Item".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%5Item".text = global_ints.five_behaviour
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%5ItemE".text = $"%5Item".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%1Explanation".text = global_ints.one_explanation
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%1ExplanationE".text = $"%1Explanation".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%2Explanation".text = global_ints.two_explanation
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%2ExplanationE".text = $"%2Explanation".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%3Explanation".text = global_ints.three_explanation
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%3ExplanationE".text = $"%3Explanation".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%4Explanation".text = global_ints.four_explanation
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%4ExplanationE".text = $"%4Explanation".text
|
2022-10-23 12:17:43 +00:00
|
|
|
$"%5Explanation".text = global_ints.five_explanation
|
2022-10-25 09:10:30 +00:00
|
|
|
$"%5ExplanationE".text = $"%5Explanation".text
|
2022-10-22 02:10:01 +00:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
minute_label.text = str(global_ints.observation_minutes)
|
|
|
|
global_ints.observed_person_name = ""
|
2022-10-23 12:17:43 +00:00
|
|
|
refresh_descriptors()
|
|
|
|
$"StartScreen".visible = true
|
|
|
|
$"%NameChangePanel".visible = true
|
2022-11-04 13:14:09 +00:00
|
|
|
$"%InstructionScreen".visible = true
|
2022-10-22 02:10:01 +00:00
|
|
|
$"%WarningLabel".visible = false
|
2022-10-23 12:17:43 +00:00
|
|
|
$"ObservationWindow".visible = false
|
|
|
|
$"Results".visible = false
|
2022-10-26 08:05:44 +00:00
|
|
|
$"EditScreen".visible = false
|
2022-11-02 13:07:23 +00:00
|
|
|
|
|
|
|
global_ints.date = OS.get_date()
|
|
|
|
global_ints.ddmmyyyy = str(global_ints.date.day, "-", global_ints.date.month, "-", global_ints.date.year)
|
|
|
|
|
2022-11-06 08:22:55 +00:00
|
|
|
check_for_updates()
|
2022-10-22 02:10:01 +00:00
|
|
|
|
|
|
|
func _process(_delta):
|
|
|
|
check_time_var += 1
|
|
|
|
|
|
|
|
if check_time_var == 10:
|
|
|
|
check_time_var = 0
|
|
|
|
date_time = OS.get_time()
|
2022-10-28 08:28:42 +00:00
|
|
|
if date_time.minute < 10:
|
|
|
|
date_time_display.text = str(date_time.hour, ":0", date_time.minute)
|
|
|
|
if date_time.minute >= 10:
|
|
|
|
date_time_display.text = str(date_time.hour, ":", date_time.minute)
|
2022-10-22 02:10:01 +00:00
|
|
|
|
|
|
|
|
2022-11-04 13:14:09 +00:00
|
|
|
func _on_MinuteMinus_pressed():
|
2022-10-22 02:10:01 +00:00
|
|
|
if global_ints.observation_minutes >= 2:
|
|
|
|
global_ints.observation_minutes -= 1
|
|
|
|
minute_label.text = str(global_ints.observation_minutes)
|
|
|
|
|
|
|
|
|
2022-11-04 13:14:09 +00:00
|
|
|
func _on_MinutePlus_pressed():
|
2022-10-22 02:10:01 +00:00
|
|
|
if global_ints.observation_minutes < 60:
|
|
|
|
global_ints.observation_minutes += 1
|
|
|
|
minute_label.text = str(global_ints.observation_minutes)
|
|
|
|
|
|
|
|
|
2022-11-04 13:14:09 +00:00
|
|
|
func _on_Manual_pressed():
|
2022-10-22 02:10:01 +00:00
|
|
|
var _error = OS.shell_open("https://www.internationalsengroup.org/resources/time-sampling-form/")
|
|
|
|
|
|
|
|
|
2022-11-04 13:14:09 +00:00
|
|
|
func _on_PupilName_pressed():
|
2022-10-22 02:10:01 +00:00
|
|
|
$"%NameLine".text = global_ints.observed_person_name
|
|
|
|
$"%InstructionPanel".visible = false
|
|
|
|
$"%NameChangePanel".visible = true
|
2022-10-23 12:17:43 +00:00
|
|
|
|
|
|
|
|
2022-11-04 13:14:09 +00:00
|
|
|
func _on_Start_pressed():
|
2022-10-23 12:17:43 +00:00
|
|
|
$"StartScreen".visible = false
|
|
|
|
refresh_descriptors()
|
|
|
|
$"ObservationWindow".visible = true
|
|
|
|
$"%BehaviourOne".text = global_ints.one_acronym
|
|
|
|
$"%BehaviourTwo".text = global_ints.two_acronym
|
|
|
|
$"%BehaviourThree".text = global_ints.three_acronym
|
|
|
|
$"%BehaviourFour".text = global_ints.four_acronym
|
|
|
|
$"%BehaviourFive".text = global_ints.five_acronym
|
2022-11-01 09:28:59 +00:00
|
|
|
$"%BTitle1".text = global_ints.one_behaviour
|
|
|
|
$"%BTitle2".text = global_ints.two_behaviour
|
|
|
|
$"%BTitle3".text = global_ints.three_behaviour
|
|
|
|
$"%BTitle4".text = global_ints.four_behaviour
|
|
|
|
$"%BTitle5".text = global_ints.five_behaviour
|
|
|
|
$"%ObsTitle1".text = global_ints.one_behaviour
|
|
|
|
$"%ObsTitle2".text = global_ints.two_behaviour
|
|
|
|
$"%ObsTitle3".text = global_ints.three_behaviour
|
|
|
|
$"%ObsTitle4".text = global_ints.four_behaviour
|
|
|
|
$"%ObsTitle5".text = global_ints.five_behaviour
|
2022-10-23 12:17:43 +00:00
|
|
|
|
|
|
|
global_ints.locked_observation_minutes = global_ints.observation_minutes
|
|
|
|
global_ints.locked_observation_intervals = global_ints.locked_observation_minutes * 3
|
|
|
|
global_ints.locked_observations_intervals_remaining = global_ints.locked_observation_intervals
|
|
|
|
|
|
|
|
$"%ObservationsTotal".text = str(global_ints.locked_observation_intervals)
|
|
|
|
$"%ObservationsRemaining".text = str(global_ints.locked_observations_intervals_remaining)
|
2022-10-28 08:28:42 +00:00
|
|
|
|
|
|
|
var obs_date_time = OS.get_time()
|
|
|
|
if obs_date_time.minute < 10:
|
|
|
|
global_ints.observation_start_time = str(obs_date_time.hour, ":0", obs_date_time.minute)
|
|
|
|
if obs_date_time.minute >= 10:
|
|
|
|
global_ints.observation_start_time = str(obs_date_time.hour, ":", obs_date_time.minute)
|
2022-10-23 12:17:43 +00:00
|
|
|
|
|
|
|
$"%TwentySecondTimer".start(global_ints.timer_duration)
|
2022-10-26 08:05:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ChangeItems_pressed():
|
|
|
|
$"EditScreen".visible = true
|
2022-11-04 13:14:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_InsOkButton_pressed():
|
|
|
|
$"%InstructionScreen".visible = false
|
|
|
|
|
|
|
|
|
|
|
|
func _on_MinuteMinus_button_down():
|
|
|
|
# if global_ints.observation_minutes >= 2:
|
|
|
|
# global_ints.observation_minutes -= 1
|
|
|
|
# minute_label.text = str(global_ints.observation_minutes)
|
|
|
|
pass
|