Coder Social home page Coder Social logo

garden.cefpython's Introduction

CEF browser widget

This is a widget that embeds cefpython into a Kivy widget.

It has been tested only on Linux 64bit so far.

Example

from kivy.app import App
from kivy.garden.cefpython import CEFBrowser

class SimpleBrowserApp(App):
    def build(self):
        return CEFBrowser(url="http://kivy.org")
SimpleBrowserApp().run()

Status

This project shouldn't be considered stable. There are many things, as e.g. downloads which aren't implemented or causing proplems. Tested on Ubuntu 14.04.1 LTS 64bit with the following debian packages installed:

  • libnss3-1d
  • libnspr4-0d

If it does not work on Windows, it is most probably because not all the needed DLLs are copied correctly from the downloaded ZIP file. You would then need to edit lib/cefpython_sources.json.

How to develop with virtualenv

  1. Create a virtualenv: virtualenv venv
  2. Install kivy into virtualenv (consult kivy docs for this)
  3. Install other dependencies into virtualenv: venv/bin/pip install -r requirements.txt
  4. Symlink cefbrowser into graden directory: ln -s path/to/gardne.cefpython ~/.kivy/garden/garden.cefpython
  5. Now you should be able to launch one of the examples: venv/bin/python examples/minimal.py

How to develop with virtualenv and prebuilt packages from Rentouch (Py2.7 & Linux)

  1. Create a virtual: virtualenv venv
  2. Update Pip: venv/bin/pip install -U pip
  3. Install Kivy into venv: venv/bin/pip install Kivy==1.9.2-dev0xinput4 --index-url https://wheels.rentouch.ch If you get an cert-mismatch error: use: venv/bin/pip install Kivy==1.9.2-dev0xinput4 --index-url https://wheels.rentouch.ch --trusted-host wheels.rentouch.ch
  4. Install other required libraries (as Cefpython) by: venv/bin/pip install -r requirements.txt --index-url https://wheels.rentouch.ch --trusted-host wheels.rentouch.ch
  5. Create garden folder if not existing: mkdir ~/.kivy/garden
  6. Symlink garden.cefpython into graden directory: ln -s path/to/this/garden.cefpython ~/.kivy/garden/garden.cefpython
  7. Now you should be able to launch one of the examples: venv/bin/python examples/minimal.py

How to develop with virtualenv and prebuilt packages from Rentouch (Py3 & Linux)

Basically you have to follow the steps for 2.7 above:

  1. virtualenv -p python3 3venv
  2. 3venv/bin/pip install Kivy==1.9.2-dev0xinput4 --index-url https://wheels.rentouch.ch --trusted-host wheels.rentouch.ch
  3. 3venv/bin/pip install cefpython3
  4. ln -s path/to/this/garden.cefpython ~/.kivy/garden/garden.cefpython

Known Issues

  • Documentation is poor
  • API (Methods of CEFBrowser) will still be subject to change
  • Keyboards sometimes don't vanish, when another element is focused, system keyboard input is sometimes redirected to multiple focused elements, etc.

Contribute

  • Test on all operating systems and file bug reports

garden.cefpython's People

Contributors

allestuetsmerweh avatar hnb2 avatar jegger avatar tito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

garden.cefpython's Issues

Be able to declare command-line-switches

I have to be able to set enable-media-stream on cefpython.Initialize() to be able to use WebRTC features.

As an example I would:
switches = {"enable-media-stream": ""}
cefpython.Initialize(settings, switches)

Not able to run examples

When I try to run the examples, I'm getting the following error. Please help me out.

###########
RESTART: /home/susheel/Downloads/garden.cefpython-master/examples/tabbed.py
[ERROR ] Error while activating FileHandler logger
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/kivy/logger.py", line 225, in emit
self._configure()
File "/usr/lib/python2.7/dist-packages/kivy/logger.py", line 183, in _configure
FileHandler.fd = open(filename, 'w')
IOError: [Errno 13] Permission denied: u'/home/susheel/.kivy/logs/kivy_17-10-12_0.txt'
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [OSC ] using for socket
[INFO ] [Window ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] Backend used
[INFO ] [GL ] OpenGL version <4.5.0 NVIDIA 375.66>
[INFO ] [GL ] OpenGL vendor
[INFO ] [GL ] OpenGL renderer <GeForce 830M/PCIe/SSE2>
[INFO ] [GL ] OpenGL parsed version: 4, 5
[INFO ] [GL ] Shading version <4.50 NVIDIA>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
Going to import /home/susheel/.kivy/garden/garden.cefpython/libs/linux64.py2/libcef.so

Traceback (most recent call last):
File "/home/susheel/Downloads/garden.cefpython-master/examples/tabbed.py", line 15, in
from kivy.garden.cefpython import CEFBrowser
ImportError: cannot import name CEFBrowser

Make vkeyboard work with SDL2 window provider

When Kivy is used with the SDL2 window provider, vkeyboard triggers on_textinput instead of on_key_down.
i don't know if this can be seen as a bug in kivy or not. The commit which introduced this behavior: kivy/kivy@35ca827

When using on_textinput we don't get the modifier keys?
Do we need the modifier keys?

Fix cert-handler

CEFBrowser.certificate_error_handler;
TypeError: unbound method must be called with CEFBrowser instance as first argument (got int instance instead)

system keyboard input

system keyboard (physical keyboard) input is being redirected to all focused elements

=> This may be an issue of kivy

two kivy apps

If CEFPython needs to be downloaded, the popup seems to stay on screen (but is covered by the new content)
Need to find out, how two kivy apps (one after the other) can be used in a correct manner!

keyboard_mode=systemanddocked

when keyboard_mode is systemanddocked and the browser loses focus (another widget is focused), the browser won't un-focus the active HTML element

Resolve Keyboard issues

  • blur, when calling release_keyboard
  • re-request keyboard when showing CEFBrowser again in tabbed.py
    => does this even make sense? when resolving the first issue, we don't know the active element for the second issue anymore

Total freeze of Kivy application

After a while browsing, the application freezes. Not just the browser, also the kivy loop seems blocked. No error / crash.

I can't reproduce the issue yet but it happens from time to time in all applications where this garden.cefpython is used.

Seg-fault in tabbed.py

  1. Run tabbed.py
  2. create a new tab => google.com gets loaded
  3. close all the keyboards
    4.(you can't type into google textinput) & close tab => segfault

Syntax Error: Missing parentheses in call to 'print'

when i run python3 setup.py install

ERROR:......MSG................................
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "setup.py", line 34, in
install_requires=reqs,
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/install.py", line 117, in do_egg_install
cmd.run(show_deprecation=False)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 408, in run
self.easy_install(spec, not self.no_deps)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 650, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 697, in install_item
self.process_distribution(spec, dist, deps)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 745, in process_distribution
[requirement], self.local_index, self.easy_install
File "/home/navid/.local/lib/python3.6/site-packages/pkg_resources/init.py", line 768, in resolve
replace_conflicting=replace_conflicting
File "/home/navid/.local/lib/python3.6/site-packages/pkg_resources/init.py", line 1051, in best_match
return self.obtain(req, installer)
File "/home/navid/.local/lib/python3.6/site-packages/pkg_resources/init.py", line 1063, in obtain
return installer(requirement)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 669, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 695, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 890, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1162, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1146, in run_setup
run_setup(setup_script, args)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/sandbox.py", line 257, in run_setup
raise
File "/usr/lib/python3.6/contextlib.py", line 99, in exit
self.gen.throw(type, value, traceback)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/sandbox.py", line 193, in setup_context
yield
File "/usr/lib/python3.6/contextlib.py", line 99, in exit
self.gen.throw(type, value, traceback)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/sandbox.py", line 164, in save_modules
saved_exc.resume()
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/sandbox.py", line 139, in resume
raise exc.with_traceback(self._tb)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/sandbox.py", line 152, in save_modules
yield saved
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/sandbox.py", line 193, in setup_context
yield
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/sandbox.py", line 254, in run_setup
_execfile(setup_script, ns)
File "/home/navid/.local/lib/python3.6/site-packages/setuptools/sandbox.py", line 43, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-82024l6k/wsgiref-0.1.2/setup.py", line 5, in
# Written by Rentouch 2014 - http://www.rentouch.ch
File "/tmp/easy_install-82024l6k/wsgiref-0.1.2/ez_setup/init.py", line 170
print "Setuptools version",version,"or greater has been installed."
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Setuptools version",version,"or greater has been installed.")?

start url can't be "about:blank"

If the start-url is about:blank, the back/forward functions won't work properly after loading the first real site.
=> Maybe bug in CEF / CEFPython

Reproduce:

  • In examples/controls.py / .kv gets the URL set after the creation of the browser-class => about:blank gets set.
  • If you browser the web now, you can't use go_back()

If you change "about:blank" to a url in cefbrowser.py it will work.

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.