[TxMt] dialog.py UTF-8 problem
Alex Ross
ajross at cs.pdx.edu
Fri May 30 17:17:22 UTC 2008
On May 30, 2008, at 12:02 AM, Hans-Joerg Bibiko wrote:
>
> On 30 May 2008, at 04:58, Alex Ross wrote:
>>> ...
>>> suggestions = list(list(unicode(grepout.read(), "UTF-8"))[2:])
>>> ...
>> Just a tip here...
>>
>> a_list[2:] returns a list, so the second list call is redundant.
> Thanks. I've already mentioned, I'm just learning python, but I
> thought: make assurance double sure. ;)
>
>
>>> suggestions contains a list of Unicode characters. Fine.
>>> suggestions[3] etc. can I insert in TM's document perfectly.
>>>
>>> But:
>>>
>>> result = dialog.menu(suggestions)
>>>
>>> fails.
>>>
>> dialog.py didn't support unicode. I have made a couple changes
>> that I think should fix you're problem. Let me know if it works now!
>
> Now it works brilliant. Thanks a lot. Yesterday I wrote my own
> routine to call tm_dialog directly, but now the code looks much more
> elegant :)
>
> But one tiny thing I found in dialog.py line 14:
> dialog = os.path.join(support, 'bin/tm_dialog')
>
> You bound it directly. I would suggest to use
> dialog = os.environ["DIALOG"]
> caused by the issue that we have DIALOG1 (tm_dialog) and DIALOG2
> (tm_dialog2). If one calls DIALOG2 with the 'old' argument structure
> it switches automatically to DIALOG1. By doing so, I mean, the
> script is more flexible.
Duly noted. The change is made.
More information about the textmate
mailing list