| 1 |
# emerald.script - boot splash using script plugin |
| 2 |
# |
| 3 |
# Copyright (C) 2009 Canonical Ltd. |
| 4 |
# Copyright © 2010-2021 Aurélien Couderc <[email protected]> |
| 5 |
# Copyright © 2014-2022 Juliette Taka <[email protected]> |
| 6 |
# |
| 7 |
# This program is free software; you can redistribute it and/or modify |
| 8 |
# it under the terms of the GNU General Public License as published by |
| 9 |
# the Free Software Foundation; either version 2, or (at your option) |
| 10 |
# any later version. |
| 11 |
# |
| 12 |
# This program is distributed in the hope that it will be useful, |
| 13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
# GNU General Public License for more details. |
| 16 |
# |
| 17 |
# You should have received a copy of the GNU General Public License |
| 18 |
# along with this program; if not, write to the Free Software |
| 19 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 20 |
# 02111-1307, USA. |
| 21 |
# |
| 22 |
# Written by: Alberto Milone <[email protected]> |
| 23 |
# |
| 24 |
# Based on the example provided with the "script plugin" written by: |
| 25 |
# Charlie Brej <[email protected]> |
| 26 |
# |
| 27 |
|
| 28 |
|
| 29 |
#------------------------------- Constants ----------------------------------------- |
| 30 |
NB_ANIM_STEPS = 60; |
| 31 |
NB_REFRESHS_BETWEEN_ANIMS = 2; |
| 32 |
|
| 33 |
# Initial position of the center of the logo in % of background |
| 34 |
LOGO_CENTER_PCT.x = 0.5; # Debian swirl image position in % of screen height & width |
| 35 |
LOGO_CENTER_PCT.y = 0.55; |
| 36 |
LOGO_SIZE_PCT = 0.48; # Debian + emerald image size in % of smallest screen dimension |
| 37 |
LOGO_GLOW_SIZE_PCT = 0.8; # Debian swirl image size in % of smallest screen dimension |
| 38 |
|
| 39 |
#------------------------------- Globals ------------------------------------------- |
| 40 |
# are we currently prompting for a password? |
| 41 |
prompt_active = 0; |
| 42 |
|
| 43 |
# Globals to share progress time / percent with intersted functions |
| 44 |
progress_time = 0; |
| 45 |
progress_pct = 0; |
| 46 |
|
| 47 |
# Variables for glow rotation animation |
| 48 |
anim_start_time = NULL; |
| 49 |
anim_status = "stopped"; |
| 50 |
refresh_iter = 0; |
| 51 |
anim_iter = 0; |
| 52 |
|
| 53 |
#-----------------------------Text-image functions---------------------------- |
| 54 |
|
| 55 |
# Set the text colour in (rgb / 256) |
| 56 |
text_colour.red = 1.0; |
| 57 |
text_colour.green = 1.0; |
| 58 |
text_colour.blue = 1.0; |
| 59 |
|
| 60 |
# Tinted text #988592 |
| 61 |
tinted_text_colour.red = 1.0; |
| 62 |
tinted_text_colour.green = 1.0; |
| 63 |
tinted_text_colour.blue = 1.0; |
| 64 |
|
| 65 |
# Action Text - #ffffff - RGB 255 255 255 |
| 66 |
action_text_colour.red = 1.0; |
| 67 |
action_text_colour.green = 1.0; |
| 68 |
action_text_colour.blue = 1.0; |
| 69 |
|
| 70 |
# Orange - #ff4012 - RGB 255 64 18 |
| 71 |
debugsprite = Sprite(); |
| 72 |
debugsprite_bottom = Sprite(); |
| 73 |
debugsprite_bottom.SetPosition(0, (Window.GetHeight (0) - 20), 1); |
| 74 |
debugsprite_medium = Sprite(); |
| 75 |
debugsprite_medium.SetPosition(0, (Window.GetHeight (0) - 100), 1); |
| 76 |
|
| 77 |
# General purpose function to create text |
| 78 |
fun WriteText (text, colour) { |
| 79 |
image = Image.Text (text, colour.red, colour.green, colour.blue); |
| 80 |
return image; |
| 81 |
} |
| 82 |
|
| 83 |
fun ImageFromText (text) { |
| 84 |
image = WriteText (text, text_colour); |
| 85 |
return image; |
| 86 |
} |
| 87 |
|
| 88 |
fun ImageFromTintedText (text) { |
| 89 |
image = WriteText (text, tinted_text_colour); |
| 90 |
return image; |
| 91 |
} |
| 92 |
|
| 93 |
fun ImageFromActionText (text) { |
| 94 |
image = WriteText (text, action_text_colour); |
| 95 |
return image; |
| 96 |
} |
| 97 |
|
| 98 |
fun Debug(text) { |
| 99 |
debugsprite.SetImage(ImageFromText (text)); |
| 100 |
} |
| 101 |
|
| 102 |
fun DebugBottom(text) { |
| 103 |
debugsprite_bottom.SetImage(ImageFromText (text)); |
| 104 |
} |
| 105 |
|
| 106 |
fun DebugMedium(text) { |
| 107 |
debugsprite_medium.SetImage(ImageFromText (text)); |
| 108 |
} |
| 109 |
|
| 110 |
#Debug("Window.GetHeight(0) = " + Window.GetHeight(0)); |
| 111 |
fun TextYOffset() { |
| 112 |
local.y; |
| 113 |
local.text_height; |
| 114 |
local.min_height; |
| 115 |
|
| 116 |
# Put the 1st line below the logo + some spacing |
| 117 |
# TODO position from lower edge |
| 118 |
y = logo_sprite.GetY() + logo.GetHeight(); |
| 119 |
#Debug("y = " + y); |
| 120 |
|
| 121 |
text_height = first_line_height * 7.5; |
| 122 |
# subtract Window.GetY() to show info also at smallest of dual srceens |
| 123 |
min_height = window_max.height - 2 * first_line_height - Window.GetY(); |
| 124 |
#Debug("text_height=" + text_height + "; min_height=" + min_height); |
| 125 |
|
| 126 |
if (y + text_height > min_height) |
| 127 |
y = min_height - text_height; |
| 128 |
|
| 129 |
return y; |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
#----------------------------- Screen/window setup --------------------------- |
| 134 |
# Compute screen/image ratio and scale the background accordingly |
| 135 |
window_max.width = Window.GetWidth(); |
| 136 |
window_max.height = Window.GetHeight(); |
| 137 |
screen_ratio = window_max.width / window_max.height; |
| 138 |
small_dimension = Math.Min(window_max.width, window_max.height); |
| 139 |
#Debug("Window.GetX():" + Window.GetX() + ", Window.GetY():" + Window.GetY()); |
| 140 |
#Debug("Window is [" + window_max.width + ";" + window_max.height + "], ratio=" + screen_ratio); |
| 141 |
|
| 142 |
logo_size = small_dimension * LOGO_SIZE_PCT; |
| 143 |
logo_center.x = window_max.width * LOGO_CENTER_PCT.x; |
| 144 |
logo_center.y = window_max.height * LOGO_CENTER_PCT.y; |
| 145 |
#Debug("Logo center at [" + logo_center.x + ";" + logo_center.y + "], size=" + logo_size + "px"); |
| 146 |
|
| 147 |
logo_pos.x = logo_center.x - 0.343 * logo_size; # Center the Debian 12 text, not the image |
| 148 |
logo_pos.y = logo_center.y - logo_size/2; |
| 149 |
|
| 150 |
logo_glow_size = small_dimension * LOGO_GLOW_SIZE_PCT; |
| 151 |
|
| 152 |
|
| 153 |
#---------------------------- Logo + Emerald --------------------------------- |
| 154 |
logo = Image("logo+emerald.png"); |
| 155 |
logo_scale_factor = logo_size / logo.GetWidth(); |
| 156 |
logo = logo.Scale(logo.GetWidth() * logo_scale_factor, |
| 157 |
logo.GetHeight() * logo_scale_factor); |
| 158 |
logo_to_top_edge = Window.GetHeight() * 0.3; |
| 159 |
logo_sprite = Sprite(logo); |
| 160 |
logo_sprite.SetPosition(logo_pos.x, logo_pos.y, -1); |
| 161 |
#logo_sprite.SetOpacity(0); |
| 162 |
|
| 163 |
logo_glow = Image("glow.png"); |
| 164 |
logo_glow_scale_factor = logo_glow_size / logo_glow.GetWidth(); |
| 165 |
logo_glow = logo_glow.Scale(logo_glow.GetWidth() * logo_glow_scale_factor, |
| 166 |
logo_glow.GetHeight() * logo_glow_scale_factor); |
| 167 |
|
| 168 |
logo_glow_pos.x = logo_center.x - logo_glow.GetWidth() / 2; |
| 169 |
# Place glow vertically between the Debian 12 text and the emerald |
| 170 |
logo_glow_pos.y = logo_pos.y + logo.GetHeight()*0.1 - logo_glow.GetHeight() / 2; |
| 171 |
|
| 172 |
logo_glow_sprite = Sprite(); |
| 173 |
logo_glow_sprite.SetPosition(logo_glow_pos.x, logo_glow_pos.y, -2); |
| 174 |
logo_glow_sprite.SetImage(logo_glow); |
| 175 |
|
| 176 |
|
| 177 |
#------------------------------String functions------------------------------- |
| 178 |
|
| 179 |
# This is the equivalent for strstr() |
| 180 |
fun StringString(string, substring) { |
| 181 |
start = 0; |
| 182 |
while (String(string).CharAt (start)) { |
| 183 |
walk = 0; |
| 184 |
while (String(substring).CharAt (walk) == String(string).CharAt (start + walk) ) { |
| 185 |
walk++; |
| 186 |
if (!String(substring).CharAt (walk)) return start; |
| 187 |
} |
| 188 |
start++; |
| 189 |
} |
| 190 |
|
| 191 |
return NULL; |
| 192 |
} |
| 193 |
|
| 194 |
fun StringLength (string) { |
| 195 |
index = 0; |
| 196 |
while (String(string).CharAt(index)) index++; |
| 197 |
return index; |
| 198 |
} |
| 199 |
|
| 200 |
fun StringCopy (source, beginning, end) { |
| 201 |
local.destination = ""; |
| 202 |
for (index = beginning; ( ( (end == NULL) || (index <= end) ) && (String(source).CharAt(index)) ); index++) { |
| 203 |
local.destination += String(source).CharAt(index); |
| 204 |
} |
| 205 |
|
| 206 |
return local.destination; |
| 207 |
} |
| 208 |
|
| 209 |
fun StringReplace (source, pattern, replacement) { |
| 210 |
local.found = StringString(source, pattern); |
| 211 |
if (local.found == NULL) |
| 212 |
return source; |
| 213 |
|
| 214 |
local.new_string = StringCopy (source, 0, local.found - 1) + |
| 215 |
replacement + |
| 216 |
StringCopy (source, local.found + StringLength(pattern), NULL); |
| 217 |
|
| 218 |
return local.new_string; |
| 219 |
} |
| 220 |
|
| 221 |
# it makes sense to use it only for |
| 222 |
# numbers up to 100 |
| 223 |
fun StringToInteger (str) { |
| 224 |
int = -1; |
| 225 |
for (i=0; i<=100; i++) { |
| 226 |
if (i+"" == str) { |
| 227 |
int = i; |
| 228 |
break; |
| 229 |
} |
| 230 |
} |
| 231 |
return int; |
| 232 |
} |
| 233 |
|
| 234 |
#----------------------------------------------------------------------------- |
| 235 |
# Top background colour |
| 236 |
# #05475c --> 0.0196, 0.2784, 0.3608 |
| 237 |
# Bottom background colour |
| 238 |
# #05475c --> 0.0196, 0.2784, 0.3608 |
| 239 |
# |
| 240 |
Window.SetBackgroundTopColor (0.02, 0.279, 0.3608); # Nice colour on top of the screen fading to |
| 241 |
Window.SetBackgroundBottomColor (0.02, 0.279, 0.3608); # an equally nice colour on the bottom |
| 242 |
|
| 243 |
bits_per_pixel = Window.GetBitsPerPixel (); |
| 244 |
# TODO need to handle 16 colors ? |
| 245 |
#if (bits_per_pixel == 4) { |
| 246 |
# logo_filename = "debian_logo16.png"; |
| 247 |
# progress_dot_off_filename = "progress_dot_off16.png"; |
| 248 |
# progress_dot_on_filename = "progress_dot_on16.png"; |
| 249 |
# password_dot_filename = "password_dot.png"; |
| 250 |
# password_field_filename = "password_field16.png"; |
| 251 |
#} else { |
| 252 |
# logo_filename = "debian_logo.png"; |
| 253 |
# progress_dot_off_filename = "progress_dot_off.png"; |
| 254 |
# progress_dot_on_filename = "progress_dot_on.png"; |
| 255 |
password_dot_filename = "password_dot.png"; |
| 256 |
password_field_filename = "password_field.png"; |
| 257 |
#} |
| 258 |
|
| 259 |
message_notification[0].image = ImageFromTintedText (""); |
| 260 |
message_notification[1].image = ImageFromTintedText (""); |
| 261 |
fsck_notification.image = ImageFromActionText (""); |
| 262 |
|
| 263 |
status = "normal"; |
| 264 |
|
| 265 |
# use a fixed string with ascending and descending stems to calibrate the |
| 266 |
# bounding box for the first message, so the messages below don't move up |
| 267 |
# and down according to *their* height. |
| 268 |
first_line_height = ImageFromTintedText ("AfpqtM").GetHeight(); |
| 269 |
|
| 270 |
# if the user has a 640x480 or 800x600 display, we can't quite fit everything |
| 271 |
# (including passphrase prompts) with the target spacing, so scoot the text up |
| 272 |
# a bit if needed. |
| 273 |
top_of_the_text = TextYOffset(); |
| 274 |
|
| 275 |
|
| 276 |
#-------------------------------Progress Indicator----------------------------- |
| 277 |
# Implement in boot progress callback |
| 278 |
fun animate_progress_indicator (time, progress) { |
| 279 |
progress_time = time; |
| 280 |
progress_pct = progress; |
| 281 |
|
| 282 |
#Debug ("mode = " + Plymouth.GetMode() + ", progress_time = " + progress_time + ", progress_pct = " + progress_pct); |
| 283 |
|
| 284 |
} |
| 285 |
|
| 286 |
|
| 287 |
#-----------------------------------------Label utility functions--------------------- |
| 288 |
|
| 289 |
# label should be either a string or NULL |
| 290 |
# Images for n lines will be created and returned as items of the |
| 291 |
# message_label array |
| 292 |
# |
| 293 |
fun get_message_label (label, is_fake, is_action_line) { |
| 294 |
#Debug("Get Label position"); |
| 295 |
local.message_label; |
| 296 |
|
| 297 |
if (is_fake) |
| 298 |
# Create a fake label so as to get the y coordinate of |
| 299 |
# a standard-length label. |
| 300 |
local.message_image = ImageFromTintedText ("This is a fake message"); |
| 301 |
else |
| 302 |
local.message_image = (is_action_line) && ImageFromActionText (label) || ImageFromTintedText (label); |
| 303 |
|
| 304 |
message_label.width = message_image.GetWidth (); |
| 305 |
message_label.height = message_image.GetHeight (); |
| 306 |
|
| 307 |
# Center the line horizontally |
| 308 |
message_label.x = Window.GetX () + Window.GetWidth () / 2 - message_label.width / 2; |
| 309 |
|
| 310 |
message_label.y = top_of_the_text; |
| 311 |
|
| 312 |
# Put the 2nd line below the fsck line |
| 313 |
if (is_action_line) { |
| 314 |
local.fsck_label.y = message_label.y + (first_line_height + first_line_height / 2); |
| 315 |
message_label.y = local.fsck_label.y + (first_line_height * 1.5); |
| 316 |
} |
| 317 |
|
| 318 |
#Debug("action label x = " + message_label.x + " y = " + message_label.y ); |
| 319 |
|
| 320 |
# message_debug = "msg_x = " + message_label.x + " msg_y = " + message_label.y + |
| 321 |
# "msg_width = " + message_label.width + " msg_height = " + |
| 322 |
# message_label.height + " message = " + label; |
| 323 |
# Debug(message_debug); |
| 324 |
|
| 325 |
return message_label; |
| 326 |
|
| 327 |
} |
| 328 |
|
| 329 |
# Create an fsck label and/or get its position |
| 330 |
fun get_fsck_label (label, is_fake) { |
| 331 |
# Debug("Get Label position"); |
| 332 |
local.fsck_label = global.progress_label; |
| 333 |
|
| 334 |
if (is_fake) |
| 335 |
fsck_label.image = ImageFromTintedText ("This is a fake message"); |
| 336 |
else |
| 337 |
fsck_label.image = ImageFromTintedText (label); |
| 338 |
|
| 339 |
fsck_label.width = fsck_label.image.GetWidth (); |
| 340 |
fsck_label.height = fsck_label.image.GetHeight (); |
| 341 |
|
| 342 |
# Centre the label horizontally |
| 343 |
fsck_label.x = Window.GetX () + Window.GetWidth () / 2 - fsck_label.width / 2; |
| 344 |
|
| 345 |
local.first_label = get_message_label (label, 1, 0); |
| 346 |
|
| 347 |
# Place the label below the 1st message line |
| 348 |
fsck_label.y = local.first_label.y + local.first_label.height + (local.first_label.height / 2); |
| 349 |
|
| 350 |
# message_debug = "msg_x = " + fsck_label.x + " msg_y = " + fsck_label.y + |
| 351 |
# "msg_width = " + fsck_label.width + " msg_height = " + |
| 352 |
# fsck_label.height + " message = " + label; |
| 353 |
# Debug(message_debug); |
| 354 |
|
| 355 |
return fsck_label; |
| 356 |
} |
| 357 |
|
| 358 |
#-----------------------------------------Message stuff -------------------------------- |
| 359 |
# |
| 360 |
|
| 361 |
# Set up a message label |
| 362 |
# |
| 363 |
# NOTE: this is called when doing something like 'plymouth message "hello world"' |
| 364 |
# |
| 365 |
fun setup_message (message_text, x, y, z, index) { |
| 366 |
#DebugMedium("Message setup: " + message_text); |
| 367 |
global.message_notification[index].image = (index) && ImageFromActionText (message_text) || ImageFromTintedText (message_text); |
| 368 |
|
| 369 |
# Set up the text message, if any |
| 370 |
message_notification[index].x = x; |
| 371 |
message_notification[index].y = y; |
| 372 |
message_notification[index].z = z; |
| 373 |
|
| 374 |
message_notification[index].sprite = Sprite (); |
| 375 |
message_notification[index].sprite.SetImage (message_notification[index].image); |
| 376 |
message_notification[index].sprite.SetX (message_notification[index].x); |
| 377 |
message_notification[index].sprite.SetY (message_notification[index].y); |
| 378 |
message_notification[index].sprite.SetZ (message_notification[index].z); |
| 379 |
|
| 380 |
} |
| 381 |
|
| 382 |
fun show_message (index) { |
| 383 |
if (global.message_notification[index].sprite) global.message_notification[index].sprite.SetOpacity(1); |
| 384 |
} |
| 385 |
|
| 386 |
fun hide_message (index) { |
| 387 |
if (global.message_notification[index].sprite) global.message_notification[index].sprite.SetOpacity(0); |
| 388 |
} |
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
# the callback function is called when new message should be displayed. |
| 394 |
# First arg is message to display. |
| 395 |
fun message_callback (message) |
| 396 |
{ |
| 397 |
# Debug("Message callback"); |
| 398 |
is_fake = 0; |
| 399 |
if (!message || (message == "")) is_fake = 1; |
| 400 |
|
| 401 |
local.substring = "keys:"; |
| 402 |
|
| 403 |
# Look for the "keys:" prefix |
| 404 |
local.keys = StringString(message, local.substring); |
| 405 |
|
| 406 |
local.is_action_line = (keys != NULL); |
| 407 |
#Debug("keys " + local.keys + " substring length = " + StringLength(local.substring)); |
| 408 |
|
| 409 |
# Get the message without the "keys:" prefix |
| 410 |
if (keys != NULL) |
| 411 |
message = StringCopy (message, keys + StringLength(local.substring), NULL); |
| 412 |
|
| 413 |
# Get the message without the "fsckd-cancel-msg" prefix as we don't support i18n |
| 414 |
substring = "fsckd-cancel-msg:"; |
| 415 |
keys = StringString(message, substring); |
| 416 |
if (keys != NULL) |
| 417 |
message = StringCopy(message, keys + StringLength(substring), NULL); |
| 418 |
|
| 419 |
local.label.is_fake = is_fake; |
| 420 |
label = get_message_label(message, is_fake, is_action_line); |
| 421 |
label.z = 10000; |
| 422 |
|
| 423 |
setup_message (message, label.x, label.y, label.z, is_action_line); |
| 424 |
if (prompt_active && local.is_action_line) |
| 425 |
hide_message (is_action_line); |
| 426 |
else |
| 427 |
show_message (is_action_line); |
| 428 |
|
| 429 |
} |
| 430 |
|
| 431 |
|
| 432 |
#-----------------------------------------Display Password stuff ----------------------- |
| 433 |
# |
| 434 |
|
| 435 |
fun password_dialogue_setup (message_label) { |
| 436 |
#Debug("Password dialog setup"); |
| 437 |
|
| 438 |
local.entry; |
| 439 |
local.bullet_image; |
| 440 |
|
| 441 |
bullet_image = Image (password_dot_filename); |
| 442 |
entry.image = Image (password_field_filename); |
| 443 |
|
| 444 |
# Hide the normal labels |
| 445 |
prompt_active = 1; |
| 446 |
if (message_notification[1].sprite) hide_message (1); |
| 447 |
|
| 448 |
# Set the prompt label |
| 449 |
label = get_message_label(message_label, 0, 1); |
| 450 |
label.z = 10000; |
| 451 |
|
| 452 |
setup_message (message_label, label.x, label.y, label.z, 2); |
| 453 |
show_message (2); |
| 454 |
|
| 455 |
# Set up the text entry which contains the bullets |
| 456 |
entry.sprite = Sprite (); |
| 457 |
entry.sprite.SetImage (entry.image); |
| 458 |
|
| 459 |
# Centre the box horizontally |
| 460 |
entry.x = Window.GetX () + Window.GetWidth () / 2 - entry.image.GetWidth () / 2; |
| 461 |
|
| 462 |
# Put the entry below the second label. |
| 463 |
entry.y = message_notification[2].y + label.height * 1.5; |
| 464 |
|
| 465 |
#DebugMedium("entry x = " + entry.x + ", y = " + entry.y); |
| 466 |
entry.z = 10000; |
| 467 |
entry.sprite.SetX (entry.x); |
| 468 |
entry.sprite.SetY (entry.y); |
| 469 |
entry.sprite.SetZ (entry.z); |
| 470 |
|
| 471 |
global.password_dialogue = local; |
| 472 |
} |
| 473 |
|
| 474 |
fun password_dialogue_opacity (opacity) { |
| 475 |
#Debug("Setting password dialog opacity to " + opacity); |
| 476 |
global.password_dialogue.opacity = opacity; |
| 477 |
local = global.password_dialogue; |
| 478 |
|
| 479 |
# You can make the box translucent with a float |
| 480 |
# entry.sprite.SetOpacity (0.3); |
| 481 |
entry.sprite.SetOpacity (opacity); |
| 482 |
label.sprite.SetOpacity (opacity); |
| 483 |
|
| 484 |
if (bullets) { |
| 485 |
for (index = 0; bullets[index]; index++) { |
| 486 |
bullets[index].sprite.SetOpacity (opacity); |
| 487 |
} |
| 488 |
} |
| 489 |
} |
| 490 |
|
| 491 |
|
| 492 |
# The callback function is called when the display should display a password dialogue. |
| 493 |
# First arg is prompt string, the second is the number of bullets. |
| 494 |
fun display_password_callback (prompt, bullets) { |
| 495 |
#Debug("Password dialog setup"); |
| 496 |
|
| 497 |
global.status = "password"; |
| 498 |
if (!global.password_dialogue) password_dialogue_setup(prompt); |
| 499 |
password_dialogue_opacity (1); |
| 500 |
bullet_width = password_dialogue.bullet_image.GetWidth(); |
| 501 |
bullet_y = password_dialogue.entry.y + |
| 502 |
password_dialogue.entry.image.GetHeight () / 2 - |
| 503 |
password_dialogue.bullet_image.GetHeight () / 2; |
| 504 |
margin = bullet_width; |
| 505 |
spaces = Math.Int( (password_dialogue.entry.image.GetWidth () - (margin * 2)) / (bullet_width / 2 ) ); |
| 506 |
#DebugMedium ("spaces = " + spaces + ", bullets = " + bullets); |
| 507 |
bullets_area.width = margin + spaces * (bullet_width / 2); |
| 508 |
bullets_area.x = Window.GetX () + Window.GetWidth () / 2 - bullets_area.width / 2; |
| 509 |
#DebugBottom ("pwd_entry (x,y) = " + password_dialogue.entry.x + "," + password_dialogue.entry.y |
| 510 |
# + "), bullets_area.x = " + bullets_area.x + ", bullets_area.width = " + bullets_area.width); |
| 511 |
if (bullets > spaces) |
| 512 |
bullets = spaces; |
| 513 |
for (index = 0; password_dialogue.bullets[index] || index < bullets; index++){ |
| 514 |
if (!password_dialogue.bullets[index]) { |
| 515 |
password_dialogue.bullets[index].sprite = Sprite (); |
| 516 |
password_dialogue.bullets[index].sprite.SetImage (password_dialogue.bullet_image); |
| 517 |
password_dialogue.bullets[index].x = bullets_area.x + # password_dialogue.entry.x + margin + |
| 518 |
index * bullet_width / 2; |
| 519 |
password_dialogue.bullets[index].sprite.SetX (password_dialogue.bullets[index].x); |
| 520 |
password_dialogue.bullets[index].y = bullet_y; |
| 521 |
password_dialogue.bullets[index].sprite.SetY (password_dialogue.bullets[index].y); |
| 522 |
password_dialogue.bullets[index].z = password_dialogue.entry.z + 1; |
| 523 |
password_dialogue.bullets[index].sprite.SetZ (password_dialogue.bullets[index].z); |
| 524 |
} |
| 525 |
|
| 526 |
password_dialogue.bullets[index].sprite.SetOpacity (0); |
| 527 |
|
| 528 |
if (index < bullets) { |
| 529 |
password_dialogue.bullets[index].sprite.SetOpacity (1); |
| 530 |
} |
| 531 |
} |
| 532 |
} |
| 533 |
|
| 534 |
Plymouth.SetDisplayPasswordFunction (display_password_callback); |
| 535 |
|
| 536 |
Plymouth.SetMessageFunction (message_callback); |
| 537 |
|
| 538 |
Plymouth.SetBootProgressFunction (animate_progress_indicator); |
| 539 |
|
| 540 |
# Plymouth.SetBootProgressFunction: the callback function is called with two numbers, the progress (between 0 and 1) and the time spent booting so far |
| 541 |
# Plymouth.SetRootMountedFunction: the callback function is called when a new root is mounted |
| 542 |
# Plymouth.SetKeyboardInputFunction: the callback function is called with a string containing a new character entered on the keyboard |
| 543 |
|
| 544 |
#----------------------------------------- FSCK Counter -------------------------------- |
| 545 |
|
| 546 |
# Initialise the counter |
| 547 |
fun init_fsck_count () { |
| 548 |
# The number of fsck checks in this cycle |
| 549 |
global.counter.total = 0; |
| 550 |
# The number of fsck checks already performed + the current one |
| 551 |
global.counter.current = 1; |
| 552 |
# The previous fsck |
| 553 |
global.counter.last = 0; |
| 554 |
} |
| 555 |
|
| 556 |
# Increase the total counter |
| 557 |
fun increase_fsck_count () { |
| 558 |
global.counter.total++; |
| 559 |
} |
| 560 |
|
| 561 |
fun increase_current_fsck_count () { |
| 562 |
global.counter.last = global.counter.current++; |
| 563 |
} |
| 564 |
|
| 565 |
# Clear the counter |
| 566 |
fun clear_fsck_count () { |
| 567 |
global.counter = NULL; |
| 568 |
init_fsck_count (); |
| 569 |
} |
| 570 |
|
| 571 |
#----------------------------------------- Progress Label ------------------------------ |
| 572 |
|
| 573 |
|
| 574 |
# Change the opacity level of a progress label |
| 575 |
# |
| 576 |
# opacity = 1 -> show |
| 577 |
# opacity = 0 -> hide |
| 578 |
# opacity = 0.3 (or any other float) -> translucent |
| 579 |
# |
| 580 |
fun set_progress_label_opacity (opacity) { |
| 581 |
# the label |
| 582 |
progress_label.sprite.SetOpacity (opacity); |
| 583 |
|
| 584 |
# Make the slot available again when hiding the bar |
| 585 |
# So that another bar can take its place |
| 586 |
if (opacity == 0) { |
| 587 |
progress_label.is_available = 1; |
| 588 |
progress_label.device = ""; |
| 589 |
} |
| 590 |
} |
| 591 |
|
| 592 |
# Set up a new Progress Bar |
| 593 |
# |
| 594 |
# TODO: Make it possible to reuse (rather than recreate) a bar |
| 595 |
# if .is_available = 1. Ideally this would just reset the |
| 596 |
# label, the associated |
| 597 |
# device and the image size of the sprite. |
| 598 |
|
| 599 |
fun init_progress_label (device, status_string) { |
| 600 |
# Make the slot unavailable |
| 601 |
global.progress_label.is_available = 0; |
| 602 |
progress_label.progress = 0; |
| 603 |
progress_label.device = device; |
| 604 |
progress_label.status_string = status_string; |
| 605 |
} |
| 606 |
|
| 607 |
# See if the progress label is keeping track of the fsck |
| 608 |
# of "device" |
| 609 |
# |
| 610 |
fun device_has_progress_label (device) { |
| 611 |
#DebugBottom ("label device = " + progress_label.device + " checking device " + device); |
| 612 |
return (progress_label.device == device); |
| 613 |
} |
| 614 |
|
| 615 |
# Update the Progress bar which corresponds to index |
| 616 |
# |
| 617 |
fun update_progress_label (progress) { |
| 618 |
# If progress is NULL then we just refresh the label. |
| 619 |
# This happens when only counter.total has changed. |
| 620 |
if (progress != NULL) { |
| 621 |
progress_label.progress = progress; |
| 622 |
|
| 623 |
#Debug("device " + progress_label.device + " progress " + progress); |
| 624 |
|
| 625 |
# If progress >= 100% hide the label and make it available again |
| 626 |
if (progress >= 100) { |
| 627 |
set_progress_label_opacity (0); |
| 628 |
|
| 629 |
# See if we any other fsck check is complete |
| 630 |
# and, if so, hide the progress bars and the labels |
| 631 |
on_fsck_completed (); |
| 632 |
|
| 633 |
return 0; |
| 634 |
} |
| 635 |
} |
| 636 |
# Update progress label here |
| 637 |
# |
| 638 |
# FIXME: the queue logic from this theme should really be moved into mountall |
| 639 |
# instead of using string replacement to deal with localised strings. |
| 640 |
label = StringReplace (progress_label.status_string[0], "%1$d", global.counter.current); |
| 641 |
label = StringReplace (label, "%2$d", global.counter.total); |
| 642 |
label = StringReplace (label, "%3$d", progress_label.progress); |
| 643 |
label = StringReplace (label, "%%", "%"); |
| 644 |
|
| 645 |
progress_label = get_fsck_label (label, 0); |
| 646 |
#progress_label.progress = progress; |
| 647 |
|
| 648 |
progress_label.sprite = Sprite (progress_label.image); |
| 649 |
|
| 650 |
# Set up the bar |
| 651 |
progress_label.sprite.SetPosition(progress_label.x, progress_label.y, 1); |
| 652 |
|
| 653 |
set_progress_label_opacity (1); |
| 654 |
|
| 655 |
} |
| 656 |
|
| 657 |
# Refresh the label so as to update counters |
| 658 |
fun refresh_progress_label () { |
| 659 |
update_progress_label (NULL); |
| 660 |
} |
| 661 |
|
| 662 |
#----------------------------------------- FSCK Queue ---------------------------------- |
| 663 |
|
| 664 |
# Initialise the fsck queue |
| 665 |
fun init_queue () { |
| 666 |
global.fsck_queue[0].device; |
| 667 |
global.fsck_queue[0].progress; |
| 668 |
global.fsck_queue.counter = 0; |
| 669 |
global.fsck_queue.biggest_item = 0; |
| 670 |
} |
| 671 |
|
| 672 |
fun clear_queue () { |
| 673 |
global.fsck_queue = NULL; |
| 674 |
init_queue (); |
| 675 |
} |
| 676 |
|
| 677 |
# Return either the device index in the queue or -1 |
| 678 |
fun queue_look_up_by_device (device) { |
| 679 |
for (i=0; i <= fsck_queue.biggest_item; i++) { |
| 680 |
if ((fsck_queue[i]) && (fsck_queue[i].device == device)) |
| 681 |
return i; |
| 682 |
} |
| 683 |
return -1; |
| 684 |
} |
| 685 |
|
| 686 |
# Keep track of an fsck process in the queue |
| 687 |
fun add_fsck_to_queue (device, progress) { |
| 688 |
# Look for an empty slot in the queue |
| 689 |
for (i=0; global.fsck_queue[i].device; i++) { |
| 690 |
continue; |
| 691 |
} |
| 692 |
local.index = i; |
| 693 |
|
| 694 |
# Set device and progress |
| 695 |
global.fsck_queue[local.index].device = device; |
| 696 |
global.fsck_queue[local.index].progress = progress; |
| 697 |
|
| 698 |
# Increase the queue counter |
| 699 |
global.fsck_queue.counter++; |
| 700 |
|
| 701 |
# Update the max index of the array for iterations |
| 702 |
if (local.index > global.fsck_queue.biggest_item) |
| 703 |
global.fsck_queue.biggest_item = local.index; |
| 704 |
|
| 705 |
#DebugMedium ("Adding " + device + " at " + local.index); |
| 706 |
} |
| 707 |
|
| 708 |
fun is_queue_empty () { |
| 709 |
return (fsck_queue.counter == 0); |
| 710 |
} |
| 711 |
|
| 712 |
fun is_progress_label_available () { |
| 713 |
return (progress_label.is_available == 1); |
| 714 |
} |
| 715 |
|
| 716 |
|
| 717 |
# This should cover the case in which the fsck checks in |
| 718 |
# the queue are completed before the ones showed in the |
| 719 |
# progress label |
| 720 |
fun on_queued_fsck_completed () { |
| 721 |
if (!is_queue_empty ()) |
| 722 |
return; |
| 723 |
|
| 724 |
# Hide the extra label, if any |
| 725 |
#if (progress_bar.extra_label.sprite) |
| 726 |
# progress_bar.extra_label.sprite.SetOpacity(0); |
| 727 |
} |
| 728 |
|
| 729 |
fun remove_fsck_from_queue (index) { |
| 730 |
# Free memory which was previously allocated for |
| 731 |
# device and progress |
| 732 |
global.fsck_queue[index].device = NULL; |
| 733 |
global.fsck_queue[index].progress = NULL; |
| 734 |
|
| 735 |
# Decrease the queue counter |
| 736 |
global.fsck_queue.counter--; |
| 737 |
|
| 738 |
# See if there are other processes in the queue |
| 739 |
# if not, clear the extra_label |
| 740 |
on_queued_fsck_completed (); |
| 741 |
} |
| 742 |
|
| 743 |
fun on_fsck_completed () { |
| 744 |
# We have moved on to tracking the next fsck |
| 745 |
increase_current_fsck_count (); |
| 746 |
|
| 747 |
if (!is_progress_label_available ()) |
| 748 |
return; |
| 749 |
|
| 750 |
if (!is_queue_empty ()) |
| 751 |
return; |
| 752 |
|
| 753 |
# Hide the progress label |
| 754 |
if (progress_label.sprite) |
| 755 |
progress_label.sprite.SetOpacity (0); |
| 756 |
|
| 757 |
# Clear the queue |
| 758 |
clear_queue (); |
| 759 |
|
| 760 |
# Clear the fsck counter |
| 761 |
clear_fsck_count (); |
| 762 |
} |
| 763 |
|
| 764 |
# Update an fsck process that we keep track of in the queue |
| 765 |
fun update_progress_in_queue (index, device, progress) { |
| 766 |
# If the fsck is complete, remove it from the queue |
| 767 |
if (progress >= 100) { |
| 768 |
remove_fsck_from_queue (index); |
| 769 |
on_queued_fsck_completed (); |
| 770 |
return; |
| 771 |
} |
| 772 |
|
| 773 |
global.fsck_queue[index].device = device; |
| 774 |
global.fsck_queue[index].progress = progress; |
| 775 |
|
| 776 |
} |
| 777 |
|
| 778 |
# TODO: Move it to some function |
| 779 |
# Create an empty queue |
| 780 |
#init_queue (); |
| 781 |
|
| 782 |
|
| 783 |
#----------------------------------------- FSCK Functions ------------------------------ |
| 784 |
|
| 785 |
|
| 786 |
# Either add a new bar for fsck checks or update an existing bar |
| 787 |
# |
| 788 |
# NOTE: no more than "progress_bar.max_number" bars are allowed |
| 789 |
# |
| 790 |
fun fsck_check (device, progress, status_string) { |
| 791 |
|
| 792 |
# The 1st time this will take place |
| 793 |
if (!global.progress_label) { |
| 794 |
# Increase the fsck counter |
| 795 |
increase_fsck_count (); |
| 796 |
|
| 797 |
# Set up a new label for the check |
| 798 |
init_progress_label (device, status_string); |
| 799 |
update_progress_label (progress); |
| 800 |
|
| 801 |
return; |
| 802 |
} |
| 803 |
|
| 804 |
|
| 805 |
if (device_has_progress_label (device)) { |
| 806 |
# Update the progress of the existing label |
| 807 |
update_progress_label (progress); |
| 808 |
} |
| 809 |
else { |
| 810 |
# See if there's already a slot in the queue for the device |
| 811 |
local.queue_device_index = queue_look_up_by_device(device); |
| 812 |
|
| 813 |
# See if the progress_label is available |
| 814 |
if (progress_label.is_available) { |
| 815 |
|
| 816 |
# local.my_string = "available index " + local.available_index + " progress_bar counter is " + progress_bar.counter; |
| 817 |
# Debug(local.my_string); |
| 818 |
|
| 819 |
|
| 820 |
# If the fsck check for the device was in the queue, then |
| 821 |
# remove it from the queue |
| 822 |
if (local.queue_device_index >= 0) { |
| 823 |
remove_fsck_from_queue (index); |
| 824 |
} |
| 825 |
else { |
| 826 |
# Increase the fsck counter |
| 827 |
increase_fsck_count (); |
| 828 |
} |
| 829 |
|
| 830 |
# local.my_string += local.message; |
| 831 |
#Debug("setting new label for device " + device + " progress " + progress); |
| 832 |
|
| 833 |
# Set up a new label for the check |
| 834 |
init_progress_label (device, status_string); |
| 835 |
update_progress_label (progress); |
| 836 |
|
| 837 |
} |
| 838 |
# If the progress_label is not available |
| 839 |
else { |
| 840 |
|
| 841 |
# If the fsck check for the device is already in the queue |
| 842 |
# just update its progress in the queue |
| 843 |
if (local.queue_device_index >= 0) { |
| 844 |
#DebugMedium("Updating queue at " + local.queue_device_index + " for device " + device); |
| 845 |
update_progress_in_queue (local.queue_device_index, device, progress); |
| 846 |
} |
| 847 |
# Otherwise add the check to the queue |
| 848 |
else { |
| 849 |
#DebugMedium("Adding device " + device + " to queue at " + local.queue_device_index); |
| 850 |
add_fsck_to_queue (device, progress); |
| 851 |
|
| 852 |
# Increase the fsck counter |
| 853 |
increase_fsck_count (); |
| 854 |
|
| 855 |
refresh_progress_label (); |
| 856 |
} |
| 857 |
|
| 858 |
} |
| 859 |
} |
| 860 |
|
| 861 |
# if (!is_queue_empty ()) { |
| 862 |
# DebugBottom("Extra label for "+ device); |
| 863 |
#} |
| 864 |
# else { |
| 865 |
# DebugBottom("No extra label for " + device + ". 1st Device in the queue "+ fsck_queue[0].device + " counter = " + global.fsck_queue.counter); |
| 866 |
# } |
| 867 |
} |
| 868 |
|
| 869 |
|
| 870 |
#-----------------------------------------Update Status stuff -------------------------- |
| 871 |
# |
| 872 |
# The update_status_callback is what we can use to pass plymouth whatever we want so |
| 873 |
# as to make use of features which are available only in this program (as opposed to |
| 874 |
# being available for any theme for the script plugin). |
| 875 |
# |
| 876 |
# Example: |
| 877 |
# |
| 878 |
# Thanks to the current implementation, some scripts can call "plymouth --update=fsck:sda1:40" |
| 879 |
# and this program will know that 1) we're performing and fsck check, 2) we're checking sda1, |
| 880 |
# 3) the program should set the label progress to 40% |
| 881 |
# |
| 882 |
# Other features can be easily added by parsing the string that we pass plymouth with "--update" |
| 883 |
# |
| 884 |
fun update_status_callback (status) { |
| 885 |
# Debug(status); |
| 886 |
if (!status) return; |
| 887 |
|
| 888 |
string_it = 0; |
| 889 |
update_strings[string_it] = ""; |
| 890 |
|
| 891 |
for (i=0; (String(status).CharAt(i) != ""); i++) { |
| 892 |
local.temp_char = String(status).CharAt(i); |
| 893 |
if (temp_char != ":") |
| 894 |
update_strings[string_it] += temp_char; |
| 895 |
else |
| 896 |
update_strings[++string_it] = ""; |
| 897 |
} |
| 898 |
|
| 899 |
# my_string = update_strings[0] + " " + update_strings[1] + " " + update_strings[2]; |
| 900 |
# Debug(my_string); |
| 901 |
# Let's assume that we're dealing with these strings fsck:sda1:40 |
| 902 |
if ((string_it >= 2) && (update_strings[0] == "fsck")) { |
| 903 |
|
| 904 |
device = update_strings[1]; |
| 905 |
progress = update_strings[2]; |
| 906 |
status_string[0] = update_strings[3]; # "Checking disk %1$d of %2$d (%3$d %% complete)" |
| 907 |
if (!status_string[0]) |
| 908 |
status_string[0] = "Checking disk %1$d of %2$d (%3$d %% complete)"; |
| 909 |
|
| 910 |
if ((device != "") && (progress != "")) { |
| 911 |
progress = StringToInteger (progress); |
| 912 |
|
| 913 |
# Make sure that the fsck_queue is initialised |
| 914 |
if (!global.fsck_queue) |
| 915 |
init_queue (); |
| 916 |
|
| 917 |
# Make sure that the fsck counter is initialised |
| 918 |
if (!global.counter) |
| 919 |
init_fsck_count (); |
| 920 |
|
| 921 |
# if (!global.progress_bar.extra_label.sprite) |
| 922 |
# create_extra_fsck_label (); |
| 923 |
|
| 924 |
# Keep track of the fsck check |
| 925 |
fsck_check (device, progress, status_string); |
| 926 |
} |
| 927 |
|
| 928 |
} |
| 929 |
|
| 930 |
# systemd-fsckd pass fsckd:<number_devices>:<progress>:<l10n_string> |
| 931 |
if (update_strings[0] == "fsckd") { |
| 932 |
number_devices = StringToInteger(update_strings[1]); |
| 933 |
|
| 934 |
if (number_devices > 0) { |
| 935 |
label = update_strings[3]; |
| 936 |
|
| 937 |
progress_label = get_fsck_label (label, 0); |
| 938 |
progress_label.sprite = Sprite (progress_label.image); |
| 939 |
progress_label.sprite.SetPosition(progress_label.x, progress_label.y, 1); |
| 940 |
progress_label.sprite.SetOpacity (1); |
| 941 |
} else { |
| 942 |
if (progress_label.sprite) |
| 943 |
progress_label.sprite.SetOpacity (0); |
| 944 |
} |
| 945 |
} |
| 946 |
|
| 947 |
} |
| 948 |
Plymouth.SetUpdateStatusFunction (update_status_callback); |
| 949 |
|
| 950 |
#-----------------------------------------Display Question stuff ----------------------- |
| 951 |
# |
| 952 |
# TODO: Implement this if needed |
| 953 |
# |
| 954 |
# The callback function is called when the display should display a question dialogue. |
| 955 |
# First arg is prompt string, the second is the entry contents. |
| 956 |
#fun display_question_callback (prompt_string, entry_contents) |
| 957 |
#{ |
| 958 |
# time++; |
| 959 |
#} |
| 960 |
# |
| 961 |
#Plymouth.SetDisplayQuestionFunction (display_question_callback); |
| 962 |
|
| 963 |
fun rotate_img(source_img, current_step, nb_steps) { |
| 964 |
angle = Math.Sin(current_step / nb_steps * Math.Pi / 2) * 2 * Math.Pi; |
| 965 |
#debug_sin = Math.Sin(current_step / nb_steps * Math.Pi / 2); |
| 966 |
#DebugMedium("Sin = " + debug_sin); |
| 967 |
rotated_img = source_img.Rotate(angle); |
| 968 |
return rotated_img; |
| 969 |
} |
| 970 |
|
| 971 |
fun update_glow_anim () { |
| 972 |
if (global.anim_iter > NB_ANIM_STEPS) { |
| 973 |
global.anim_iter = 0; |
| 974 |
} |
| 975 |
#DebugMedium("iter = " + global.anim_iter); |
| 976 |
glow_opacity = 0.7 + 0.3 * Math.Cos(global.anim_iter / NB_ANIM_STEPS * 2 * Math.Pi); |
| 977 |
#Debug("glow_opacity = " + glow_opacity); |
| 978 |
if (global.anim_start_time != global.progress_time && global.anim_status != "running") { |
| 979 |
global.anim_start_time = global.progress_time; |
| 980 |
global.anim_iter = 0; |
| 981 |
global.anim_status = "running"; |
| 982 |
} |
| 983 |
|
| 984 |
if (global.anim_status == "running") { |
| 985 |
# iter_img = global.logo_glow[global.anim_iter]; |
| 986 |
# if (iter_img == NULL) { |
| 987 |
# # Generate rotated image for the glow around the logo on demand. |
| 988 |
# #DebugMedium("Generating rotated image for index " + global.anim_iter); |
| 989 |
# #iter_img = rotate_img(logo_glow[0], global.anim_iter, NB_ANIM_STEPS); |
| 990 |
# global.logo_glow[global.anim_iter] = iter_img; |
| 991 |
# } |
| 992 |
global.logo_glow_sprite.SetOpacity(glow_opacity); |
| 993 |
global.anim_iter++; |
| 994 |
|
| 995 |
if (global.anim_iter >= NB_ANIM_STEPS) { |
| 996 |
global.anim_status = "stopped"; |
| 997 |
} |
| 998 |
} |
| 999 |
} |
| 1000 |
|
| 1001 |
#-----------------------------------------Refresh stuff -------------------------------- |
| 1002 |
# |
| 1003 |
# Calling Plymouth.SetRefreshFunction with a function will set that function to be |
| 1004 |
# called up to 50 times every second, e.g. |
| 1005 |
# |
| 1006 |
# NOTE: if a refresh function is not set, Plymouth doesn't seem to be able to update |
| 1007 |
# the screen correctly |
| 1008 |
# |
| 1009 |
fun refresh_callback () |
| 1010 |
{ |
| 1011 |
global.refresh_iter++; |
| 1012 |
if (global.refresh_iter == NB_REFRESHS_BETWEEN_ANIMS) { |
| 1013 |
global.refresh_iter = 0; |
| 1014 |
update_glow_anim(); |
| 1015 |
} |
| 1016 |
#DebugBottom ("refresh_iter=" + refresh_iter + "; anim_status=" + anim_status + "; anim_start_time=" + anim_start_time + "; anim_iter=" + anim_iter); |
| 1017 |
} |
| 1018 |
Plymouth.SetRefreshFunction (refresh_callback); |
| 1019 |
|
| 1020 |
|
| 1021 |
#-----------------------------------------Display Normal stuff ----------------------- |
| 1022 |
# |
| 1023 |
# The callback function is called when the display should return to normal |
| 1024 |
fun display_normal_callback () |
| 1025 |
{ |
| 1026 |
global.status = "normal"; |
| 1027 |
if (global.password_dialogue) { |
| 1028 |
password_dialogue_opacity (0); |
| 1029 |
global.password_dialogue = NULL; |
| 1030 |
if (message_notification[2].sprite) hide_message(2); |
| 1031 |
prompt_active = 0; |
| 1032 |
} |
| 1033 |
|
| 1034 |
if (message_notification[1].sprite) { |
| 1035 |
show_message (1); |
| 1036 |
} |
| 1037 |
|
| 1038 |
} |
| 1039 |
|
| 1040 |
Plymouth.SetDisplayNormalFunction (display_normal_callback); |
| 1041 |
|
| 1042 |
|
| 1043 |
#----------------------------------------- Quit -------------------------------- |
| 1044 |
|
| 1045 |
fun quit_callback () |
| 1046 |
{ |
| 1047 |
} |
| 1048 |
|
| 1049 |
Plymouth.SetQuitFunction(quit_callback); |