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