Enhanced text editing and Keyboard support

  • There has been a rather large overhaul of the text editing functionality in Enigma2 (with a first step in the CVS of 071128 and a second step 071216). In addition to various bug fixes and general enhancements, the new version makes it easier to enter text by the remote control, and provides more complete support for the dreambox keyboard.


    Below is a list of the most important features, and after that some hints for plugin authors of what to do to inherit the features.


    No doubt there are still bugs and things that don't work well, so please report what you find.


    Best Regards
    Anders Holst



    List of features


    Easier text input by the remote control:

    • Insert mode is the default instead of overwrite mode when editing text.
    • Now both "deleteBackwards" and "deleteForwards" can be accessed from the remote control (as "<" and ">", in addition to the old "mute" for "deleteForwards").
    • Allow for faster text input with the remote control: it is not necessary to wait for the timeout of the previous letter before starting on a new, provided they sit on different keys.


    General text editing features:

    • When entering a text input field, the whole default content is "selected" such that it is removed by the first editing key. Pressing a direction key will unselect it, and the default content can be edited.
    • Long entries that don't fit on the line is now scrolled horizontally to always show the insert point. (This requires use of the parameter "visible_width" when creating the python widget.)


    Dreambox keyboard support:

    • Enable keyboard text input in configuration dialogs (in addition to the previous text input support that was limited to input boxes).
    • Several key bindings to make all functionality that is currently accessible from the remote control also accessible from the keyboard. This include bindings of "play", "stop", "pause", "rewind", "fast-forward", etc. (This only holds for the standard packages in the standard distribution. Other packages that provide their own key bindings may have to complete them to provide full keyboard support.)


    Hints to plugin authors


    Most features above will work immediately as long as text editing is done by "InputBox" or "ConfigText" elements. There are two exceptions to this, which may require extra attention: horizontal scrolling and keyboard key bindings. They are each discussed below. If, instead of using "InputBox" or "ConfigText", you provide your own text editing widget, you may want to check out the code for one of these two widgets to be able to provide a consistent interface which has both remote control and keyboard support.


    If you in your plugin like to edit a text field that may become very long (e.g. the description of a movie), you may want to enable horizontal scrolling of that text field. Then all you have to do is to give the parameter "visible_width = NUM" in the argument list when creating the ConfigText or InputBox element, where NUM is the maximum number of visible characters of that field in the dialog. (This number is of course just an approximation, since the font is not fixed width.)


    If you provide your own "keymap.xml" bindings, then you may have to add a few bindings to make the plugin work with the keyboard. First, make sure that you have the same binding for KEY_ESC as for KEY_EXIT, and the same binding for KEY_ENTER as for KEY_OK. That will make the interface consistent with all other dialogs. Further, on the remote control several functions are overloaded onto KEY_RED, KEY_GREEN, KEY_YELLOW, KEY_BLUE, KEY_TV, and KEY_RADIO, whereas on the keyboard you also have KEY_REWIND, KEY_PLAY, KEY_PAUSE, KEY_FASTFORWARD, KEY_STOP, KEY_RECORD, KEY_PREVIOUSSONG, and KEY_NEXTSONG, and you may like to use them in addition when appropriate. (For example, it makes no sense to stop the playback of something by pressing the "TV" button on the keyboard.) Finally, on the keyboard there are no KEY_PREVIOUS and KEY_NEXT (labeled "<" and ">" on the remote control) but the keys on the keyboard with the same symbols instead generate KEY_BACK and KEY_FORWARD, so you may consider adding the same bindings to those. By the way, the device tag for the keyboard is "dreambox ir keyboard", so you can separate the keyboard specific bindings from the rest. If you follow these simple rules your plugin will be "keyboard compatible".


    That's it. Good luck!

  • This is a problem with a cvs E2 image for DM600pvr and also DM7020.


    In the record (red button) - record duration inputbox for example, when inputting, the numbers are entered twice.


    Until now, it was possible to backspace and delete the extra number with the 'mute' button. But with your 16.12.07 inputbox.py it is now not possible to delete. Backspace OK, but no delete with the 'mute'.


    ps. Something strange. I now notice that when I downloaded Revision 1.11, it did not have the added code :-


    Code
    def gotAsciiCode(self): 
    112                    if self["input"].currPos == len(self["input"]) - 1: 
    113                            InputBox.gotAsciiCode(self) 
    114                            self.go() 
    115                    else: 
    116                            InputBox.gotAsciiCode(self)


    When I added this code, when I entered a number, there was a crash with error :-


    Code
    File "/usr/lib/enigma2/python/Components/Input.py", line 25, in __len__
        return len(self.text)
    RuntimeError: maximum recursion depth exceeded


    Full log attached.


    Of course I realize this may not be a issue with DM7025.


    Regards, pcd.

  • Where do I find all the keys used in the Text- Editor ?


    I searched the manual, but I could not find any hints except for the (now obsolete) mute- key.


    For example I'm searching for easy things like:


    - switch from insert to overwrite- mode
    - insert a space ( I did not find it on the 0- key )


    At the moment I know the following keys:


    1-9 : Enter Text / Numbers
    0 : Enter special characters (.,-)
    mute : delete one character
    < : deleteBackwards (NEW)
    > : deleteForwards (NEW)


    ???


    Thanx
    Tode

  • Hello pcd


    (The problem with doubled numbers on the DM600 has, if I understood it right, been there for some time and is not directly related to my recent changes. This does not mean that it should be ignored though. I have a DM7025 on which I can not reproduce it, but with your help it may be possible to track it down, but lets do that outside of the forum.)


    The mute key should still work. I did't dare to remove it since people may have got used to it. Also, "delete" and "backspace" are added on "<" and ">", so they should also be possible to use. However, one difference with the mute key is that it is only bound to "delete" on the dreambox remote control, not to interfere with mute on the keyboard. Do you maybe have another type of remote than the native one?


    Zitat

    ps. Something strange. I now notice that when I downloaded Revision 1.11, it did not have the added code :-
    ...
    When I added this code, when I entered a number, there was a crash with error :-


    Just to make sure: At what lines in the file did you (manually I suppose) add the code? According to the crash log they are on lines 51-56 (in the class InputBox), but they should be where your excerpt says, ie. at lines 111-116, in the subclass PinInput. from where it invokes the superclass method of the same name. If you put the code in the superclass InputBox there will sure be an infinite recursion...


    Best Regards
    Anders Holst

  • Hello Tode


    Your listing of the keys is correct and complete. There are currently no other keys for text editing on the remote control (except left and right to move around of course).


    Space is, and has always been, found on the 1-key.


    Unfortunately there is currently no binding to toggle overwrite mode. I thought that insert mode would be the most convenient one, and the need to toggle limited. However, since the mute key is now "obsolete" as you say, you can with the attached patch easily bind it to toggleOverwrite. I would hesitate to add this to the standard distribution though, since the keys on the remote are scarce and there are many more things one might want to add instead.


    Best Regards
    Anders Holst

  • Because my X-mas Plugin will use the Long Mute (but for other puropose, so don't worry) I know that it works :smiling_face:


    So why not use a long pressing of mute to toggle between overwrite and insert ?


    PS: Nice job these text editing enhancements !


    gutemine

    2 Mal editiert, zuletzt von Lost in Translation ()

  • Hello,


    Thanks a lot for the work on the keyboard.
    Just a little remark, when using the keyboard to fill in the data for the timers the "5" doesn't work.
    Thanks

  • Hello


    Rodajo wrote:

    Zitat

    Just a little remark, when using the keyboard to fill in the data for the timers the "5" doesn't work.


    Yes, this is a known problem. For those of you with the possibility to recompile enigma2, a preliminary patch is this:

    Diff
    --- cvs/enigma2/lib/driver/rcconsole.orig.cpp	2006-06-28 17:39:52.000000000 +0200
    +++ cvs/enigma2/lib/driver/rcconsole.cpp	2007-12-04 23:06:48.000000000 +0100
    @@ -72,7 +72,6 @@
     				code = -1;
     			else switch(code)
     			{
    -			case 0x35:  // mute
     			case 0x7E:  // mute, einfg, entf
     			case 0x7F:  // backspace
     			code = -1;

    i.e. remove line 75 of the file "rcconsole.cpp". The patch has been submitted to the CVS, but is not applied yet in wait for a more principled solution involving the driver.


    (An explanation if you don't find the patch obvious: The mute key happens to generate the same ascii code as "5", and the removed line was intended to block the ascii code for mute, but at the same time it blocks "5".)


    Best Regards
    Anders Holst

    Einmal editiert, zuletzt von aholst ()

  • Hi,


    Re. Enigma2 with dm600pvr


    A new problem with inputbox. With enigma2 version 2.4 (srcdate 080424) the new bouquet window (same with recording time input)does not show the letters - see screenshot_A. Version 2.3 (srcdate 080310) was ok - screenshot_B.


    I do not see any difference in Inputbox.py. Any idea where the problem may be found ?


    Regards, pcd.