On Sat, Feb 25, 2012 at 11:43 PM, Peter Bittner <[email protected]> wrote: > Question on the bootstrap-loader implementation: How do I create a > custom bootstrap (with progress indicator) for my project correctly?
to be honest i don't know - it's not something i've looked at - other people have always made the modifications since the original (one) bootstrap.js was created, five years ago. ok maybe i made a few tweaks three years ago, but the optional stuff particularly the --bootstrap-file parameter was added by other people. > *) After compilation with pyjs there is a 'bootstrap.js' and a > 'bootstrap_progress.js' in the output/ folder. This is just for the > developer's convenience, right? One of them (bootstrap_progress.js) is > not used by default; it used to be. > 'bootstrap_progress.js' is just an _example_ of > how to implement a bootstrap startup animation. > > *) The pyjsbuild command has a parameter --bootstrap-file=BOOTSTRAP_FILE > > *) So, I'm expected to take one of the two bootstrap Javascript files, > customize the function __pygwt_earlyUser(), save the customized > bootstrap.js file (preferably in the application base folder, _not_ in where's the current location for those files? to be honest i don't know. > public/) and run 'pyjsbuild --bootstrap-file=bootstrap.js > <app_name>.py' everytime I want to build the Javascript code for > deployment. > > Is this correct? sounds about right. > 2012/2/25 lkcl luke <[email protected]>: >>> So, if you really really by all means want that in the bootstrap >>> loader, what shall I do? >> >> what i would suggest is this (documented, of course): >> >> * look for a div with an id of "bootstrap-loader". >> * if it doesn't exist, create one, and add it with a "float" and a >> higher z-index, perhaps centre it etc. etc. >> * add the gif image to it (again, using DOM appendChild) >> * run the usual stuff >> * after everything's loaded, remove the div. > > All those steps (bullets from above) are expected to happen in the > bootstrap.js __pygwt_earlyUser() function, correct? i have no idea because i didn't write this __pygwt_earlyUser function. but it sounds about right. >> in this way, the operation of the bootstrap loader does *not* >> interfere with pyjd. > > Interestingly, all this is already in there (as a static > implementation in index.html) ... which, under pyjd, never gets removed, which is the bug that requires correcting. > with the only difference that the > z-index is -1 and the bootstrap-loader div is therefore covered by the > elements that the website.py application creates (i.e. the violet/pink > header). What's missing is that the div is removed after all loading > is completed. correct. > Just for curiosity's sake: The bootstrap.js is not (supposed to be) > executed when running the app with pyjd? correct. well.. you _could_ execute it, but it would load javascript, wouldn't it? > What's so important about that? do you want _two_ applications in the same web page - one running as javascript and one running as python? > Why, as we're happy with a dumb animation and are not looḱing > for a sophisticated full-featured progress bar show the percentage of > completion, why do we strictly want the image to be inserted into the > DOM by Javascript? who said > What if loading the bootstrap javascript file > fails? (Note: _that_ is the weak link!) Nothing would be displayed; > typically a _blank_ page would show up, ouch! orrr, in the case of the static html index.html, that stupid gif image would _never_ be removed. > I do understand that, as for semantics, showing the loading progress > sort of "belongs to" the javascript activities. yes. and as such should never interfere with the operation of the exact same application when run as a pyjd application, which will never run or execute or even have access to that javascript loader, whatsoever. l.

