Comments (19)
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.
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.
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.
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.
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.
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.
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.
[deleted comment]
from cefpython.
[deleted comment]
from cefpython.
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.
Attachment works, check again.
Yes it works with F5.
Original comment by [email protected]
on 14 Sep 2012 at 5:56
from cefpython.
My fault, I was looking in Email. :P
Original comment by [email protected]
on 14 Sep 2012 at 6:11
from cefpython.
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.
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.
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.
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.
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.
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.
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)
- The default en-US locale pak file fails to load on Mac HOT 7
- Examples crash on Mac when app doesn't have permission to write to the debug.log file HOT 2
- Issues with size_t => int conversions when using cef_values.h API on Win x64 platform HOT 3
- Python Wheels - DESCRIPTION.rst UNKNOWN HOT 1
- Embed __version__ also in the cython generated module (cefpython_py27.pyd) HOT 2
- Create unified key mappings for all platforms HOT 9
- Add Browser.IsDevTools() HOT 2
- Expose CreateBrowser() with a callback argument that will be executed after browser was created HOT 2
- The popup window and parent window can't script each other in the wxpython.py example HOT 4
- Create "chrome31" branch before updating to a newer CEF branch HOT 2
- wxpython-response.py example: final url is wrong when doing redirects HOT 8
- Close the browser BEFORE the page is full loaded CEF Crashe HOT 1
- Warnings on OS X: Internals of CFAllocator not known HOT 2
- [meta] Migrate the repository somewhere HOT 2
- Gtk: gtk_disable_setlocale() must be called before gtk_init() HOT 3
- Restructure directories (binaries, installer, libraries) to allow for git branching HOT 2
- Automating navigation HOT 1
- Google Code is dying HOT 1
- Update to CEF branch 2171 (Chrome 39) HOT 2
- Ability to pass modifiers to SendMouseMoveEvent and similar HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cefpython.