On Thu, Feb 2, 2012 at 1:30 PM, lkcl luke <[email protected]> wrote:
> On Thu, Feb 2, 2012 at 5:50 PM, C Anthony Risinger <[email protected]> wrote:
>> On Thu, Feb 2, 2012 at 5:27 AM, lkcl luke <[email protected]> wrote:
>>> On Thu, Feb 2, 2012 at 5:40 AM, C Anthony Risinger <[email protected]> wrote:
>>>>
>>>> i am returning to mail app for now, but i've also been thinking of
>>>> ways to hint to pyjs that pyjd is running, and thus prevent the app
>>>> from loading twice.
>>>
>>> ahh no don't do that: it's by design. people may _want_ to run a
>>> compiled app within the browser-engine-that-is
>>
>> yeah i don't want to disable JS (google maps/etc possibly), but i do
>> want to stop the JS version of an app from loading right next to the
>> python driven one.
>
> nnope - you don't :)
>
> seriously: don't go down that route. pyjd loaders should load up a
> *separate* HTML file which does *not* even have the "meta" tag in it.
>
> if people *do* have it, then it is an indication that they *want* it
> to be loaded.
hmm, i'm inclined to agree, because i'm against using the same
top-level python for for both translation *and* pyjd (use same libs,
different 15 line kickstart files), but i'm not sure about the HTML
file, because with the exception of the bootstrap JS file, it should
be identical? CSS, other meta tags, etc ...
... i want everything else to work, and not maintain 2 files that are
identical, save a single line. how about a function in the pyjd
module, say `pyjd.jsdisable(True)` or something better, that would
tell pyjd to prevent bootstrap from loading? it could scan for a
`data-pyjs-bootstrap` attribute and remove/disable the corresponding
tag. could be False by default.
>>> what would be bloody good though would be finding a way to stop the
>>> double-"onload" responses. _every_ sodding engine does this - not
>>> just the webkit one but the Trident engine _and_ xulrunner.
>>
>> this is all in the python code right (not JS onload)?
>
> JS onload === python onload, it's the exact same thing. ok, allow me
> to be a bit clearer. the "onload" system is *exactly* the same, in
> the browser engines.
>
> however, in pythonwebkit, and in MSHTML-with-a-pythonCOM interface
> _and_ in xulrunner-with-pythonxpcom, you are allowed to add *python*
> functions to events *not* just random bits of javascript.
ok yeah, i know all that (python/JS equivalence), TBH i'm not sure
what i was referencing ... nevermind :-)
> so in the pyjd/pywebkitgtknew.py, it's the call to
> SetDocumentLoadedCallback. this is equivalent to "body.onload = {foo
> fn}" in javascript.
> in MSHTML, you have to subscribe to the DWebBrowserEvents2 interface,
> and a function "DocumentComplete" gets called... TWICE!
>
> it's the same with the hulahop.py code.
>
> i have _no_ idea why.
hmm that is interesting. IIRC document loaded event is similar to XHR
requests -- they get multiple invocations with a different state
(started, partial, loaded, etc). i'll have a look at this on the
webkit variant tonight.
--
C Anthony