Key Bindings

  • Hi,


    as always stiupid questions... but thx for them we teacha lot of enigma2.


    I was thinking how to Bind ( Mapp ) Blue Button to My Menu



    I saw in keymap.xml


    <map context="InfobarExtensions">
    <key id="KEY_BLUE" mapto="extensions" flags="b" />
    </map>


    So it is Extensions...


    If we will write for example plugin, if we want to see it in Extension we need do this


    def Plugins(**kwargs):
    return PluginDescriptor(name='My Menu', description='open my menu', where=PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)



    But how we should change Extension for My Menu class?


    to run directly my menu?

    • Offizieller Beitrag

    and you should explain a bit more what you want to do.
    I know at least one (anonimous) developer who simply can't answer because he doesn't understand what you want to do. :smiling_face:


    Olove

    Grüße,
    Olove

    "All we need to do ... is keep talking (Stephen Hawking)"


    Ich leiste KEINEN Support per PN/E-Mail, derartige Anfragen werden nicht beantwortet.
    I won't give support via PN/E-Mail and I won't answer such messages.

  • Ok :smiling_face:


    How can I replace ( Extensions on BLUE Button )


    to my own Class MyClass(Screen)


    When I ll push Blue Button when i am watching Channel, i ll see my menu


    In enigma 1 we do this way in resources .xml


    Code
    <actionmap name="enigmaMain">
    <action name="showMyClass" key="blue" flags="m" />

    Einmal editiert, zuletzt von tracer ()

  • Most simple but also most ugly way would be to just leave the Keybinding as it is and change in Screens/InfoBarGenerics.py function showExtensionSelection of class InfoBarExtensions to open your plugin.


    If you want a prettier way or still don't know what to do just reply :winking_face:

    Homescreen eurer Apple-Geräte noch nicht voll genug?


    dreaMote: Fernbedienung für Dreamboxen
    Mobile WOL: Wake-on-LAN Client für iOS mit optionalem Widget
    My Home Remote: Fernkontrolle für Homematic CCU/CCU2 optimiert für mobile Benutzung

  • So, Finally I got working OE tree on Gentoo 2007.0 ( gcc 3.4.5 )


    On Class:


    I put my code:


    from Screens.PluginBrowser import *


    class InfoBarTimeshift:
    def __init__(self):
    self.session = session
    self.session.open(PluginBrowser)



    But it doesn't works...


    ritzMo


    Did you ever ty to but Plugins on Yellow...?

    • Offizieller Beitrag

    I have no idea since I am no developer :smiling_face:

    Grüße,
    Olove

    "All we need to do ... is keep talking (Stephen Hawking)"


    Ich leiste KEINEN Support per PN/E-Mail, derartige Anfragen werden nicht beantwortet.
    I won't give support via PN/E-Mail and I won't answer such messages.

  • You unfortunately have to think object oriented (at least a little) :winking_face:


    What your Code does is definitely not what you're trying to do (it tries to open the PluginBrowser when InfoBarTimeshift is initialized... in fact it is not initialized when timeshift starts - what you assumed - but when the infobar is initialized and from what I remember without checking out the code this happens only once when enigma2 is started). And InfoBarTimeshift is initialized without session as argument, therefore you won't be able to access it in this context. BUT self.session is always present when you're in InfoBarTimeshift so you can just use it without assigning it.


    As I told you before you should check the mappings. The Code reads:

    Code
    self["TimeshiftActions"] = HelpableActionMap(self, "InfobarTimeshiftActions",
                            {
                                    "timeshiftStart": (self.startTimeshift, _("start timeshift")),  # the "yellow key"
                                    "timeshiftStop": (self.stopTimeshift, _("stop timeshift"))      # currently undefined :), probably 'TV'
                            }, prio=1)


    Now you know that self.startTimeshift is executed when timeshiftStart is triggered (and from the comment or better yet the keymaps we know this is triggered when yellow is pressed).


    So my hackish advice for you was to just alter the called function to do what you want. In that case you would end up with something like this:

    Python
    def startTimeshift(self):
            from Screens.PluginBrowser import PluginBrowser
            self.session.open(PluginBrowser)


    Of course there are much better ways to do this but you have to find those out for yourself :winking_face:

    Homescreen eurer Apple-Geräte noch nicht voll genug?


    dreaMote: Fernbedienung für Dreamboxen
    Mobile WOL: Wake-on-LAN Client für iOS mit optionalem Widget
    My Home Remote: Fernkontrolle für Homematic CCU/CCU2 optimiert für mobile Benutzung