• cvp

    @trey mea culpa and sorry

    posted in Pythonista read more
  • cvp

    @trey you 're right. I was almost sure it did work... Obviously, I did a mistake. But it is so difficult with an external keyboard to change keyboard by using Ctrl+space to simulate the globe key, then up/down arrows to select it. As the ui.view disappears, the only thing I see is the additional top row of Pythonista keyboard. If you tap a character on this row, it is taken but the code (of additional *) does not run, exactly like if the custom keyboard was not active.

    posted in Pythonista read more
  • cvp

    @trey said:

    You really don’t have access to a single Bluetooth keyboard

    Sorry but I never did think about my iMac Bluetooth keyboard...
    I've connected it to my iPad as external keyboard and it works.

    Now, it is an AZERTY keyboard, thus it is not coherent with the Pythonista standard keyboard of the custom keyboard extension.

    Please, first, try this little script without external keyboard, by pressing &h*, you will see a θ
    in your input field, in any app, if you use this script as custom keyboard.

    Then, don't change which keyboard is active (no globe key) and connect your Bluetooth keyboard. If your keyboard is coherent with the Pythonista QWERTY standard keyboard, the script will also work. For me, it does not because if I tap & or * on my keyboard, other keys are generated.

    Thus, with external keyboard, we get data but not obviously the same key as expected.

    Edit: it should be possible to convert received character, in function of its position in standard qwerty Pythonista keyboard into "your" character on your keyboard, at same position.

    Hoping that I'm clear enough with my poor English.

    #!python3
    import keyboard
    import ui
    
    class KeyboardInfoView (ui.View):
        def __init__(self, *args, **kwargs):
            super().__init__(self, *args, **kwargs)
            self.background_color = '#00436e'
            
        def kb_should_insert(self, text):
            if text == '*':
                before,after = keyboard.get_input_context()
                if before[-2] == '&':       # ex: &h*
                    ch = before[-1]             # ex: h
                    keyboard.backspace(2)   # ex: remove &h
                    keyboard.insert_text('\u03B8')  # force θ
                    return
            return text
    
    if __name__ == '__main__':
        v = KeyboardInfoView()
        keyboard.set_view(v, mode='minimized') 
    

    posted in Pythonista read more
  • cvp

    Not tested, but whaaaaaaaa, as usual

    posted in Pythonista read more
  • cvp

    @momorprods

    import console
    from objc_util import on_main_thread
    on_main_thread(console.set_idle_timer_disabled)(flag)
    

    posted in Pythonista read more
  • cvp

    @mieq Thanks for the info, very good news

    posted in Pythonista read more
  • cvp

    @trey said:

    using switchable input methods

    Could you give an example, please

    posted in Pythonista read more
  • cvp

    @trey said:

    with an external keyboard, it does absolutely nothing that I can see.

    I can't test anything, I don't have any external keyboard

    posted in Pythonista read more
  • cvp

    @trey said:

    switching to Pythonista keyboard, the HW keyboard becomes QWERTY again.

    Normal, Pythonista keyboard is always QWERTY

    posted in Pythonista read more
  • cvp

    @trey said:

    —it inserts BEF, but never END

    You're right, it is a bug more

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!