Closed GoogleCodeExporter closed 9 years ago
Can you prepare a simple example of this behavior? I don't think that CEF has
anything to do with this, you're probably doing something wrong.
Original comment by czarek.t...@gmail.com
on 9 Sep 2012 at 8:22
Here's the simple sample.
3 files, the cef file, the html file, and the imported module.
It simply returns a number, and puts it in the input box.
1) run the app and press the button. It returns 1.
2) change test.py to return 2
3) press F5 (reload) on the CEF window
4) press the button again. It should return 2, but it still returns 1.
If there was a way to reload the Binding, that would be awesome.
As it is now, any HTML changes are done without reloading the app.
Imported modules should be able to do the same.
However I don't expect the CEF file to be able to reload, that is the
nature of apps.
Original comment by rich...@gmail.com
on 9 Sep 2012 at 8:48
Attachments:
This is how reload() works, references to old functions still exist, you need
to re-bind all functions to make it work.
What you should do is to create a function called "do_bindings()" that you call
when creating browser, and call again after you click F5.
But there is currently a problem with this, as you are not allowed to call
bindings.SetFunction("test", test.test) again, when you try to do this you get
this error:
Exception: JavascriptBindings.SetFunction() failed: browser was already created, you are not allowed to call this function now.
Attaching: test_noreload2.zip
Original comment by czarek.t...@gmail.com
on 10 Sep 2012 at 3:14
Attachments:
So the method you included in your sample file will be the correct method to
reload an imported file, but currently it causes an error. Is that correct?
Original comment by rich...@gmail.com
on 10 Sep 2012 at 4:10
Yes, that is correct. That's the only way I see it, if you have other idea then
introduce it.
Original comment by czarek.t...@gmail.com
on 10 Sep 2012 at 7:49
Fixed application crash when tried to call Frame.SetProperty() from OnKeyEvent,
it happened because v8 object was being created in wrong context. It is now
possible to do rebinding using Frame.SetProperty(), but it won't work if you
call browser.Reload() or browser.ReloadIgnoreCache(), as it calls
asynchronously and you lose the binding that was made with Frame.SetProperty().
Next step is to implement JavascriptBindings.Rebind() method.
Original comment by czarek.t...@gmail.com
on 14 Sep 2012 at 3:58
Issue fixed, see Revision 085042108e55.
This feature will make into 0.41 release today.
Original comment by czarek.t...@gmail.com
on 14 Sep 2012 at 5:34
[deleted comment]
[deleted comment]
Attachment didn't go through, but can't wait to see a reload work.
Will it work with F5?
Original comment by rich...@gmail.com
on 14 Sep 2012 at 5:49
Attachment works, check again.
Yes it works with F5.
Original comment by czarek.t...@gmail.com
on 14 Sep 2012 at 5:56
My fault, I was looking in Email. :P
Original comment by rich...@gmail.com
on 14 Sep 2012 at 6:11
I've updated reload_example to support Python 3 (use of "imp.reload" instead of
"reload"). Attaching reload_example.zip again.
Version 0.41 released, go to Downloads.
Original comment by czarek.t...@gmail.com
on 14 Sep 2012 at 6:49
Attachments:
Rebind works great. This should make things more productive!
And thanks for the sample too, since we need to know that
browser.ReloadIgnoreCache() needs to be called after a ReBind.
Original comment by rich...@gmail.com
on 14 Sep 2012 at 7:10
Use the code below to reload all loaded modules:
import sys, imp
for mod in sys.modules.values():
if mod and mod.__name__ != "__main__": imp.reload(mod)
Original comment by czarek.t...@gmail.com
on 15 Sep 2012 at 2:13
Remember that if you have code like this:
from mymodule import SomeClass
Then after you reload mymodule, SomeClass will still reference the old module,
to reference the new module you would have to execute "from module" statement
again, so better to avoid "from module" statements when using reload().
Original comment by czarek.t...@gmail.com
on 15 Sep 2012 at 2:21
After reloading all modules you need to set exception handler for the sys
module again:
sys.excepthook = cefpython.ExceptHook
I've added a Rebind/reload example to cefadvanced.py, see revision cc81ffd26efe.
Original comment by czarek.t...@gmail.com
on 15 Sep 2012 at 4:03
Rebind example updated, now it only reloads application modules, it checks it
by module source file path, see revision 1ef1382e9dea.
Original comment by czarek.t...@gmail.com
on 15 Sep 2012 at 5:11
Original issue reported on code.google.com by
rich...@gmail.com
on 9 Sep 2012 at 8:14