So I start discussion. To all: it's about
https://github.com/pyjs/pyjs/pull/761 . Problem (at least IMHO it's a problem) is, that when using widget, we need to do two things: 1. import it in .py and use it properly, 2. add appropriate section into .css of application, by copy&paste it from example/kitchensink/widget documentation. In such way, when I first did my own pyjs "hello world with widget" , it looked like shit, because no styles. I don't remember which widget it was. I think that it should work in such way, that widget, when used, adds it's own style into page, and when we need to modify it's look, then we can write CSS rules which override builtin ones. Change is in https://github.com/mahomahomaho/pyjs/commit/936985428e82cc783a510a812075ad92ed1c3d4e and usage example in https://github.com/mahomahomaho/pyjs/commit/83af8814bb36ea48931ec43611d19e593af60f2a In short, every widget (every UIObject) has method setCSS, and every widget which needs to be shipped with .css file, uses this method in it's constructor, showing widget name and .css file (relative to public/) Replying to A. W dniu 27.07.2012 06:06, C Anthony Risinger pisze:
hmm, not sure about this. i agree with the use case, but i'm not sure this is the right way,
I'm not 100% sure either. But I just realized how could it be done, so I did it. Maybe it's not 100% right and different approach should be used ....
and may be an issue for native runtimes
I think it shouldn't. In worst case, we could make this method no-op for native runtimes. However - I cannot say anything about native runtimes, because once I changed Debian to Ubuntu, I lost ability to use native runtime :).
-- can you please start a discussion on `pyjs-users` about it? we have talked about it in the past to no avail. a more universal approach is probably to embed/concat the CSS at translation time, then inject using DOM methods (there are methods for handling stylesheets) ... this also eliminates the potential doubling of HTTP requests, but can discuss more on-list.
I don't think that additional http requests would be problematic. They will be made once in widget lifetime, and will be probably cached by browser.
We could think about merging all. css into one big file, but I think it can be safely next step.
-- pozdrawiam Łukasz Mach - [email protected] --
