On Thu, Aug 23, 2012 at 6:42 AM, Rene Maurer <[email protected]> wrote:
> On 08/22/2012 at 23:08 C Anthony Risinger <[email protected]> wrote:
>> On Wed, Aug 22, 2012 at 12:47 AM, Rene Maurer <[email protected]>
>> wrote:
>>>
>>> I have no time to do really deep testing. But as far as i can see my
>>> non-trival application (using timers, json rpc etc etc) runs without
>>> any serious troubles! (i have an unicode exception in a dialog and i
>>> assume some text colors must be defined in css ...as they are white
>>> instead of black). I also have the impression that giwebkit is
>>> really fast (at least faster than python webkit).
>>
>> i'd be interested in hearing more about the unicode exception when you
>> get a chance (there is plenty to do, no rush there ...).
>
> I have just tried the following snippets (embedded in my app):
>
> This one works:
> tb = TextBox()
> tb.setText(u"oaueau")
>
> This one doesn't:
> tb = TextBox()
> tb.setText(u"öäüéàè")
>
> => File
> "/home/rene/Local/python/pyjs/pyjs/library/pyjamas/ui/TextBoxBase.py",
> line 113, in setText DOM.setAttribute(self.getElement(), "value",
> str(text)) UnicodeEncodeError: 'ascii' codec can't encode characters in
> position 0-11: ordinal not in range(128)
>
> This one works again:
> tb = TextBox()
> tb.setText(u"öäüéàè".encode("utf-8"))
does this work in other runners? like the pywebkitgtk one?
i think this is a general python issue -- from my testing it's unrelated:
>>> 'öäüéàè'
'\xc3\xb6\xc3\xa4\xc3\xbc\xc3\xa9\xc3\xa0\xc3\xa8'
>>> u'öäüéàè'
u'\xf6\xe4\xfc\xe9\xe0\xe8'
>>> type('öäüéàè')
<type 'str'>
>>> type(u'öäüéàè')
<type 'unicode'>
... unless you `from __future__ import unicode_literals` in python
2.x, literal unicode is really a string of bytes (what would be a
`bytes` object in python3), hence no decode error.
however, a simple:
grep -R 'str(' library/
... shows very few places this is done; i think it would be OK to drop
the str() call here. can you verify removing the call to str() works
fine?
> Besides....
>
> I have to use pyjd explicitly to start the "desktop":
>
> ../../pyjs/bin/pyjd Desktop.py
>
> When I use python I have:
>
> python2 Desktop.py
> Traceback (most recent call last):
> File "Desktop.py", line 8, in <module>
> import pyjd
> File "/usr/lib/python2.7/site-packages/pyjd/__init__.py", line 5, in
> <module> from pyjs.runners import RunnerManager
> ImportError: No module named runners
>
> "import pyjd" is the very first statement in Desktop.py. I have cleaned
> everything and installed from scratch. So maybe I have just forgotten
> something.
have you installed from a recent build? i am trying to eliminate the
pyjd module altogether. this module was introduced here:
https://github.com/pyjs/pyjs/commit/a9e41c9c88c34dca10894d176dea268a19249a31
... my plan is to drop `pyjd` module altogether. it presence causes
complicated bootstrapping issues and tons of sys.path mangling, along
with being hard to modify/extend because a dummy module is required in
pyjs.
in the near future the "pyjd" module disappear, and be replaced by an
actual tool, say (hypothetical):
pyjs runner --backend="giwebkit" --root="/path/to/..." --fullscreen
/path/to/my/application.py
... as this will allow me to really clean up some cruft, drop pyjd
requirement from the JS side of things, and make the whole thing
simpler and more flexible.
--
C Anthony
--