本文整理汇总了Python中gi.repository.WebKit.set_web_database_directory_path方法的典型用法代码示例。如果您正苦于以下问题:Python WebKit.set_web_database_directory_path方法的具体用法?Python WebKit.set_web_database_directory_path怎么用?Python WebKit.set_web_database_directory_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.WebKit
的用法示例。
在下文中一共展示了WebKit.set_web_database_directory_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import WebKit [as 别名]
# 或者: from gi.repository.WebKit import set_web_database_directory_path [as 别名]
def __init__(self, parentWidget):
WebKit.WebView.__init__(self)
self.load_finish_flag = False
self.set_property('can-focus', True)
self.set_property('can-default', True)
self.set_full_content_zoom(1)
self.parentWidget = parentWidget;
settings = self.get_settings()
try:
settings.set_property('enable-universal-access-from-file-uris', True)
settings.set_property('javascript-can-access-clipboard', True)
settings.set_property('enable-default-context-menu', True)
settings.set_property('enable-page-cache', True)
settings.set_property('tab-key-cycles-through-elements', True)
settings.set_property('enable-file-access-from-file-uris', True)
settings.set_property('enable-spell-checking', False)
settings.set_property('enable-caret-browsing', False)
settings.set_property('enable-developer-extras', config.ENABLE_INSPECTOR)
try:
# Since 1.7.5
settings.set_property('enable-accelerated-compositing', True)
except TypeError:
pass
except:
print 'Error: settings property was not set.'
WebKit.set_web_database_directory_path(config.get_path("db"))
WebKit.set_default_web_database_quota(1024**3L)
## bind events
self.connect('navigation-requested', self.on_navigation_requested);
self.connect('new-window-policy-decision-requested', self.on_new_window_requested);
self.connect('script-alert', self.on_script_alert);
self.connect('load-finished', self.on_load_finish);
self.connect("hovering-over-link", self.on_over_link);
# self.connect('drag_data_received', self.on_drag_data_received)
# self.connect('drag_motion', self.on_drag_motion)
# self.connect('drag_drop', self.on_drag_drop)
# # @TODO DND for gir
# TARGET_TYPE_URI_LIST = 80
# dnd_list = [ ( 'text/uri-list', 0, TARGET_TYPE_URI_LIST ) ]
# te = Gtk.TargetEntry.new(
# 'text/uri-list', 0, TARGET_TYPE_URI_LIST)
# self.drag_dest_set( Gtk.DestDefaults.ALL,
# [te], Gdk.DragAction.COPY)
if config.ENABLE_INSPECTOR:
from inspector import HermelinInspector
HermelinInspector(self.get_inspector())
templatefile = utils.get_ui_object(config.TEMPLATE)
template = open(templatefile, 'rb').read()
self.load_string(template, 'text/html', 'UTF-8', 'file://' + templatefile)
示例2: __init__
# 需要导入模块: from gi.repository import WebKit [as 别名]
# 或者: from gi.repository.WebKit import set_web_database_directory_path [as 别名]
def __init__(self, parentWidget):
WebKit.WebView.__init__(self)
self.load_finish_flag = False
self.set_property('can-focus', True)
self.set_property('can-default', True)
self.set_full_content_zoom(1)
self.parentWidget = parentWidget;
settings = self.get_settings()
try:
settings.set_property('enable-universal-access-from-file-uris', True)
settings.set_property('javascript-can-access-clipboard', True)
settings.set_property('enable-default-context-menu', True)
settings.set_property('enable-page-cache', True)
settings.set_property('tab-key-cycles-through-elements', True)
settings.set_property('enable-file-access-from-file-uris', True)
settings.set_property('enable-spell-checking', False)
settings.set_property('enable-caret-browsing', False)
settings.set_property('enable-developer-extras', config.ENABLE_INSPECTOR)
except:
print 'Error: settings property was not set.'
WebKit.set_web_database_directory_path(config.DB_DIR)
WebKit.set_default_web_database_quota(1024**3L)
## bind events
self.connect('navigation-requested', self.on_navigation_requested);
self.connect('new-window-policy-decision-requested', self.on_new_window_requested);
self.connect('script-alert', self.on_script_alert);
self.connect('load-finished', self.on_load_finish);
self.connect("hovering-over-link", self.on_over_link);
if config.ENABLE_INSPECTOR:
from inspector import HototInspector
HototInspector(self.get_inspector())
templatefile = utils.get_ui_object(config.TEMPLATE)
template = open(templatefile, 'rb').read()
self.load_string(template, 'text/html', 'UTF-8', 'file://' + templatefile)