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.
pythonista UI
-
@cvp
.
.
.
sleep(0.5)↑ Is the place to insert the cord bad?
-
@shinya.ta You could try to inverse cursor/sleep/speech
tvo = ObjCInstance(tv) p1 = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i) p2 = p1 tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(p1,p2) sleep(0.5) #speech.say(c,'en-US') speech.say(c,'ja-JP')
-
It was successful.
Even if I use VoiceOver, they read aloud properly.
Thank you very much.
This completes.After all, you're genius.
I'm full of gratitude.Thank you very much for your help.
-
@shinya.ta You are too kind. Really, I'm not a genius at all.
Happy to have helped you and your wife with this marvelous app. -
Dear.@cvp
I noticed it when I was adjusting the application.
I want to delete the back of the cursor like the delete button on the iPhone.
In this situation, you can't delete letters at the place where the cursor is moved.
Where should I change the code?
b_del = ui.Button()
b_del.frame = (10,250,100,32)
b_del.title = 'del'
b_del.background_color = 'white'
b_del.border_width = 1
def b_del_action(sender):
tv = sender.superview['TextView']
i = tv.selected_range[0]
if i < len(tv.text):
tv.text = tv.text[:i] + tv.text[i+1:]
#tv.selected_range = (i,i) # refused if i = len(tv.text)
tvo = ObjCInstance(tv)
p1 = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i)
p2 = p1
tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(p1,p2)
say_char(tv)
b_del.action = b_del_action
v.add_subview(b_del) -
@shinya.ta As I don't know if you want to have two buttons, I let the code for both actions.
See the explanations in commentsb_del = ui.Button() b_del.frame = (10,250,100,32) b_del.title = 'del' b_del.background_color = 'white' b_del.border_width = 1 def b_del_action(sender): tv = sender.superview['TextView'] i = tv.selected_range[0] #if i < len(tv.text): # if delete at cursor if i > 0: # if delete at left of cursor #tv.text = tv.text[:i] + tv.text[i+1:] # if delete at cursor tv.text = tv.text[:i-1] + tv.text[i:] # if delete at left of cursor i = i - 1 # if delete at left of cursor #tv.selected_range = (i,i) # refused if i = len(tv.text) tvo = ObjCInstance(tv) p1 = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i) p2 = p1 tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(p1,p2) say_char(tv) b_del.action = b_del_action v.add_subview(b_del)```
-
Thank you very much.
I am not good at English, but I understand the meaning of comments.
I tried to solve it by myself, but I was in trouble because there was only an error message.
I will finish work after three hours, so I will try it immediately.
-
It was successful, thank you.
I have another question. If I use the copy button, I copy the code of this application.
Why can't I make a copy of the textbook?
-
@shinya.ta It's because your line b_copy.action = b_copy_action is indented in the def...
def b_copy_action(sender): tv = sender.superview['TextView'] clipboard.set(tv.text) b_copy.action = b_copy_action v.add_subview(b_copy)
Must become
def b_copy_action(sender): tv = sender.superview['TextView'] clipboard.set(tv.text) b_copy.action = b_copy_action v.add_subview(b_copy)
-
Thank you very much.
This really ends.
I'm full of gratitude.
My wife was very satisfied.Oh God, thank you very much.
-
-
Dear.cvp
This keyboard application was the best.
But there is a problem.
When you enter the emoji of the iPhone, it doesn't move to the end of the sentence when you move the cursor with the end button.The cursor stops before two letters, and it doesn't move even when I press the right button.
If I don't use emoji, it works properly, so I think the emoji is the cause, but I don't know how to solve it.
If you change the line with Emoji, Emoji will also disappear.
Is this a bug?
-
@shinya.ta The reason is that emoji count as 2 characters and the objectivec positionFromPosition_offset_ is not working correctly with these characters.
You can even have some crashes of your app.
I don't know how to solve that but I'll search.
Temporary, you can press multiple times the left or right key. -
Should I?
It always occurs when emoji are used.
Is there a solution? -
@shinya.ta I hope there is a solution but I have to spend some time to find it. That will not be for today, sorry, very busy Sunday...
Edit: the temporary bypass I propose is if you tap end and the cursor stops two characters earlier, tap right several times...
-
-
@shinya.ta Really, it will not be easy. For instance, a flag emoji counts as 2 for the len(text) but as 4 for selected_range
-
@cvp, I think you may want to use some of the NSString methods, which let you get index per character
-
@JonB Thanks to pointing that for me. But for flags emoji, with two glyphs, it seems very complex (composedcharacters), thus I will try to count the number of bytes generated by each character...
-
Cursor position changes according to the type of emoji.
( ◠‿◠ )(^ ^)(^∇^)
It is fine with the letter above, but it does not read it in Voice over.