[Elisa-commits] [MERGE]: frontend is in a plugin now, drop the backend idea

Florian Boucault florian at fluendo.com
Thu Apr 24 17:05:15 CEST 2008


bb: tweak


Overall looks good, details following.
No tests for PigmentFrontend.


+++ elisa-core/elisa/base_components/frontend.py

+class Frontend(Component):
+    """
+    The Frontend is a component that gets created by the interface controller.
+    A frontend holds a specific type of user output system and initializes the
+    necessary hard and software to allow L{controller}s to do their job.
+    As well as controllers the Frontend is not for visual output only but a
+    generic system for any kind of output (like sound output, lcd or braille).
+
+    This base class does not contain any big logic but some helper
+    functionality for the implementations that are pretty common.
+    """

Docstring is complicated and abstract and as a result not very helpful.
Proposal:

"""
A frontend sets up the necessary environment for a user interface to be
created. L{Controller}s then use that environment to put together the
widgets from the toolkit of their choice.

Example frontends could be one creating a XWindow and an OpenGL context,
one creating a GtkWindow, one creating a Pigment viewport and a canvas
associated to it.
"""

Code still missing is:
- the frontend base class reading its configuration to create its
startup controller (to be done ASAP)
- internationalisation helpers (Jesus will take care of that after the
windows release)


+++ elisa-core/elisa/core/interface_controller.py

import os
[snip]

useless import



+class FrontendOptionMissing(Exception):
     """
-    Raised by L{InterfaceController} when no Model/View or
-    Model/Controller association is found in the MVC mappings of the
-    frontend or backend managed by the interface controller.
+    When a given Frontend is missing the 'missing' option in the configuration
     """
     pass

[snip]

completely unclear docstring.



+++ elisa-plugins/elisa/plugins/pigment/pigment_frontend.py

+        # compute the aspect ratio
+        w, h = viewport.screen_size_mm
+        screen_aspect_ratio = h / float(w)
+
+        viewport.height = viewport.width * screen_aspect_ratio
+
+        w, h = viewport.screen_resolution
+        resolution_aspect_ratio = h / float(w)
+
+        self.canvas.height = self.canvas.width * screen_aspect_ratio
+        viewport.width *= (screen_aspect_ratio / resolution_aspect_ratio)

More comments are required. You can ask Loïc to write them for you.
Grosso modo, it's:
1) set the viewport aspect ratio to the screen physical aspect ratio
2) set the canvas aspect ratio to the screen physical aspect ratio
3) resize the viewport to compensate for the canvas projection
deformation applied to correct monitors with non square pixels.


Le jeudi 24 avril 2008 à 13:58 +0200, Benjamin Kampmann a écrit :
> So...
> I did a lot of clean up of comments, changed small parts in the interface controller
> and reimplemented everything we wanted to have implemented in the pigment frontend.
> 
> Now you need to have a more complex script to test the frontend. If you want to have
> it tell me.
> 
> Benjamin Kampmann schrieb:
> > Benjamin Kampmann schrieb:
> >> This patch contains the new frontend base component and patch to the
> >> interface controller. Beside this it contains a simple implementation
> >> for a pigment frontend.
> >>
> >> I also refactored the whole unit tests of the interface controller. 
> >> The coverage
> >> is now at a good level. I did not touch the default configuration nor any
> >> sample configuration as the new frontend does not contain any 
> >> functionality anyway.


More information about the Elisa-commits mailing list