本文整理汇总了Python中PyQt5.QtWebKit.QWebSettings.setObjectCacheCapacities方法的典型用法代码示例。如果您正苦于以下问题:Python QWebSettings.setObjectCacheCapacities方法的具体用法?Python QWebSettings.setObjectCacheCapacities怎么用?Python QWebSettings.setObjectCacheCapacities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWebKit.QWebSettings
的用法示例。
在下文中一共展示了QWebSettings.setObjectCacheCapacities方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from PyQt5.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt5.QtWebKit.QWebSettings import setObjectCacheCapacities [as 别名]
def initUI(self):
self.setMinimumSize(300, 300)
# self.TextEdit = QtWidgets.QTextEdit(self)
# self.TextEdit.setMinimumSize(300, 300)
# self.TextEdit.setReadOnly(True)
# self.load(QtCore.QUrl('file:///'+os.getcwd()+"/generated_html/index.html"))
QWebSettings.setMaximumPagesInCache(0)
QWebSettings.setObjectCacheCapacities(0, 0, 0)
示例2: __init__
# 需要导入模块: from PyQt5.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt5.QtWebKit.QWebSettings import setObjectCacheCapacities [as 别名]
def __init__(self, fullscreen=False, sizes=None):
"""
This constructor function initializes a layout of the Arius output
module but doesn`t displays it on the screen.
Firstly, it creates a new app and detects screens configuration.
Then, QGridLayout is created and its appearance is configured: margins
and spaces between elements is set to 0.
After that, we create three QWebViews: one for our main content view
and two others for header and footer views.
Immideately after creating these instances we assign them their heights
according to percentages given by user and dimensions of the screen.
Next, we remove scroll bars from top and bottom views and load predefined
pages into them.
Then we allow QWebKit to run all extensions it needs to render the page.
After that, wee set the layout design as a grid of three rows.
Finally, we create an updater object which will run in another stream and
a timer instance which checks that stream for new commands
from the server, and in case if there`s some update handles it.
"""
if not fullscreen and not sizes:
print 'You must initialize windows size'
raise Exception
self._fullscreen = fullscreen
if sizes:
self._screen_width = sizes[0]
self._screen_height = sizes[1]
self._app = QtWidgets.QApplication(sys.argv)
self._app.setStyle("Fusion")
if self._fullscreen:
self._get_screen_height()
self._layout = QGridLayout() # create a main view of an app
self._layout.setSpacing(0) # and do some design settings
self._layout.setContentsMargins(0, 0, 0, 0)
self._main_browser = QWebView() # create a main content view
# and initialize zoom factor variable which will be used to control
# zoom
main_page = FakeBrowser(self)
self._main_browser.setPage(main_page)
self._zoom_factor = 1
self._top_browser = QWebView() # and create top and bottom views
self._bottom_browser = QWebView()
self._top_browser_height = config[
'output_header_height'] * self._screen_height # calculate views sizes
self._bottom_browser_height = config[
'output_footer_height'] * self._screen_height
self._top_browser.setMaximumHeight(
self._top_browser_height) # and assign them to the views
self._top_browser.setMinimumHeight(self._top_browser_height)
self._bottom_browser.setMaximumHeight(self._bottom_browser_height)
self._bottom_browser.setMinimumHeight(self._bottom_browser_height)
self._top_browser.page().mainFrame().setScrollBarPolicy(
QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff) # remove the scroll bars
self._main_browser.page().mainFrame().setScrollBarPolicy(QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
self._main_browser.page().mainFrame().setScrollBarPolicy(QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff)
self._bottom_browser.page().mainFrame().setScrollBarPolicy(
QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
self._top_browser_load_url(
config['flask_server_home'] + config['output_browser_top_page']) # load default design
self._bottom_browser_load_url(
config['flask_server_home'] + config['output_browser_bottom_page'])
self._main_browser.settings().setAttribute(
QWebSettings.DeveloperExtrasEnabled, True) # enable console
self._main_browser.settings().setAttribute(
QWebSettings.PluginsEnabled, True) # enable plugins
QWebSettings.setObjectCacheCapacities(0, 0, 0) # disable caching
self._main_browser.settings().setAttribute(
QWebSettings.AcceleratedCompositingEnabled, True)
self._main_browser.settings().setAttribute(
QWebSettings.WebGLEnabled, True)
self._layout.addWidget(self._top_browser, 1, 0) # set views positions
self._layout.addWidget(self._main_browser, 2, 0)
self._layout.addWidget(self._bottom_browser, 3, 0)
# create a RLock object to syncronyze threads.
self._lock = threading.RLock()
# and create an updater object
self._updater = OutputUpdater(self._lock)
self._updater.start() # which is ran in another non-blocking stream
self.timeoutTimer = QTimer() # create a timer to check for commands
tCallback = functools.partial(
self._handle_command) # set a timer`s function
#.........这里部分代码省略.........
示例3:
# 需要导入模块: from PyQt5.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt5.QtWebKit.QWebSettings import setObjectCacheCapacities [as 别名]
# (MapType.attribute, QWebSettings.TiledBackingStoreEnabled),
},
'storage': {
'offline-storage-database':
(MapType.attribute, QWebSettings.OfflineStorageDatabaseEnabled),
'offline-web-application-storage':
(MapType.attribute,
QWebSettings.OfflineWebApplicationCacheEnabled),
'local-storage':
(MapType.attribute, QWebSettings.LocalStorageEnabled),
'maximum-pages-in-cache':
(MapType.static_setter, lambda v:
QWebSettings.setMaximumPagesInCache(v)),
'object-cache-capacities':
(MapType.static_setter, lambda v:
QWebSettings.setObjectCacheCapacities(*v)),
'offline-storage-default-quota':
(MapType.static_setter, lambda v:
QWebSettings.setOfflineStorageDefaultQuota(v)),
'offline-web-application-cache-quota':
(MapType.static_setter, lambda v:
QWebSettings.setOfflineWebApplicationCacheQuota(v)),
},
'general': {
'private-browsing':
(MapType.attribute, QWebSettings.PrivateBrowsingEnabled),
'developer-extras':
(MapType.attribute, QWebSettings.DeveloperExtrasEnabled),
'print-element-backgrounds':
(MapType.attribute, QWebSettings.PrintElementBackgrounds),
'xss-auditing':
示例4: __init__
# 需要导入模块: from PyQt5.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt5.QtWebKit.QWebSettings import setObjectCacheCapacities [as 别名]
def __init__(self, parent, fullscreen, sizes):
"""
This constructor function initializes a layout of the Arius output
module but doesn`t displays it on the screen.
Firstly, it creates a new app and detects screens configuration.
Then, QGridLayout is created and its appearance is configured: margins
and spaces between elements is set to 0.
After that, we create three QWebViews: one for our main content view
and two others for header and footer views.
Immideately after creating these instances we assign them their heights
according to percentages given by user and dimensions of the screen.
Next, we remove scroll bars from top and bottom views and load predefined
pages into them.
Then we allow QWebKit to run all extensions it needs to render the page.
After that, wee set the layout design as a grid of three rows.
Finally, we create an updater object which will run in another stream and
a timer instance which checks that stream for new commands
from the server, and in case if there`s some update handles it.
"""
super(BrowserController, self).__init__()
if not fullscreen and not sizes:
print 'You must initialize windows size'
raise Exception
self._fullscreen = fullscreen
if sizes:
self._screen_width = sizes[0]
self._screen_height = sizes[1]
self._app = QtWidgets.QApplication(sys.argv)
self._app.setStyle("Fusion")
if self._fullscreen:
self._get_screen_height()
self._layout = QGridLayout()
self._layout.setSpacing(0)
self._layout.setContentsMargins(0, 0, 0, 0)
self._main_browser = QWebView()
main_page = FakePage(self)
self._main_browser.setPage(main_page)
self._top_browser = QWebView()
self._bottom_browser = QWebView()
self._top_browser_height = config['output_header_height'] * self._screen_height
self._bottom_browser_height = config['output_footer_height'] * self._screen_height
self._top_browser.setMaximumHeight(self._top_browser_height)
self._top_browser.setMinimumHeight(self._top_browser_height)
self._bottom_browser.setMaximumHeight(self._bottom_browser_height)
self._bottom_browser.setMinimumHeight(self._bottom_browser_height)
self._top_browser.page().mainFrame().setScrollBarPolicy(
QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
self._main_browser.page().mainFrame().setScrollBarPolicy(
QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
self._main_browser.page().mainFrame().setScrollBarPolicy(
QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff)
self._bottom_browser.page().mainFrame().setScrollBarPolicy(
QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
self._top_browser_load_url(
config['flask_server_home'] + config['output_browser_top_page'])
self._bottom_browser_load_url(
config['flask_server_home'] + config['output_browser_bottom_page'])
self._main_browser.settings().setAttribute(
QWebSettings.DeveloperExtrasEnabled, True)
self._main_browser.settings().setAttribute(QWebSettings.PluginsEnabled, True)
QWebSettings.setObjectCacheCapacities(0, 0, 0)
self._main_browser.settings().setAttribute(
QWebSettings.AcceleratedCompositingEnabled, True)
self._main_browser.settings().setAttribute(QWebSettings.WebGLEnabled, True)
self._layout.addWidget(self._top_browser, 1, 0)
self._layout.addWidget(self._main_browser, 2, 0)
self._layout.addWidget(self._bottom_browser, 3, 0)
self._parent = parent
self._parent.load_url.connect(self._load_url)
self._parent.js_execution.connect(self._execute_js)
self._parent.zooming.connect(self._zoom)