Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MagicMirror.script 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. screen_width = Window.GetWidth();
  2. screen_height = Window.GetHeight();
  3. if (Plymouth.GetMode() != "shutdown")
  4. {
  5. theme_image = Image("splash.png");
  6. }
  7. else
  8. {
  9. theme_image = Image("splash_halt.png");
  10. }
  11. image_width = theme_image.GetWidth();
  12. image_height = theme_image.GetHeight();
  13. scale_x = image_width / screen_width;
  14. scale_y = image_height / screen_height;
  15. if (scale_x > 1 || scale_y > 1)
  16. {
  17. if (scale_x > scale_y)
  18. {
  19. resized_image = theme_image.Scale (screen_width, image_height / scale_x);
  20. image_x = 0;
  21. image_y = (screen_height - ((image_height * screen_width) / image_width)) / 2;
  22. }
  23. else
  24. {
  25. resized_image = theme_image.Scale (image_width / scale_y, screen_height);
  26. image_x = (screen_width - ((image_width * screen_height) / image_height)) / 2;
  27. image_y = 0;
  28. }
  29. }
  30. else
  31. {
  32. resized_image = theme_image.Scale (image_width, image_height);
  33. image_x = (screen_width - image_width) / 2;
  34. image_y = (screen_height - image_height) / 2;
  35. }
  36. sprite = Sprite (resized_image);
  37. sprite.SetPosition (image_x, image_y, -100);
  38. message_sprite = Sprite();
  39. message_sprite.SetPosition(screen_width * 0.1, screen_height * 0.9, 10000);
  40. fun message_callback (text) {
  41. my_image = Image.Text(text, 1, 1, 1);
  42. message_sprite.SetImage(my_image);
  43. sprite.SetImage (resized_image);
  44. }
  45. Plymouth.SetUpdateStatusFunction(message_callback);