Excerpts from Daniel Drake's message of 2011-11-25 21:10:04 +0100: > The HGPK pentablet selection code has gone upstream, but with a > different interface from the version included in previous OLPC kernels. > The interface is now: > > echo -n pentablet > hgpk_mode > > Port the touchpad icon to this new API.
You're doing more than this. The additional changes are fine, but should be mentioned. > Compatibility with the old non-upstream API has been dropped; I don't > anticipate users running this new sugar with an old kernel. FWIW, I'm still running a 2.6.35 kernel on my XO-1 (but Sugar from sugar-jhbuild, i.e. mainline/master). Not sure if anyone who cares about this Frame device icon does, though. [extensions/deviceicon/touchpad.py] > @@ -31,19 +31,15 @@ from sugar.graphics import style > > from jarabe.frame.frameinvoker import FrameWidgetInvoker > > -TOUCHPAD_MODE_CAPACITIVE = 'capacitive' > -TOUCHPAD_MODE_RESISTIVE = 'resistive' > -TOUCHPAD_MODES = [TOUCHPAD_MODE_CAPACITIVE, TOUCHPAD_MODE_RESISTIVE] > -STATUS_TEXT = { > - TOUCHPAD_MODE_CAPACITIVE: _('finger'), > - TOUCHPAD_MODE_RESISTIVE: _('stylus'), > -} > -STATUS_ICON = { > - TOUCHPAD_MODE_CAPACITIVE: 'touchpad-' + TOUCHPAD_MODE_CAPACITIVE, > - TOUCHPAD_MODE_RESISTIVE: 'touchpad-' + TOUCHPAD_MODE_RESISTIVE, > -} > +TOUCHPAD_MODE_MOUSE = 'mouse' > +TOUCHPAD_MODE_PENTABLET = 'pentablet' Do we need these as individual constants? I don't see them used anywhere except when defining TOUCHPAD_MODES and since we seem to change the name of the constants any time the content changes, I see no reason to use them at all. Especially since we don't do the same for STATUS_TEXT and STATUS_ICON: > +TOUCHPAD_MODES = (TOUCHPAD_MODE_MOUSE, TOUCHPAD_MODE_PENTABLET) > +STATUS_TEXT = (_('finger'), _('stylus')) > +STATUS_ICON = ('touchpad-capacitive', 'touchpad-resistive') [...] > +def _read_touchpad_mode(): > + """ Read the touchpad mode and return the mode indice. """ Typo: s/indice/index/ > + mode_str = _read_touchpad_mode_str() > + if not mode_str in TOUCHPAD_MODES: > + return None > + return TOUCHPAD_MODES.index(mode_str) I find "if a not in b" easier to read than "if not a in b"; YMMV. [...] > +def _write_touchpad_mode(mode_num): > + """ Look up the mode (by indice) and write to node path. """ See above (indice). Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/
signature.asc
Description: PGP signature
_______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel