Hi Paul, > > === modified file 'entertainerlib/frontend/gui/screens/main.py' > > --- entertainerlib/frontend/gui/screens/main.py 2009-04-17 21:02:35 > +0000 > > +++ entertainerlib/frontend/gui/screens/main.py 2009-04-25 23:30:15 > +0000 > > @@ -47,16 +47,55 @@ class Main(Screen): > > self.preview.set_opacity(0x00) > > self.add(self.preview) > > > > - self.active_menu = "main" > > self.rss_preview_menu = self._create_rss_preview_menu() > > self.preview.add(self.rss_preview_menu) > > > > - self.menu = None > > - self.playing_item = None > > - self.create_main_menu() > > + self.menu = self._create_main_menu() > > + self.add(self.menu) > > + self.menu.connect('selected', self._on_menu_selected) > > + self.menu.connect('moved', self._on_menu_moved) > > + self.menu.connect('activated', self._main_menu_activation) > > + self.menu.active = True > > + > > + self.add(ClockLabel(0.13, "screentitle", 0, 0.87)) > > + > > This makes me a bit queesy. Why are you creating an instance variable, and > then calling an instance method on that instance variable. What does self.add > do? Why are we calling it? If it is required (and I'm concerned it isn't), > self._create_main_menu should be calling self.add(). Also, _create_main_menu > should be doing all the self.menu.connect type stuff. Well, this was discussed with Matt in a previous comment. The idea is to add widgets only in the __init__ method of a screen. I really don't know at the moment the *right* place of the connect calls. It's more tricky than it seems on the first looks. Because every actor has to be created before. Why? simply because if we create a widget (let's say a menu) and connect its *activated* signal to a *menu_activate* callback. In this call back we will deactivate (in the future when reactive widgets will be all together) the other reactive widgets of the screen. So if there not created ... error That is why I think the good place for connections is in the end of the __init__ method. I'll take care of that (including other optimizations and simplifications) in the *reactive_global* branch I'll do in the end. > Also, I see the clock got moved here instead of the _create_main_menu code. > Why? Yep, see above. > > > + def get_type(self): > > + """Return screen type.""" > > + return Screen.NORMAL > > + > > + def get_name(self): > > + """Return screen name (human readble)""" > > + return "Main" > > + > > I've seen this convention a few times. What are we using get_name for? Is > there a better way to handle this than using a string? I'd like some answers > about this, because I thought Joshua had eliminated the need for this code. > > Also, it seems that type and name would be better as properties. They never > change dynamically, so making them instance properties is a good idea. If > type > or name had the ability to change within the life of the instance, we would > use > accessors, but that's more for convention than anything. In this case though, > there isn't even a need for defining a function. This code could be > simplified > to: > > type = Screen.NORMAL > name = "Main" I agree on the principle, there's simplification to be done. But I think that's not the goal of this branch. > > self.preview.add(self._create_rss_preview()) > > + # when we update the rss preview menu, we must set it active if > > + # main menu is not > > + if not self.menu.active: > > + self.rss_preview_menu.set_active(True) > > else: > > update = False > > > > The comment here needs to start with a capital letter and end with a full > stop. Fixed. > > + > > + def update(self): > > + """ > > + Update screen widgets. This is called always when screen is poped > from > > + the screen history. Updates main menu widget. > > + """ > > + if self.media_player.is_playing() and \ > > + (self.menu.get_index("playing") == -1): > > + self.menu.add_item(_("Playing now..."), "playing") > > + elif not self.media_player.is_playing() and \ > > + (self.menu.get_index("playing") != -1): > > + self.menu.remove_item("playing") > > + > > + self.menu.refresh() > > + self._update_preview_area() > > > > This docstring needs to be consistent with the rest of our new docstrings. It > needs to read like this: Yes, in fact that was already modified a few days ago (don't remember exactly when). I should have repost a new diff before you review. Sorry. > > === added file 'entertainerlib/frontend/gui/widgets/motion_buffer.py' > > --- entertainerlib/frontend/gui/widgets/motion_buffer.py 1970-01-01 > 00:00:00 +0000 > > +++ entertainerlib/frontend/gui/widgets/motion_buffer.py 2009-04-25 > 23:30:15 +0000 > > @@ -0,0 +1,137 @@ > > +"""Tools for pointer motion calculations""" > > + > > +__licence__ = "GPLv2" > > +__copyright__ = "2009, Samuel Buffet" > > +__author__ = "Samuel Buffet