Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 371 → Rev 372

/branches/BR-0.4/basico/widgets/wdg_browser.py
11,11 → 11,14
gi.require_version('Gtk', '3.0')
 
try:
gi.require_version('WebKit', '4.0')
gi.require_version('WebKit2', '4.0')
from gi.repository import WebKit2 as WebKit
WEBKIT_RELEASE = 4
except:
gi.require_version('WebKit', '3.0')
from gi.repository import WebKit
WEBKIT_RELEASE = 3
from gi.repository import Gtk
 
30,20 → 33,25
# ~ super(BasicoBrowser, self).__init__(*args, **kwargs)
Gtk.VBox.__init__(self)
self.app = app
if WEBKIT_RELEASE == 4:
self.log.debug("Using WebKit2 (4.0)")
else:
self.log.debug("Using WebKit (3.0)")
self.webview = WebKit.WebView()
 
settings = self.webview.get_settings()
settings.set_property('enable-developer-extras', False)
settings.set_property('enable-default-context-menu', True)
settings.set_property('default-encoding', 'utf-8')
settings.set_property('enable-private-browsing', False)
settings.set_property('enable-html5-local-storage', True)
if WEBKIT_RELEASE == 3:
settings = self.webview.get_settings()
settings.set_property('enable-developer-extras', False)
settings.set_property('enable-default-context-menu', True)
settings.set_property('default-encoding', 'utf-8')
settings.set_property('enable-private-browsing', False)
settings.set_property('enable-html5-local-storage', True)
 
# disable plugins, like Adobe Flash and Java
settings.set_property('enable-plugins', True)
# disable plugins, like Adobe Flash and Java
settings.set_property('enable-plugins', False)
 
# scale other content besides from text as well
self.webview.set_full_content_zoom(True)
# scale other content besides from text as well
self.webview.set_full_content_zoom(True)
 
self.show()
scrolled_window = Gtk.ScrolledWindow()