applet.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import UI
  2. class Applet(UI.Container):
  3. """
  4. Applet are the main "application" running in the environment.
  5. They are filling the main area between the titlebar and the foot bar.
  6. When you make your own applet, you have to make it to inherit of that class
  7. so you have access to all the needed features.
  8. An applet can provide two other services:
  9. - A plugin
  10. - A settings page
  11. They need to be registered in the applet init function
  12. The system should not try to create more than one instance of an applet, but
  13. it is still a good practice to make sure your applet would not crash or create any
  14. problem if that happen.
  15. The main widget function (Draw and handle_event) will be run automatically part of the
  16. main loop of the environment. If you need asynchronous behavious, it is up to your
  17. applet to create its own thread and manage them.
  18. An applet should not try to write directly onto the screen, or trying to get access
  19. to the canvas of other widget which it does not own as thing can change without notice
  20. on that part and would break your applet.
  21. An applet can have a transparent background (and it is recommended until you need to control the background.)
  22. Still you can use the alpha channel to make the (potential) background picture lighter if needed.
  23. """
  24. def Draw(self):
  25. pass
  26. def handle_event(self):
  27. pass