Giter Club home page Giter Club logo

Comments (19)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 9 Sep 2012 at 8:22

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 9 Sep 2012 at 8:48

Attachments:

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 10 Sep 2012 at 3:14

  • Changed title: Allow to rebind javascript function so that Python's reload() works
  • Changed state: Accepted

Attachments:

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 10 Sep 2012 at 4:10

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Yes, that is correct. That's the only way I see it, if you have other idea then 
introduce it.

Original comment by [email protected] on 10 Sep 2012 at 7:49

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 14 Sep 2012 at 3:58

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Issue fixed, see Revision 085042108e55.

This feature will make into 0.41 release today.

Original comment by [email protected] on 14 Sep 2012 at 5:34

  • Changed state: Fixed

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
[deleted comment]

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
[deleted comment]

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Attachment didn't go through, but can't wait to see a reload work.
Will it work with F5?

Original comment by [email protected] on 14 Sep 2012 at 5:49

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Attachment works, check again.
Yes it works with F5.

Original comment by [email protected] on 14 Sep 2012 at 5:56

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
My fault, I was looking in Email.  :P

Original comment by [email protected] on 14 Sep 2012 at 6:11

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 14 Sep 2012 at 6:49

Attachments:

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 14 Sep 2012 at 7:10

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 15 Sep 2012 at 2:13

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 15 Sep 2012 at 2:21

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
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 [email protected] on 15 Sep 2012 at 4:03

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Rebind example updated, now it only reloads application modules, it checks it 
by module source file path, see revision 1ef1382e9dea.

Original comment by [email protected] on 15 Sep 2012 at 5:11

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 3, 2024
Project will move to Github. Find this issue at the new address (soon): 
https://github.com/cztomczak/cefpython/issues/12

Original comment by [email protected] on 24 Aug 2015 at 6:24

from cefpython.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.