Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Keyboard switch.
-
I've returned it to the previous version.
What should I do to execute this as a keyboard? -
@shinya.ta Not so easy, I'll try....
But, don't forget, this script is written for a TextView in Pythonista and you want to use it anywhere in other apps, like your mail...
It is not at all the same process.
That will not be solved in a few time 😢 -
@shinya.ta I've an important question.
This script runs in Pythonista and presents an UI View with a TextView and some buttons,
AND the keyboard has an additional row with emoji"s.If you want to use something like that in other apps, like Mail, is it only to have this additional row of emoji's?
-
What is easy is a little script that you can add to Pythonista keyboards and this new keyboard will offer the English keyboard and a row where you can display and tap your emojis like the actual script.
You can find an initial version here, tell me if it is ok
Of course, you have to add it to Pythonista keyboards via
tools/shortcuts/Pythonista keyboard/+ where you have to choose the script and the titleSee here, used in the mail program. But you don't have any TextView because the input field belongs to the Mail app. And, if you want an English keyboard, there is no room for other buttons.
-
There is no particular need for Emoji.
The most important one is the cursor move button. -
@shinya.ta 😢😢😢😢😢😢😢
Ok, I'll do it.
In summary:- Pythonista Keyboard usable in all apps
- standard English keyboard
- left or right cursor
You would not have all cursor move possibilities, I think, because the text field of any app is not a Pythonista TextView or TextField
Agree?
Do you still need emojis or do I put these left/right cursors in the same row?
Please, confirm
ThanksIf ok, it will be for tomorrow, I hope
-
If there is a space to put, I would like to have Emoji, but I don't mind if it isn't.
You need English and Japanese for the standard language keyboard. -
@shinya.ta The Pythonista keyboard only offers English keyboard.
Of course, you can always tap the globe key to shift to another international keyboard -
If so, please.
-
@cvp I haven't really delved into keyboard extensions on iOS, but apparently you should have access to a textDocumentProxy
- (void)moveCursorToLeft { [self.textDocumentProxy adjustTextPositionByCharacterOffset:-1]; } - (void)moveCursorToRight { [self.textDocumentProxy adjustTextPositionByCharacterOffset:1]; }
-
@JonB Not sure that could help because this proxy is a property of the UIControllerInputView and the associated methods are these ones that the keyboard module offers: move_cursor , insert, ....
I can move -1,+1 and I hoped that get_context would return the text before and after so i could move of their length but the returned tuple is only texts in the current line
-
Even this does not work, it stops after one line
def b_bottom_action(sender): while True: t = keyboard.get_input_context() if len(t[0]) == 0: break keyboard.move_cursor(-len(t[0]))
-
@shinya.ta New version here with buttons for
- left one position
- right one position
- begin of line
- end of line
Sorry, not yet found a way to go top and bottom of text
-
@cvp I could see that might not work., Without maybe a thread to keep moving?
-
@JonB Thanks to try to help us (him? 😀). I don't understand how I could follow your advice.
I've tried in the button's action to start a thread running the same loop, but no change -
@JonB But this works, not nice to see the cursor moving so slowly
import time import threading class my_thread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): while True: t = keyboard.get_input_context() if len(t[0]) == 0: break keyboard.move_cursor(-len(t[0])) time.sleep(0.0001)
-
Out of curiosity, what if you move_cursor(-10000) or something quite large... Does it only let you move the length of the context, or will it error if you go more than the textview would allow?
-
I tested.
This is wonderful.
If there is an up-and-down button, it is perfect. -
@JonB I had tried very big moves, no error but no movement
-
@JonB this morning, weird effect, regardless of where the cursor is, it always descends to the same place, while the move parameter is negative. Perhaps, it is too early for my iPad 😊