Christian Scharkus wrote:
> Hi :)
>
> I've already send a mail because of ä,ö,ü and ß in Input-fields but
> now I think I have isolated something about that in my own code:
>
> def onKeyPressed(self, size, key):
> KeckzBaseIOTab.onKeyPressed(self, size, key)
> if key == 'tab':
> input = self.Input.get_edit_text()
> if len(input) is not 0:
>
> input,crap=input[:self.Input.edit_pos].split(),input[self.Input.edit_pos:]
> nick = input.pop().lower()
> solutions=[]
> for i in self.completion:
> if nick in str(i[:len(nick)]).lower():
> solutions.append(i)
> if len(solutions) != 0 and len(solutions) != 1:
> self.addLine(" ".join(solutions))
> elif len(solutions) is not 0:
> input.append(solutions[0])
> if len(input) is not 1:
> self.Input.set_edit_text(" ".join(input)+" "+crap)
> else:
> self.Input.set_edit_text(" ".join(input)+",
> "+crap)
>
> self.Input.set_edit_pos(len(self.Input.get_edit_text())-len(crap))
> else:
> self.keypress(size, key)
>
> This snippet is used to complete nicknames in the inputfield and works
> fine except you type some unicode-letters like ä,ö,ü and ß after using
> the nickcompletion.
> Any ideas about how I could circumvent this?
I would first suggest that you use only unicode strings in your
application. Urwid accepts either regular strings or unicode strings,
but that's mostly just a historical artifact. If all your strings are
unicode you shouldn't have problems with concatenation.
Ian
_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid