Merge lp:~codygarver/elementaryos/default-settings-plymouth-theme into lp:~elementary-os/elementaryos/default-settings-loki

Proposed by Cody Garver
Status: Merged
Merged at revision: 178
Proposed branch: lp:~codygarver/elementaryos/default-settings-plymouth-theme
Merge into: lp:~elementary-os/elementaryos/default-settings-loki
Diff against target: 1125 lines (+1061/-0)
9 files modified
debian/control (+16/-0)
debian/plymouth-theme-elementary.install (+2/-0)
debian/plymouth-theme-elementary.postinst (+44/-0)
debian/plymouth-theme-elementary.postrm (+12/-0)
debian/plymouth-theme-elementary.prerm (+10/-0)
plymouth/elementary-logo/elementary.grub (+3/-0)
plymouth/elementary-logo/elementary.plymouth (+8/-0)
plymouth/elementary-logo/elementary.script (+955/-0)
plymouth/elementary-text/ubuntu-text.plymouth (+11/-0)
To merge this branch: bzr merge lp:~codygarver/elementaryos/default-settings-plymouth-theme
Reviewer Review Type Date Requested Status
elementary OS team Pending
Review via email: mp+282714@code.launchpad.net
To post a comment you must log in.
169. By Cody Garver

Satisfy lintian transitional-package-should-be-oldlibs-extra

170. By Cody Garver

Merge in trunk

171. By Cody Garver

Merge trunk

172. By Cody Garver

plymouth-theme-elementary-text: extended description to satisfy lintian

173. By Cody Garver

plymouth-theme-elementary: extended description to satisfy lintian

174. By Cody Garver

Merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2016-01-15 11:39:48 +0000
+++ debian/control 2016-01-15 14:18:25 +0000
@@ -38,3 +38,19 @@
38Replaces: cups-filters, print-test-page-elementary38Replaces: cups-filters, print-test-page-elementary
39Description: printer test page for elementary39Description: printer test page for elementary
40 Printer test page for elementary OS.40 Printer test page for elementary OS.
41
42Package: plymouth-theme-elementary
43Architecture: all
44Depends: ${misc:Depends}, plymouth, plymouth-label
45Provides: plymouth-theme
46Description: changes the plymouth theme to elementary OS
47 Changes the plymouth theme to the official elementary OS theme.
48
49Package: plymouth-theme-elementary-text
50Section: oldlibs
51Priority: extra
52Architecture: all
53Depends: plymouth-theme-elementary
54Description: Dummy transitional package
55 This package is transitional to plymouth-theme-elementary.
56 It can be safely removed after upgrade to elementary OS 0.4 Freya.
4157
=== added file 'debian/plymouth-theme-elementary.install'
--- debian/plymouth-theme-elementary.install 1970-01-01 00:00:00 +0000
+++ debian/plymouth-theme-elementary.install 2016-01-15 14:18:25 +0000
@@ -0,0 +1,2 @@
1plymouth/elementary-logo/ usr/share/plymouth/themes/
2plymouth/elementary-text/ usr/share/plymouth/themes/
03
=== added file 'debian/plymouth-theme-elementary.postinst'
--- debian/plymouth-theme-elementary.postinst 1970-01-01 00:00:00 +0000
+++ debian/plymouth-theme-elementary.postinst 2016-01-15 14:18:25 +0000
@@ -0,0 +1,44 @@
1#!/bin/sh -e
2# This script can be called in the following ways:
3#
4# After the package was installed:
5# <postinst> configure <old-version>
6#
7#
8# If prerm fails during upgrade or fails on failed upgrade:
9# <old-postinst> abort-upgrade <new-version>
10#
11# If prerm fails during deconfiguration of a package:
12# <postinst> abort-deconfigure in-favour <new-package> <version>
13# removing <old-package> <version>
14#
15# If prerm fails during replacement due to conflict:
16# <postinst> abort-remove in-favour <new-package> <version>
17
18
19case "$1" in
20 configure)
21 update-alternatives \
22 --install /usr/share/plymouth/themes/default.plymouth default.plymouth \
23 /usr/share/plymouth/themes/elementary/elementary.plymouth 100 \
24 --slave /usr/share/plymouth/themes/default.grub default.plymouth.grub \
25 /usr/share/plymouth/themes/elementary/elementary.grub
26
27 if which update-initramfs >/dev/null 2>&1
28 then
29 echo FRAMEBUFFER=y | tee /etc/initramfs-tools/conf.d/splash
30 update-initramfs -u
31 fi
32 ;;
33
34 abort-upgrade|abort-deconfigure|abort-remove)
35 ;;
36
37 *)
38 echo "$0 called with unknown argument \`$1'" 1>&2
39 exit 1
40 ;;
41esac
42
43#DEBHELPER#
44exit 0
045
=== added file 'debian/plymouth-theme-elementary.postrm'
--- debian/plymouth-theme-elementary.postrm 1970-01-01 00:00:00 +0000
+++ debian/plymouth-theme-elementary.postrm 2016-01-15 14:18:25 +0000
@@ -0,0 +1,12 @@
1#!/bin/sh
2
3set -e
4
5if [ "x$1" = xremove ]; then
6 if which update-initramfs >/dev/null 2>&1
7 then
8 update-initramfs -u
9 fi
10fi
11
12#DEBHELPER#
013
=== added file 'debian/plymouth-theme-elementary.prerm'
--- debian/plymouth-theme-elementary.prerm 1970-01-01 00:00:00 +0000
+++ debian/plymouth-theme-elementary.prerm 2016-01-15 14:18:25 +0000
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3set -e
4
5if [ "x$1" = xremove ]; then
6 update-alternatives \
7 --remove default.plymouth /usr/share/plymouth/themes/elementary/elementary.plymouth
8fi
9
10#DEBHELPER#
011
=== added directory 'plymouth'
=== added directory 'plymouth/elementary-logo'
=== added file 'plymouth/elementary-logo/elementary.grub'
--- plymouth/elementary-logo/elementary.grub 1970-01-01 00:00:00 +0000
+++ plymouth/elementary-logo/elementary.grub 2016-01-15 14:18:25 +0000
@@ -0,0 +1,3 @@
1if background_color 0,0,0; then
2 clear
3fi
04
=== added file 'plymouth/elementary-logo/elementary.plymouth'
--- plymouth/elementary-logo/elementary.plymouth 1970-01-01 00:00:00 +0000
+++ plymouth/elementary-logo/elementary.plymouth 2016-01-15 14:18:25 +0000
@@ -0,0 +1,8 @@
1[Plymouth Theme]
2Name=elementary
3Description=A theme that features a blank background with a logo.
4ModuleName=script
5
6[script]
7ImageDir=/usr/share/plymouth/themes/elementary
8ScriptFile=/usr/share/plymouth/themes/elementary/elementary.script
09
=== added file 'plymouth/elementary-logo/elementary.script'
--- plymouth/elementary-logo/elementary.script 1970-01-01 00:00:00 +0000
+++ plymouth/elementary-logo/elementary.script 2016-01-15 14:18:25 +0000
@@ -0,0 +1,955 @@
1# ubuntu-logo.script - boot splash plugin
2#
3# Copyright (C) 2009 Canonical Ltd.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2, or (at your option)
8# any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18# 02111-1307, USA.
19#
20# Written by: Sergey "Shnatsel" Davidoff <sergey@elementaryos.org>
21#
22# Based on the example provided with the "script plugin" written by:
23# Charlie Brej <cbrej@cs.man.ac.uk>
24# and on "ubuntu-logo" theme written by:
25# Alberto Milone <alberto.milone@canonical.com>
26#
27
28# Set the text colour in (rgb / 256)
29text_colour.red = 1.0;
30text_colour.green = 1.0;
31text_colour.blue = 1.0;
32
33# Tinted text #e2e3e3
34tinted_text_colour.red = 0.83;
35tinted_text_colour.green = 0.84;
36tinted_text_colour.blue = 0.84;
37
38# Action Text - #ffffff - RGB 255 255 255
39action_text_colour.red = 1.0;
40action_text_colour.green = 1.0;
41action_text_colour.blue = 1.0;
42
43# Orange - #ff4012 - RGB 255 64 18
44debugsprite = Sprite();
45debugsprite_bottom = Sprite();
46debugsprite_medium = Sprite();
47
48# are we currently prompting for a password?
49prompt_active = 0;
50
51# General purpose function to create text
52fun WriteText (text, colour) {
53 image = Image.Text (text, colour.red, colour.green, colour.blue);
54 return image;
55}
56
57fun ImageToText (text) {
58 image = WriteText (text, text_colour);
59 return image;
60}
61
62fun ImageToTintedText (text) {
63 image = WriteText (text, tinted_text_colour);
64 return image;
65}
66
67fun ImageToActionText (text) {
68 image = WriteText (text, action_text_colour);
69 return image;
70}
71
72fun Debug(text) {
73 debugsprite.SetImage(ImageToText (text));
74}
75
76fun DebugBottom(text) {
77 debugsprite_bottom.SetImage(ImageToText (text));
78 debugsprite_bottom.SetPosition(0, (Window.GetHeight (0) - 20), 1);
79}
80
81fun DebugMedium(text) {
82 debugsprite_medium.SetImage(ImageToText (text));
83 debugsprite_medium.SetPosition(0, (Window.GetHeight (0) - 60), 1);
84}
85
86fun TextYOffset() {
87 local.y;
88 local.text_height;
89 local.min_height;
90
91 # Put the 1st line below the logo + some spacing
92 y = logo.y + logo.height + logo_spacing; # + (progress_indicator.bullet_height * 7 );
93
94 text_height = first_line_height * 2;
95
96 min_height = Window.GetHeight();
97 if (y + text_height > min_height)
98 y = min_height - text_height;
99
100 # Debug("logo.y = " + logo.y + " logo.height = " + logo.height );
101
102 return y;
103}
104
105#------------------------------String functions-------------------------------
106
107# This is the equivalent for strstr()
108fun StringString(string, substring) {
109 start = 0;
110 while (String(string).CharAt (start)) {
111 walk = 0;
112 while (String(substring).CharAt (walk) == String(string).CharAt (start + walk) ) {
113 walk++;
114 if (!String(substring).CharAt (walk)) return start;
115 }
116 start++;
117 }
118
119 return NULL;
120}
121
122fun StringLength (string) {
123 index = 0;
124 while (String(string).CharAt(index)) index++;
125 return index;
126}
127
128fun StringCopy (source, beginning, end) {
129 local.destination = "";
130 for (index = beginning; ( ( (end == NULL) || (index <= end) ) && (String(source).CharAt(index)) ); index++) {
131 local.destination += String(source).CharAt(index);
132 }
133
134 return local.destination;
135}
136
137fun StringReplace (source, pattern, replacement) {
138 local.found = StringString(source, pattern);
139 if (local.found == NULL)
140 return source;
141
142 local.new_string = StringCopy (source, 0, local.found - 1) +
143 replacement +
144 StringCopy (source, local.found + StringLength(pattern), NULL);
145
146 return local.new_string;
147}
148
149# it makes sense to use it only for
150# numbers up to 100
151fun StringToInteger (str) {
152 int = -1;
153 for (i=0; i<=100; i++) {
154 if (i+"" == str) {
155 int = i;
156 break;
157 }
158 }
159 return int;
160}
161
162#-----------------------------------------------------------------------------
163Window.SetBackgroundTopColor (0.00, 0.00, 0.00); # Nice colour on top of the screen fading to
164Window.SetBackgroundBottomColor (0.00, 0.00, 0.00); # an equally nice colour on the bottom
165
166bits_per_pixel = Window.GetBitsPerPixel ();
167if (bits_per_pixel == 4) {
168 logo_filename = "ubuntu_logo16.png";
169 progress_dot_off_filename = "progress_dot_off16.png";
170 progress_dot_on_filename = "progress_dot_on16.png";
171 password_field_filename = "password_field16.png";
172} else {
173 logo_filename = "logo.png";
174 blurred_logo_filename = "logo_blurred.png";
175 progress_dot_off_filename = "progress_dot_off.png";
176 progress_dot_on_filename = "progress_dot_on.png";
177 password_field_filename = "password_field.png";
178}
179
180logo.screen_size = Math.Sqrt ( Window.GetHeight () * Window.GetWidth () / 18 );
181
182logo.image = Image (logo_filename).Scale (logo.screen_size, logo.screen_size);
183logo.sprite = Sprite ();
184logo.sprite.SetImage (logo.image);
185logo.width = logo.image.GetWidth ();
186logo.height = logo.image.GetHeight ();
187logo.x = Window.GetX () + Window.GetWidth () / 2 - logo.width / 2;
188logo.y = Window.GetY () + Window.GetHeight () / 2 - logo.height / 2 ;
189logo.z = 1000;
190logo.sprite.SetX (logo.x);
191logo.sprite.SetY (logo.y);
192logo.sprite.SetZ (logo.z);
193if (Plymouth.GetMode () == "boot" || Plymouth.GetMode () == "resume") {
194 logo.sprite.SetOpacity (0); # for init puproses only; superseded by opacity angle below
195 logo.opacity_angle = Math.Pi; # we'll need it later for cosine fade-in
196}
197else if (Plymouth.GetMode () == "shutdown" || Plymouth.GetMode () == "suspend") {
198 logo.sprite.SetOpacity (1); # for init puproses only; superseded by opacity angle below
199 logo.opacity_angle = 0; # we'll need it later for cosine fade-in
200}
201
202# assumes the blurred image has the same size as the main one
203logo_blurred.image = Image (blurred_logo_filename).Scale (logo.screen_size, logo.screen_size);
204logo_blurred.sprite = Sprite ();
205logo_blurred.sprite.SetImage (logo_blurred.image);
206logo_blurred.width = logo_blurred.image.GetWidth ();
207logo_blurred.height = logo_blurred.image.GetHeight ();
208logo_blurred.x = Window.GetX () + Window.GetWidth () / 2 - logo_blurred.width / 2;
209logo_blurred.y = Window.GetY () + Window.GetHeight () / 2 - logo_blurred.height / 2;
210logo_blurred.z = 999;
211logo_blurred.sprite.SetX (logo_blurred.x);
212logo_blurred.sprite.SetY (logo_blurred.y);
213logo_blurred.sprite.SetZ (logo_blurred.z);
214logo_blurred.sprite.SetOpacity (0);
215logo_blurred.opacity_angle = Math.Pi; # we'll need it later for cosine fade-in
216
217# Spacing below the logo - in pixels
218logo_spacing = logo.height / 8;
219
220message_notification[0].image = ImageToTintedText ("");
221message_notification[1].image = ImageToTintedText ("");
222fsck_notification.image = ImageToActionText ("");
223
224status = "normal";
225
226# use a fixed string with ascending and descending stems to calibrate the
227# bounding box for the first message, so the messages below don't move up
228# and down according to *their* height.
229first_line_height = ImageToTintedText ("AfpqtM").GetHeight();
230
231# if the user has a 640x480 or 800x600 display, we can't quite fit everything
232# (including passphrase prompts) with the target spacing, so scoot the text up
233# a bit if needed.
234top_of_the_text = TextYOffset();
235
236#-----------------------------------------Label utility functions---------------------
237
238# label should be either a string or NULL
239# Images for n lines will be created and returned as items of the
240# message_label array
241#
242fun get_message_label (label, is_fake, is_action_line) {
243 # Debug("Get Label position");
244 local.message_label;
245
246 if (is_fake)
247 # Create a fake label so as to get the y coordinate of
248 # a standard-length label.
249 local.message_image = ImageToTintedText ("This is a fake message");
250 else
251 local.message_image = (is_action_line) && ImageToActionText (label) || ImageToTintedText (label);
252
253 message_label.width = message_image.GetWidth ();
254 message_label.height = message_image.GetHeight ();
255
256 # Center the line horizontally
257 message_label.x = Window.GetX () + Window.GetWidth () / 2 - message_label.width / 2;
258
259 message_label.y = top_of_the_text;
260
261 # Put the 2nd line below the fsck line
262 if (is_action_line) {
263 local.fsck_label.y = message_label.y + (first_line_height + first_line_height / 2);
264 message_label.y = local.fsck_label.y + (first_line_height * 2);
265 }
266
267 # Debug("action label x = " + message_label.x + " y = " + message_label.y );
268
269# message_debug = "msg_x = " + message_label.x + " msg_y = " + message_label.y +
270# "msg_width = " + message_label.width + " msg_height = " +
271# message_label.height + " message = " + label;
272# Debug(message_debug);
273
274 return message_label;
275
276}
277
278# Create an fsck label and/or get its position
279fun get_fsck_label (label, is_fake) {
280 # Debug("Get Label position");
281 local.fsck_label = global.progress_label;
282
283 if (is_fake)
284 fsck_label.image = ImageToTintedText ("This is a fake message");
285 else
286 fsck_label.image = ImageToTintedText (label);
287
288 fsck_label.width = fsck_label.image.GetWidth ();
289 fsck_label.height = fsck_label.image.GetHeight ();
290
291 # Centre the label horizontally
292 fsck_label.x = Window.GetX () + Window.GetWidth () / 2 - fsck_label.width / 2;
293
294 local.first_label = get_message_label (label, 1, 0);
295
296 # Place the label below the 1st message line
297 fsck_label.y = local.first_label.y + local.first_label.height + (local.first_label.height / 2);
298
299# message_debug = "msg_x = " + fsck_label.x + " msg_y = " + fsck_label.y +
300# "msg_width = " + fsck_label.width + " msg_height = " +
301# fsck_label.height + " message = " + label;
302# Debug(message_debug);
303
304 return fsck_label;
305}
306
307#-----------------------------------------Message stuff --------------------------------
308#
309
310# Set up a message label
311#
312# NOTE: this is called when doing something like 'plymouth message "hello world"'
313#
314fun setup_message (message_text, x, y, z, index) {
315 # Debug("Message setup");
316 global.message_notification[index].image = (index) && ImageToActionText (message_text) || ImageToTintedText (message_text);
317
318 # Set up the text message, if any
319 message_notification[index].x = x;
320 message_notification[index].y = y;
321 message_notification[index].z = z;
322
323 message_notification[index].sprite = Sprite ();
324 message_notification[index].sprite.SetImage (message_notification[index].image);
325 message_notification[index].sprite.SetX (message_notification[index].x);
326 message_notification[index].sprite.SetY (message_notification[index].y);
327 message_notification[index].sprite.SetZ (message_notification[index].z);
328
329}
330
331fun show_message (index) {
332 if (global.message_notification[index].sprite) global.message_notification[index].sprite.SetOpacity(1);
333}
334
335fun hide_message (index) {
336 if (global.message_notification[index].sprite) global.message_notification[index].sprite.SetOpacity(0);
337}
338
339
340
341
342# the callback function is called when new message should be displayed.
343# First arg is message to display.
344fun message_callback (message)
345{
346 # Debug("Message callback");
347 is_fake = 0;
348 if (!message || (message == "")) is_fake = 1;
349
350 local.substring = "keys:";
351
352 # Look for the "keys:" prefix
353 local.keys = StringString(message, local.substring);
354
355 local.is_action_line = (keys != NULL);
356 #Debug("keys " + local.keys + " substring length = " + StringLength(local.substring));
357
358 # Get the message without the "keys:" prefix
359 if (keys != NULL)
360 message = StringCopy (message, keys + StringLength(local.substring), NULL);
361
362 local.label.is_fake = is_fake;
363 label = get_message_label(message, is_fake, is_action_line);
364 label.z = 10000;
365
366 setup_message (message, label.x, label.y, label.z, is_action_line);
367 if (prompt_active && local.is_action_line)
368 hide_message (is_action_line);
369 else
370 show_message (is_action_line);
371
372}
373
374
375#-----------------------------------------Display Password stuff -----------------------
376#
377
378fun password_dialogue_setup (message_label) {
379 # Debug("Password dialog setup");
380
381 local.entry;
382 local.bullet_image;
383
384 bullet_image = Image (progress_dot_off_filename);
385 entry.image = Image (password_field_filename);
386
387 # Hide the normal labels
388 prompt_active = 1;
389 if (message_notification[1].sprite) hide_message (1);
390
391 # Set the prompt label
392 label = get_message_label(message_label, 0, 1);
393 label.z = 10000;
394
395 setup_message (message_label, label.x, label.y, label.z, 2);
396 show_message (2);
397
398 # Set up the text entry which contains the bullets
399 entry.sprite = Sprite ();
400 entry.sprite.SetImage (entry.image);
401
402 # Centre the box horizontally
403 entry.x = Window.GetX () + Window.GetWidth () / 2 - entry.image.GetWidth () / 2;
404
405 # Put the entry below the second label.
406 entry.y = message_notification[2].y + label.height;
407
408 #Debug ("entry x = " + entry.x + ", y = " + entry.y);
409 entry.z = 10000;
410 entry.sprite.SetX (entry.x);
411 entry.sprite.SetY (entry.y);
412 entry.sprite.SetZ (entry.z);
413
414 global.password_dialogue = local;
415}
416
417fun password_dialogue_opacity (opacity) {
418 # Debug("Password dialog opacity");
419 global.password_dialogue.opacity = opacity;
420 local = global.password_dialogue;
421
422 # You can make the box translucent with a float
423 # entry.sprite.SetOpacity (0.3);
424 entry.sprite.SetOpacity (opacity);
425 label.sprite.SetOpacity (opacity);
426
427 if (bullets) {
428 for (index = 0; bullets[index]; index++) {
429 bullets[index].sprite.SetOpacity (opacity);
430 }
431 }
432}
433
434
435# The callback function is called when the display should display a password dialogue.
436# First arg is prompt string, the second is the number of bullets.
437fun display_password_callback (prompt, bullets) {
438 # Debug("Password dialog setup");
439
440 global.status = "password";
441 if (!global.password_dialogue) password_dialogue_setup(prompt);
442 password_dialogue_opacity (1);
443 bullet_width = password_dialogue.bullet_image.GetWidth();
444 bullet_y = password_dialogue.entry.y +
445 password_dialogue.entry.image.GetHeight () / 2 -
446 password_dialogue.bullet_image.GetHeight () / 2;
447 margin = bullet_width;
448 spaces = Math.Int( (password_dialogue.entry.image.GetWidth () - (margin * 2)) / (bullet_width / 2 ) );
449 #Debug ("spaces = " + spaces + ", bullets = " + bullets);
450 bullets_area.width = margin + spaces * (bullet_width / 2);
451 bullets_area.x = Window.GetX () + Window.GetWidth () / 2 - bullets_area.width / 2;
452 #DebugBottom ("pwd_entry x = " + password_dialogue.entry.x + ", bullets_area.x = " + bullets_area.x + ", bullets_area.width = " + bullets_area.width);
453 if (bullets > spaces)
454 bullets = spaces;
455 for (index = 0; password_dialogue.bullets[index] || index < bullets; index++){
456 if (!password_dialogue.bullets[index]) {
457 password_dialogue.bullets[index].sprite = Sprite ();
458 password_dialogue.bullets[index].sprite.SetImage (password_dialogue.bullet_image);
459 password_dialogue.bullets[index].x = bullets_area.x + # password_dialogue.entry.x + margin +
460 index * bullet_width / 2;
461 password_dialogue.bullets[index].sprite.SetX (password_dialogue.bullets[index].x);
462 password_dialogue.bullets[index].y = bullet_y;
463 password_dialogue.bullets[index].sprite.SetY (password_dialogue.bullets[index].y);
464 password_dialogue.bullets[index].z = password_dialogue.entry.z + 1;
465 password_dialogue.bullets[index].sprite.SetZ (password_dialogue.bullets[index].z);
466 }
467
468 password_dialogue.bullets[index].sprite.SetOpacity (0);
469
470 if (index < bullets) {
471 password_dialogue.bullets[index].sprite.SetOpacity (1);
472 }
473 }
474}
475
476Plymouth.SetDisplayPasswordFunction (display_password_callback);
477
478Plymouth.SetMessageFunction (message_callback);
479
480#Plymouth.SetBootProgressFunction (animate_progress_indicator);
481
482# Plymouth.SetBootProgressFunction: the callback function is called with two numbers, the progress (between 0 and 1) and the time spent booting so far
483# Plymouth.SetRootMountedFunction: the callback function is called when a new root is mounted
484# Plymouth.SetKeyboardInputFunction: the callback function is called with a string containing a new character entered on the keyboard
485
486#----------------------------------------- FSCK Counter --------------------------------
487
488# Initialise the counter
489fun init_fsck_count () {
490 # The number of fsck checks in this cycle
491 global.counter.total = 0;
492 # The number of fsck checks already performed + the current one
493 global.counter.current = 1;
494 # The previous fsck
495 global.counter.last = 0;
496}
497
498# Increase the total counter
499fun increase_fsck_count () {
500 global.counter.total++;
501}
502
503fun increase_current_fsck_count () {
504 global.counter.last = global.counter.current++;
505}
506
507# Clear the counter
508fun clear_fsck_count () {
509 global.counter = NULL;
510 init_fsck_count ();
511}
512
513#----------------------------------------- Progress Label ------------------------------
514
515
516# Change the opacity level of a progress label
517#
518# opacity = 1 -> show
519# opacity = 0 -> hide
520# opacity = 0.3 (or any other float) -> translucent
521#
522fun set_progress_label_opacity (opacity) {
523 # the label
524 progress_label.sprite.SetOpacity (opacity);
525
526 # Make the slot available again when hiding the bar
527 # So that another bar can take its place
528 if (opacity == 0) {
529 progress_label.is_available = 1;
530 progress_label.device = "";
531 }
532}
533
534# Set up a new Progress Bar
535#
536# TODO: Make it possible to reuse (rather than recreate) a bar
537# if .is_available = 1. Ideally this would just reset the
538# label, the associated
539# device and the image size of the sprite.
540
541fun init_progress_label (device, status_string) {
542 # Make the slot unavailable
543 global.progress_label.is_available = 0;
544 progress_label.progress = 0;
545 progress_label.device = device;
546 progress_label.status_string = status_string;
547}
548
549# See if the progress label is keeping track of the fsck
550# of "device"
551#
552fun device_has_progress_label (device) {
553 #DebugBottom ("label device = " + progress_label.device + " checking device " + device);
554 return (progress_label.device == device);
555}
556
557# Update the Progress bar which corresponds to index
558#
559fun update_progress_label (progress) {
560 # If progress is NULL then we just refresh the label.
561 # This happens when only counter.total has changed.
562 if (progress != NULL) {
563 progress_label.progress = progress;
564
565 #Debug("device " + progress_label.device + " progress " + progress);
566
567 # If progress >= 100% hide the label and make it available again
568 if (progress >= 100) {
569 set_progress_label_opacity (0);
570
571 # See if we any other fsck check is complete
572 # and, if so, hide the progress bars and the labels
573 on_fsck_completed ();
574
575 return 0;
576 }
577 }
578 # Update progress label here
579 #
580 # FIXME: the queue logic from this theme should really be moved into mountall
581 # instead of using string replacement to deal with localised strings.
582 label = StringReplace (progress_label.status_string[0], "%1$d", global.counter.current);
583 label = StringReplace (label, "%2$d", global.counter.total);
584 label = StringReplace (label, "%3$d", progress_label.progress);
585 label = StringReplace (label, "%%", "%");
586
587 progress_label = get_fsck_label (label, 0);
588 #progress_label.progress = progress;
589
590 progress_label.sprite = Sprite (progress_label.image);
591
592 # Set up the bar
593 progress_label.sprite.SetPosition(progress_label.x, progress_label.y, 1);
594
595 set_progress_label_opacity (1);
596
597}
598
599# Refresh the label so as to update counters
600fun refresh_progress_label () {
601 update_progress_label (NULL);
602}
603
604#----------------------------------------- FSCK Queue ----------------------------------
605
606# Initialise the fsck queue
607fun init_queue () {
608 global.fsck_queue[0].device;
609 global.fsck_queue[0].progress;
610 global.fsck_queue.counter = 0;
611 global.fsck_queue.biggest_item = 0;
612}
613
614fun clear_queue () {
615 global.fsck_queue = NULL;
616 init_queue ();
617}
618
619# Return either the device index in the queue or -1
620fun queue_look_up_by_device (device) {
621 for (i=0; i <= fsck_queue.biggest_item; i++) {
622 if ((fsck_queue[i]) && (fsck_queue[i].device == device))
623 return i;
624 }
625 return -1;
626}
627
628# Keep track of an fsck process in the queue
629fun add_fsck_to_queue (device, progress) {
630 # Look for an empty slot in the queue
631 for (i=0; global.fsck_queue[i].device; i++) {
632 continue;
633 }
634 local.index = i;
635
636 # Set device and progress
637 global.fsck_queue[local.index].device = device;
638 global.fsck_queue[local.index].progress = progress;
639
640 # Increase the queue counter
641 global.fsck_queue.counter++;
642
643 # Update the max index of the array for iterations
644 if (local.index > global.fsck_queue.biggest_item)
645 global.fsck_queue.biggest_item = local.index;
646
647 #DebugMedium ("Adding " + device + " at " + local.index);
648}
649
650fun is_queue_empty () {
651 return (fsck_queue.counter == 0);
652}
653
654fun is_progress_label_available () {
655 return (progress_label.is_available == 1);
656}
657
658
659# This should cover the case in which the fsck checks in
660# the queue are completed before the ones showed in the
661# progress label
662fun on_queued_fsck_completed () {
663 if (!is_queue_empty ())
664 return;
665
666 # Hide the extra label, if any
667 #if (progress_bar.extra_label.sprite)
668 # progress_bar.extra_label.sprite.SetOpacity(0);
669}
670
671fun remove_fsck_from_queue (index) {
672 # Free memory which was previously allocated for
673 # device and progress
674 global.fsck_queue[index].device = NULL;
675 global.fsck_queue[index].progress = NULL;
676
677 # Decrease the queue counter
678 global.fsck_queue.counter--;
679
680 # See if there are other processes in the queue
681 # if not, clear the extra_label
682 on_queued_fsck_completed ();
683}
684
685fun on_fsck_completed () {
686 # We have moved on to tracking the next fsck
687 increase_current_fsck_count ();
688
689 if (!is_progress_label_available ())
690 return;
691
692 if (!is_queue_empty ())
693 return;
694
695 # Hide the progress label
696 if (progress_label.sprite)
697 progress_label.sprite.SetOpacity (0);
698
699 # Clear the queue
700 clear_queue ();
701
702 # Clear the fsck counter
703 clear_fsck_count ();
704}
705
706# Update an fsck process that we keep track of in the queue
707fun update_progress_in_queue (index, device, progress) {
708 # If the fsck is complete, remove it from the queue
709 if (progress >= 100) {
710 remove_fsck_from_queue (index);
711 on_queued_fsck_completed ();
712 return;
713 }
714
715 global.fsck_queue[index].device = device;
716 global.fsck_queue[index].progress = progress;
717
718}
719
720# TODO: Move it to some function
721# Create an empty queue
722#init_queue ();
723
724
725#----------------------------------------- FSCK Functions ------------------------------
726
727
728# Either add a new bar for fsck checks or update an existing bar
729#
730# NOTE: no more than "progress_bar.max_number" bars are allowed
731#
732fun fsck_check (device, progress, status_string) {
733
734 # The 1st time this will take place
735 if (!global.progress_label) {
736 # Increase the fsck counter
737 increase_fsck_count ();
738
739 # Set up a new label for the check
740 init_progress_label (device, status_string);
741 update_progress_label (progress);
742
743 return;
744 }
745
746
747 if (device_has_progress_label (device)) {
748 # Update the progress of the existing label
749 update_progress_label (progress);
750 }
751 else {
752 # See if there's already a slot in the queue for the device
753 local.queue_device_index = queue_look_up_by_device(device);
754
755 # See if the progress_label is available
756 if (progress_label.is_available) {
757
758# local.my_string = "available index " + local.available_index + " progress_bar counter is " + progress_bar.counter;
759# Debug(local.my_string);
760
761
762 # If the fsck check for the device was in the queue, then
763 # remove it from the queue
764 if (local.queue_device_index >= 0) {
765 remove_fsck_from_queue (index);
766 }
767 else {
768 # Increase the fsck counter
769 increase_fsck_count ();
770 }
771
772# local.my_string += local.message;
773 #Debug("setting new label for device " + device + " progress " + progress);
774
775 # Set up a new label for the check
776 init_progress_label (device, status_string);
777 update_progress_label (progress);
778
779 }
780 # If the progress_label is not available
781 else {
782
783 # If the fsck check for the device is already in the queue
784 # just update its progress in the queue
785 if (local.queue_device_index >= 0) {
786 #DebugMedium("Updating queue at " + local.queue_device_index + " for device " + device);
787 update_progress_in_queue (local.queue_device_index, device, progress);
788 }
789 # Otherwise add the check to the queue
790 else {
791 #DebugMedium("Adding device " + device + " to queue at " + local.queue_device_index);
792 add_fsck_to_queue (device, progress);
793
794 # Increase the fsck counter
795 increase_fsck_count ();
796
797 refresh_progress_label ();
798 }
799
800 }
801 }
802
803# if (!is_queue_empty ()) {
804# DebugBottom("Extra label for "+ device);
805 #}
806# else {
807# DebugBottom("No extra label for " + device + ". 1st Device in the queue "+ fsck_queue[0].device + " counter = " + global.fsck_queue.counter);
808# }
809}
810
811
812#-----------------------------------------Update Status stuff --------------------------
813#
814# The update_status_callback is what we can use to pass plymouth whatever we want so
815# as to make use of features which are available only in this program (as opposed to
816# being available for any theme for the script plugin).
817#
818# Example:
819#
820# Thanks to the current implementation, some scripts can call "plymouth --update=fsck:sda1:40"
821# and this program will know that 1) we're performing and fsck check, 2) we're checking sda1,
822# 3) the program should set the label progress to 40%
823#
824# Other features can be easily added by parsing the string that we pass plymouth with "--update"
825#
826fun update_status_callback (status) {
827# Debug(status);
828 if (!status) return;
829
830 string_it = 0;
831 update_strings[string_it] = "";
832
833 for (i=0; (String(status).CharAt(i) != ""); i++) {
834 local.temp_char = String(status).CharAt(i);
835 if (temp_char != ":")
836 update_strings[string_it] += temp_char;
837 else
838 update_strings[++string_it] = "";
839 }
840
841# my_string = update_strings[0] + " " + update_strings[1] + " " + update_strings[2];
842# Debug(my_string);
843 # Let's assume that we're dealing with these strings fsck:sda1:40
844 if ((string_it >= 2) && (update_strings[0] == "fsck")) {
845
846 device = update_strings[1];
847 progress = update_strings[2];
848 status_string[0] = update_strings[3]; # "Checking disk %1$d of %2$d (%3$d %% complete)"
849 if (!status_string[0])
850 status_string[0] = "Checking disk %1$d of %2$d (%3$d %% complete)";
851
852 if ((device != "") && (progress != "")) {
853 progress = StringToInteger (progress);
854
855 # Make sure that the fsck_queue is initialised
856 if (!global.fsck_queue)
857 init_queue ();
858
859 # Make sure that the fsck counter is initialised
860 if (!global.counter)
861 init_fsck_count ();
862
863# if (!global.progress_bar.extra_label.sprite)
864# create_extra_fsck_label ();
865
866 # Keep track of the fsck check
867 fsck_check (device, progress, status_string);
868 }
869
870 }
871
872}
873Plymouth.SetUpdateStatusFunction (update_status_callback);
874
875#-----------------------------------------Display Question stuff -----------------------
876#
877# TODO: Implement this if needed
878#
879# The callback function is called when the display should display a question dialogue.
880# First arg is prompt string, the second is the entry contents.
881#fun display_question_callback (prompt_string, entry_contents)
882#{
883# time++;
884#}
885#
886#Plymouth.SetDisplayQuestionFunction (display_question_callback);
887
888#-----------------------------------------Refresh stuff --------------------------------
889#
890# Calling Plymouth.SetRefreshFunction with a function will set that function to be
891# called up to 50 times every second, e.g.
892#
893# NOTE: if a refresh function is not set, Plymouth doesn't seem to be able to update
894# the screen correctly
895#
896fun refresh_callback ()
897{
898 if (Plymouth.GetMode () == "boot" || Plymouth.GetMode () == "resume") {
899 logo.opacity_angle += ((2 * Math.Pi) / 50) * 0.2; # 0.2 HZ
900 opacity = ( Math.Cos (logo.opacity_angle) + 1) / 2;
901 if ( opacity > logo.sprite.GetOpacity () )
902 logo.sprite.SetOpacity (opacity);
903 else {
904 logo.sprite.SetOpacity (1);
905 logo_blurred.opacity_angle += ((2 * Math.Pi) / 50) * 0.4; # 0.4 HZ
906 opacity_blurred = ( Math.Cos (logo_blurred.opacity_angle) + 1) / 2;
907 logo_blurred.sprite.SetOpacity (opacity_blurred);
908 }
909 }
910 else if (Plymouth.GetMode () == "shutdown" || Plymouth.GetMode () == "suspend") {
911 logo.opacity_angle += ((2 * Math.Pi) / 50) * 0.1; # actually 0.05 HZ because of the division below
912 opacity = ( Math.Cos (logo.opacity_angle) + 1) / 4 + 0.5;
913 if ( opacity < logo.sprite.GetOpacity () )
914 logo.sprite.SetOpacity (opacity);
915 }
916 else
917 {
918 logo.sprite.SetOpacity (1);
919 }
920}
921Plymouth.SetRefreshFunction (refresh_callback);
922
923
924#-----------------------------------------Display Normal stuff -----------------------
925#
926# The callback function is called when the display should return to normal
927fun display_normal_callback ()
928{
929 global.status = "normal";
930 if (global.password_dialogue) {
931 password_dialogue_opacity (0);
932 global.password_dialogue = NULL;
933 if (message_notification[2].sprite) hide_message(2);
934 prompt_active = 0;
935 }
936
937 if (message_notification[1].sprite) show_message (1);
938
939
940}
941
942Plymouth.SetDisplayNormalFunction (display_normal_callback);
943
944
945#----------------------------------------- Quit --------------------------------
946
947# TODO: Maybe we should also hide any other dialog
948# Show the logo and make the progress indicator look full when on exit
949fun quit_callback ()
950{
951 logo.sprite.SetOpacity (1);
952 switch_on_bullets ();
953}
954
955Plymouth.SetQuitFunction(quit_callback);
0956
=== added file 'plymouth/elementary-logo/logo.png'
1Binary files plymouth/elementary-logo/logo.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/logo.png 2016-01-15 14:18:25 +0000 differ957Binary files plymouth/elementary-logo/logo.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/logo.png 2016-01-15 14:18:25 +0000 differ
=== added file 'plymouth/elementary-logo/logo_blurred.png'
2Binary files plymouth/elementary-logo/logo_blurred.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/logo_blurred.png 2016-01-15 14:18:25 +0000 differ958Binary files plymouth/elementary-logo/logo_blurred.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/logo_blurred.png 2016-01-15 14:18:25 +0000 differ
=== added file 'plymouth/elementary-logo/password_field.png'
3Binary files plymouth/elementary-logo/password_field.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/password_field.png 2016-01-15 14:18:25 +0000 differ959Binary files plymouth/elementary-logo/password_field.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/password_field.png 2016-01-15 14:18:25 +0000 differ
=== added file 'plymouth/elementary-logo/password_field16.png'
4Binary files plymouth/elementary-logo/password_field16.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/password_field16.png 2016-01-15 14:18:25 +0000 differ960Binary files plymouth/elementary-logo/password_field16.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/password_field16.png 2016-01-15 14:18:25 +0000 differ
=== added file 'plymouth/elementary-logo/progress_dot_off.png'
5Binary files plymouth/elementary-logo/progress_dot_off.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/progress_dot_off.png 2016-01-15 14:18:25 +0000 differ961Binary files plymouth/elementary-logo/progress_dot_off.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/progress_dot_off.png 2016-01-15 14:18:25 +0000 differ
=== added file 'plymouth/elementary-logo/ubuntu_logo.png'
6Binary files plymouth/elementary-logo/ubuntu_logo.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/ubuntu_logo.png 2016-01-15 14:18:25 +0000 differ962Binary files plymouth/elementary-logo/ubuntu_logo.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/ubuntu_logo.png 2016-01-15 14:18:25 +0000 differ
=== added file 'plymouth/elementary-logo/ubuntu_logo16.png'
7Binary files plymouth/elementary-logo/ubuntu_logo16.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/ubuntu_logo16.png 2016-01-15 14:18:25 +0000 differ963Binary files plymouth/elementary-logo/ubuntu_logo16.png 1970-01-01 00:00:00 +0000 and plymouth/elementary-logo/ubuntu_logo16.png 2016-01-15 14:18:25 +0000 differ
=== added directory 'plymouth/elementary-text'
=== added file 'plymouth/elementary-text/ubuntu-text.plymouth'
--- plymouth/elementary-text/ubuntu-text.plymouth 1970-01-01 00:00:00 +0000
+++ plymouth/elementary-text/ubuntu-text.plymouth 2016-01-15 14:18:25 +0000
@@ -0,0 +1,11 @@
1[Plymouth Theme]
2Name=Ubuntu Text
3Description=Text mode theme based on ubuntu-logo theme
4ModuleName=ubuntu-text
5
6[ubuntu-text]
7title=elementary OS
8black=0x000000
9white=0xffffff
10brown=0x000000
11blue=0x000000

Subscribers

People subscribed via source and target branches