Plymouth/lines: fix alignment of fsckd ctrl-c message
This commit is contained in:
@@ -207,7 +207,7 @@ fun StringString(string, substring) {
|
||||
}
|
||||
start++;
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ fun StringCopy (source, beginning, end) {
|
||||
for (index = beginning; ( ( (end == NULL) || (index <= end) ) && (String(source).CharAt(index)) ); index++) {
|
||||
local.destination += String(source).CharAt(index);
|
||||
}
|
||||
|
||||
|
||||
return local.destination;
|
||||
}
|
||||
|
||||
@@ -313,14 +313,14 @@ fun animate_progress_indicator (time, progress) {
|
||||
fun get_message_label (label, is_fake, is_action_line) {
|
||||
#Debug("Get Label position");
|
||||
local.message_label;
|
||||
|
||||
|
||||
if (is_fake)
|
||||
# Create a fake label so as to get the y coordinate of
|
||||
# a standard-length label.
|
||||
local.message_image = ImageFromTintedText ("This is a fake message");
|
||||
else
|
||||
local.message_image = (is_action_line) && ImageFromActionText (label) || ImageFromTintedText (label);
|
||||
|
||||
|
||||
message_label.width = message_image.GetWidth ();
|
||||
message_label.height = message_image.GetHeight ();
|
||||
|
||||
@@ -335,13 +335,13 @@ fun get_message_label (label, is_fake, is_action_line) {
|
||||
message_label.y = local.fsck_label.y + (first_line_height * 1.5);
|
||||
}
|
||||
|
||||
# Debug("action label x = " + message_label.x + " y = " + message_label.y );
|
||||
#Debug("action label x = " + message_label.x + " y = " + message_label.y );
|
||||
|
||||
# message_debug = "msg_x = " + message_label.x + " msg_y = " + message_label.y +
|
||||
# "msg_width = " + message_label.width + " msg_height = " +
|
||||
# message_label.height + " message = " + label;
|
||||
# Debug(message_debug);
|
||||
|
||||
|
||||
return message_label;
|
||||
|
||||
}
|
||||
@@ -350,28 +350,28 @@ fun get_message_label (label, is_fake, is_action_line) {
|
||||
fun get_fsck_label (label, is_fake) {
|
||||
# Debug("Get Label position");
|
||||
local.fsck_label = global.progress_label;
|
||||
|
||||
|
||||
if (is_fake)
|
||||
fsck_label.image = ImageFromTintedText ("This is a fake message");
|
||||
else
|
||||
fsck_label.image = ImageFromTintedText (label);
|
||||
|
||||
|
||||
fsck_label.width = fsck_label.image.GetWidth ();
|
||||
fsck_label.height = fsck_label.image.GetHeight ();
|
||||
|
||||
|
||||
# Centre the label horizontally
|
||||
fsck_label.x = Window.GetX () + Window.GetWidth () / 2 - fsck_label.width / 2;
|
||||
|
||||
|
||||
local.first_label = get_message_label (label, 1, 0);
|
||||
|
||||
|
||||
# Place the label below the 1st message line
|
||||
fsck_label.y = local.first_label.y + local.first_label.height + (local.first_label.height / 2);
|
||||
|
||||
|
||||
# message_debug = "msg_x = " + fsck_label.x + " msg_y = " + fsck_label.y +
|
||||
# "msg_width = " + fsck_label.width + " msg_height = " +
|
||||
# fsck_label.height + " message = " + label;
|
||||
# Debug(message_debug);
|
||||
|
||||
|
||||
return fsck_label;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ fun setup_message (message_text, x, y, z, index) {
|
||||
message_notification[index].x = x;
|
||||
message_notification[index].y = y;
|
||||
message_notification[index].z = z;
|
||||
|
||||
|
||||
message_notification[index].sprite = Sprite ();
|
||||
message_notification[index].sprite.SetImage (message_notification[index].image);
|
||||
message_notification[index].sprite.SetX (message_notification[index].x);
|
||||
@@ -417,12 +417,12 @@ fun message_callback (message)
|
||||
# Debug("Message callback");
|
||||
is_fake = 0;
|
||||
if (!message || (message == "")) is_fake = 1;
|
||||
|
||||
|
||||
local.substring = "keys:";
|
||||
|
||||
|
||||
# Look for the "keys:" prefix
|
||||
local.keys = StringString(message, local.substring);
|
||||
|
||||
|
||||
local.is_action_line = (keys != NULL);
|
||||
#Debug("keys " + local.keys + " substring length = " + StringLength(local.substring));
|
||||
|
||||
@@ -439,7 +439,7 @@ fun message_callback (message)
|
||||
local.label.is_fake = is_fake;
|
||||
label = get_message_label(message, is_fake, is_action_line);
|
||||
label.z = 10000;
|
||||
|
||||
|
||||
setup_message (message, label.x, label.y, label.z, is_action_line);
|
||||
if (prompt_active && local.is_action_line)
|
||||
hide_message (is_action_line);
|
||||
@@ -454,28 +454,28 @@ fun message_callback (message)
|
||||
|
||||
fun password_dialogue_setup (message_label) {
|
||||
#Debug("Password dialog setup");
|
||||
|
||||
|
||||
local.entry;
|
||||
local.bullet_image;
|
||||
|
||||
|
||||
bullet_image = Image (password_dot_filename);
|
||||
entry.image = Image (password_field_filename);
|
||||
|
||||
|
||||
# Hide the normal labels
|
||||
prompt_active = 1;
|
||||
if (message_notification[1].sprite) hide_message (1);
|
||||
|
||||
|
||||
# Set the prompt label
|
||||
label = get_message_label(message_label, 0, 1);
|
||||
label.z = 10000;
|
||||
|
||||
|
||||
setup_message (message_label, label.x, label.y, label.z, 2);
|
||||
show_message (2);
|
||||
|
||||
# Set up the text entry which contains the bullets
|
||||
entry.sprite = Sprite ();
|
||||
entry.sprite.SetImage (entry.image);
|
||||
|
||||
|
||||
# Centre the box horizontally
|
||||
entry.x = Window.GetX () + Window.GetWidth () / 2 - entry.image.GetWidth () / 2;
|
||||
|
||||
@@ -500,7 +500,7 @@ fun password_dialogue_opacity (opacity) {
|
||||
# entry.sprite.SetOpacity (0.3);
|
||||
entry.sprite.SetOpacity (opacity);
|
||||
label.sprite.SetOpacity (opacity);
|
||||
|
||||
|
||||
if (bullets) {
|
||||
for (index = 0; bullets[index]; index++) {
|
||||
bullets[index].sprite.SetOpacity (opacity);
|
||||
@@ -600,7 +600,7 @@ fun clear_fsck_count () {
|
||||
fun set_progress_label_opacity (opacity) {
|
||||
# the label
|
||||
progress_label.sprite.SetOpacity (opacity);
|
||||
|
||||
|
||||
# Make the slot available again when hiding the bar
|
||||
# So that another bar can take its place
|
||||
if (opacity == 0) {
|
||||
@@ -639,17 +639,17 @@ fun update_progress_label (progress) {
|
||||
# This happens when only counter.total has changed.
|
||||
if (progress != NULL) {
|
||||
progress_label.progress = progress;
|
||||
|
||||
|
||||
#Debug("device " + progress_label.device + " progress " + progress);
|
||||
|
||||
|
||||
# If progress >= 100% hide the label and make it available again
|
||||
if (progress >= 100) {
|
||||
set_progress_label_opacity (0);
|
||||
|
||||
|
||||
# See if we any other fsck check is complete
|
||||
# and, if so, hide the progress bars and the labels
|
||||
on_fsck_completed ();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -666,7 +666,7 @@ fun update_progress_label (progress) {
|
||||
#progress_label.progress = progress;
|
||||
|
||||
progress_label.sprite = Sprite (progress_label.image);
|
||||
|
||||
|
||||
# Set up the bar
|
||||
progress_label.sprite.SetPosition(progress_label.x, progress_label.y, 1);
|
||||
|
||||
@@ -710,7 +710,7 @@ fun add_fsck_to_queue (device, progress) {
|
||||
continue;
|
||||
}
|
||||
local.index = i;
|
||||
|
||||
|
||||
# Set device and progress
|
||||
global.fsck_queue[local.index].device = device;
|
||||
global.fsck_queue[local.index].progress = progress;
|
||||
@@ -740,7 +740,7 @@ fun is_progress_label_available () {
|
||||
fun on_queued_fsck_completed () {
|
||||
if (!is_queue_empty ())
|
||||
return;
|
||||
|
||||
|
||||
# Hide the extra label, if any
|
||||
#if (progress_bar.extra_label.sprite)
|
||||
# progress_bar.extra_label.sprite.SetOpacity(0);
|
||||
@@ -754,7 +754,7 @@ fun remove_fsck_from_queue (index) {
|
||||
|
||||
# Decrease the queue counter
|
||||
global.fsck_queue.counter--;
|
||||
|
||||
|
||||
# See if there are other processes in the queue
|
||||
# if not, clear the extra_label
|
||||
on_queued_fsck_completed ();
|
||||
@@ -766,14 +766,14 @@ fun on_fsck_completed () {
|
||||
|
||||
if (!is_progress_label_available ())
|
||||
return;
|
||||
|
||||
|
||||
if (!is_queue_empty ())
|
||||
return;
|
||||
|
||||
|
||||
# Hide the progress label
|
||||
if (progress_label.sprite)
|
||||
progress_label.sprite.SetOpacity (0);
|
||||
|
||||
|
||||
# Clear the queue
|
||||
clear_queue ();
|
||||
|
||||
@@ -789,10 +789,10 @@ fun update_progress_in_queue (index, device, progress) {
|
||||
on_queued_fsck_completed ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
global.fsck_queue[index].device = device;
|
||||
global.fsck_queue[index].progress = progress;
|
||||
|
||||
|
||||
}
|
||||
|
||||
# TODO: Move it to some function
|
||||
@@ -821,7 +821,7 @@ fun fsck_check (device, progress, status_string) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (device_has_progress_label (device)) {
|
||||
# Update the progress of the existing label
|
||||
update_progress_label (progress);
|
||||
@@ -832,11 +832,11 @@ fun fsck_check (device, progress, status_string) {
|
||||
|
||||
# See if the progress_label is available
|
||||
if (progress_label.is_available) {
|
||||
|
||||
|
||||
# local.my_string = "available index " + local.available_index + " progress_bar counter is " + progress_bar.counter;
|
||||
# Debug(local.my_string);
|
||||
|
||||
|
||||
|
||||
|
||||
# If the fsck check for the device was in the queue, then
|
||||
# remove it from the queue
|
||||
if (local.queue_device_index >= 0) {
|
||||
@@ -846,18 +846,18 @@ fun fsck_check (device, progress, status_string) {
|
||||
# Increase the fsck counter
|
||||
increase_fsck_count ();
|
||||
}
|
||||
|
||||
|
||||
# local.my_string += local.message;
|
||||
#Debug("setting new label for device " + device + " progress " + progress);
|
||||
|
||||
# Set up a new label for the check
|
||||
init_progress_label (device, status_string);
|
||||
update_progress_label (progress);
|
||||
|
||||
|
||||
}
|
||||
# If the progress_label is not available
|
||||
else {
|
||||
|
||||
|
||||
# If the fsck check for the device is already in the queue
|
||||
# just update its progress in the queue
|
||||
if (local.queue_device_index >= 0) {
|
||||
@@ -874,10 +874,10 @@ fun fsck_check (device, progress, status_string) {
|
||||
|
||||
refresh_progress_label ();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# if (!is_queue_empty ()) {
|
||||
# DebugBottom("Extra label for "+ device);
|
||||
#}
|
||||
@@ -904,10 +904,10 @@ fun fsck_check (device, progress, status_string) {
|
||||
fun update_status_callback (status) {
|
||||
# Debug(status);
|
||||
if (!status) return;
|
||||
|
||||
|
||||
string_it = 0;
|
||||
update_strings[string_it] = "";
|
||||
|
||||
|
||||
for (i=0; (String(status).CharAt(i) != ""); i++) {
|
||||
local.temp_char = String(status).CharAt(i);
|
||||
if (temp_char != ":")
|
||||
@@ -915,21 +915,21 @@ fun update_status_callback (status) {
|
||||
else
|
||||
update_strings[++string_it] = "";
|
||||
}
|
||||
|
||||
|
||||
# my_string = update_strings[0] + " " + update_strings[1] + " " + update_strings[2];
|
||||
# Debug(my_string);
|
||||
# Let's assume that we're dealing with these strings fsck:sda1:40
|
||||
if ((string_it >= 2) && (update_strings[0] == "fsck")) {
|
||||
|
||||
|
||||
device = update_strings[1];
|
||||
progress = update_strings[2];
|
||||
status_string[0] = update_strings[3]; # "Checking disk %1$d of %2$d (%3$d %% complete)"
|
||||
if (!status_string[0])
|
||||
status_string[0] = "Checking disk %1$d of %2$d (%3$d %% complete)";
|
||||
|
||||
|
||||
if ((device != "") && (progress != "")) {
|
||||
progress = StringToInteger (progress);
|
||||
|
||||
|
||||
# Make sure that the fsck_queue is initialised
|
||||
if (!global.fsck_queue)
|
||||
init_queue ();
|
||||
@@ -940,11 +940,11 @@ fun update_status_callback (status) {
|
||||
|
||||
# if (!global.progress_bar.extra_label.sprite)
|
||||
# create_extra_fsck_label ();
|
||||
|
||||
|
||||
# Keep track of the fsck check
|
||||
fsck_check (device, progress, status_string);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
# systemd-fsckd pass fsckd:<number_devices>:<progress>:<l10n_string>
|
||||
|
||||
Reference in New Issue
Block a user