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

Subscribers

People subscribed via source and target branches