当前位置: 首页>>代码示例>>Python>>正文


Python QWebSettings.globalSettings方法代码示例

本文整理汇总了Python中PyQt4.QtWebKit.QWebSettings.globalSettings方法的典型用法代码示例。如果您正苦于以下问题:Python QWebSettings.globalSettings方法的具体用法?Python QWebSettings.globalSettings怎么用?Python QWebSettings.globalSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtWebKit.QWebSettings的用法示例。


在下文中一共展示了QWebSettings.globalSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
    def __init__(self, URL, process=None, main=None):
        QWidget.__init__(self)
        BaseCentralWidget.__init__(self)
        self.path = URL
        self.process = process

        v_box = QVBoxLayout(self)
        #Web Frame
        QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True)
        self.webFrame = QWebView()
        self.webFrame.setAcceptDrops(False)
        factory = WebPluginFactory(self, main)
        self.webFrame.page().setPluginFactory(factory)
        self.webFrame.load(QUrl(URL))

        v_box.addWidget(self.webFrame)

        if process is not None:
            time.sleep(0.5)
            self.webFrame.reload()

        if self.path.endswith('startPage.html') and sys.platform.find('win') != -1:
            content = manage_files.read_file_content(self.path)
            pathCss = os.path.join(resources.PRJ_PATH, 'doc', 'styles', 'ninja.css')
            pathJs = os.path.join(resources.PRJ_PATH, 'doc', 'rsc')
            content = content.replace('styles/ninja.css', pathCss).replace('src="rsc', 'src="' + pathJs)
            self.webFrame.setHtml(content)
开发者ID:aztli,项目名称:Traducciones,代码行数:29,代码来源:browser.py

示例2: __init__

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
    def __init__(self):
        QWidget.__init__(self)

        vbox = QVBoxLayout(self)
        # Web Frame
        self.webFrame = QWebView()
        QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
        vbox.addWidget(self.webFrame)
开发者ID:netantho,项目名称:ninja-ide,代码行数:10,代码来源:web_render.py

示例3: __init__

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
 def __init__(self, view: Amendment('view/', lambda v: hasattr(v, 'mode') and (v.mode.name == 'web') and (v.widget is None))): #, orig_editor=None):
     self.view = view
     QWebView.__init__(self)
     view.widget = self
     self.load(QUrl(view.filebuf.file_name))
     self.page().setContentEditable(True)
     QNetworkProxyFactory.setUseSystemConfiguration(True);
     QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True);
     QWebSettings.globalSettings().setAttribute(QWebSettings.AutoLoadImages, True);
开发者ID:bogdanvuk,项目名称:pyde,代码行数:11,代码来源:web.py

示例4: main

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
def main():  
	app = QtGui.QApplication(sys.argv)  
	QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True);
	
	myObj = QtJsBridge()
	
	webView = QtWebKit.QWebView()  
	# Make myObj exposed as JavaScript object named 'pyObj'
	webView.page().mainFrame().addToJavaScriptWindowObject("pyObj", myObj)
	myObj.mainframe=webView.page().mainFrame()
	webView.setHtml(html)  
	
	window = QtGui.QMainWindow()  
	window.setCentralWidget(webView)  
	window.show()  
	
	cf = json.load(open('config.json'))
	client = xmpp.Client(cf['login2'])
	client.connect(server=(cf['server'],int(cf['port'])))
	client.auth(cf['username'], cf['passwd'], 'botty')
	
	
	client.RegisterHandler('message', myObj.gotmsg)
	#client.RegisterHandler('chat', self.gotmsg)
	client.sendInitPresence()
	
	#need to call this later on too.
	roster =  client.getRoster()
	myObj.rkeys = [str(r) for r in roster.keys()]
	
	#give js obj access to send. could wrap in another method if paranoid :P
	myObj.send = client.send
	myObj.mainframe.evaluateJavaScript("getRoster();")
	
	#this get messages section could be improved, or replaced!
	global cancheckmsgs
	cancheckmsgs = True
	def checkmsgs():
		global cancheckmsgs
		if not cancheckmsgs: return
		cancheckmsgs = False
		socketlist = {client.Connection._sock:'xmpp',sys.stdin:'stdio'}
		
		(i , o, e) = select.select(socketlist.keys(),[],[],.01)
		for each in i:
			print each
			if socketlist[each] == 'xmpp':
				client.Process(.01)
		cancheckmsgs = True
	
	timer = QTimer()
	timer.timeout.connect(checkmsgs)
	timer.start(100)
	
	sys.exit(app.exec_())  
开发者ID:chozabu,项目名称:PyIM,代码行数:57,代码来源:main.py

示例5: show_help

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
 def show_help(self):
     html = resource_string("emzed.core.explorers", "help_peakmapexplorer.html")
     QWebSettings.globalSettings().setFontFamily(QWebSettings.StandardFont, 'Courier')
     QWebSettings.globalSettings().setFontSize(QWebSettings.DefaultFontSize, 12)
     v = QWebView(self)
     v.setHtml(html)
     dlg = QDialog(self, Qt.Window)
     dlg.setMinimumSize(300, 300)
     l = QVBoxLayout(dlg)
     l.addWidget(v)
     dlg.setLayout(l)
     dlg.show()
开发者ID:gmat,项目名称:emzed2,代码行数:14,代码来源:peakmap_explorer.py

示例6: __init__

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
    def __init__(self, *args, **kwargs):
        logging.debug('Starting __init__')
        self.url = kwargs['url']
        self.ghost = ghost.Ghost(wait_timeout=60)
        logging.debug('Created Ghost object')

        QWebSettings.globalSettings().setAttribute(QWebSettings.AutoLoadImages, False)
        QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, False)
        self.page, self.resources = self.ghost.open(self.url)
        self.frame = self.ghost.main_frame
        self.body = self.ghost.main_frame.findFirstElement('body')
        logging.debug('Fetched the page')
开发者ID:closeio,项目名称:scrapecat,代码行数:14,代码来源:plugins.py

示例7: webSettings

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
 def webSettings(self):
     self.cookiesjar = PersistentCookieJar(self)
     self.zoom = self.readZoom()
     # Required by Youtube videos (HTML5 video support only on Qt5)
     QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, self.plugins)
     # We don't want Java
     QWebSettings.globalSettings().setAttribute(QWebSettings.JavaEnabled, False)
     # We don't need History
     QWebSettings.globalSettings().setAttribute(QWebSettings.PrivateBrowsingEnabled, True)
     # Required for copy and paste clipboard integration
     QWebSettings.globalSettings().setAttribute(QWebSettings.JavascriptCanAccessClipboard, True)
     # Enabling Inspeclet only when --debug=True (requires more CPU usage)
     QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, self.debug)
开发者ID:zerlgi,项目名称:zcswebapp,代码行数:15,代码来源:scudcloud.py

示例8: __init__

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
    def __init__(self, url, process=None, parent=None):
        QWidget.__init__(self, parent)
        itab_item.ITabItem.__init__(self)
        self._id = url
        self._process = process
        vbox = QVBoxLayout(self)
        #Web Frame
        QWebSettings.globalSettings().setAttribute(
            QWebSettings.PluginsEnabled, True)
        self.webFrame = QWebView(self)
        self.webFrame.setAcceptDrops(False)
        factory = WebPluginFactory(self)

        self.webFrame.page().setPluginFactory(factory)
        self.webFrame.load(QUrl(url))

        vbox.addWidget(self.webFrame)

        if process is not None:
            time.sleep(0.5)
            self.webFrame.load(QUrl(url))

        if url == resources.START_PAGE_URL:
            self.webFrame.page().setLinkDelegationPolicy(
                QWebPage.DelegateAllLinks)
            self.connect(self.webFrame, SIGNAL("linkClicked(QUrl)"),
                self.start_page_operations)
            if sys.platform == "win32":
                content = file_manager.read_file_content(self.ID)
                pathCss = os.path.join(
                    resources.PRJ_PATH, 'doc', 'css', 'style.css')
                pathJs = os.path.join(resources.PRJ_PATH, 'doc', 'js', 'libs')
                pathImg = os.path.join(resources.PRJ_PATH, 'doc', 'img')
                content = content.replace('css/style.css',
                    pathCss).replace(
                    'src="js/libs/', 'src="%s\\' % pathJs).replace(
                    'src="img/', 'src="%s\\' % pathImg)
                self.webFrame.setHtml(content)
            self._id = 'Start Page'
            policy = Qt.ScrollBarAlwaysOff
        else:
            policy = Qt.ScrollBarAsNeeded
        self.webFrame.page().currentFrame().setScrollBarPolicy(
            Qt.Vertical, policy)
        self.webFrame.page().currentFrame().setScrollBarPolicy(
            Qt.Horizontal, policy)
开发者ID:akatrevorjay,项目名称:ninja-ide,代码行数:48,代码来源:browser_widget.py

示例9: __init__

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
 def __init__(self, window):
     QWebView.__init__(self)
     self.window = window
     with open(get_resource_path("scudcloud.js"), "r") as f:
         self.js = f.read()
     # Required by Youtube videos (HTML5 video support only on Qt5)
     QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True)
     # We don't want Java
     QWebSettings.globalSettings().setAttribute(QWebSettings.JavaEnabled, False);
     # We don't need History
     QWebSettings.globalSettings().setAttribute(QWebSettings.PrivateBrowsingEnabled, True);
     # Required for copy and paste clipboard integration
     QWebSettings.globalSettings().setAttribute(QWebSettings.JavascriptCanAccessClipboard, True)
     # Enabling Inspeclet only when --debug=True (requires more CPU usage)
     QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, self.window.debug)
     self.setZoomFactor(self.window.zoom)
     self.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
     self.connect(self, SIGNAL("urlChanged(const QUrl&)"), self.urlChanged)
     self.connect(self, SIGNAL("linkClicked(const QUrl&)"), self.linkClicked)
     self.addActions()
开发者ID:alihalabyah,项目名称:scudcloud,代码行数:22,代码来源:wrapper.py

示例10: _set_global_render_settings

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
def _set_global_render_settings(js_disable_cross_domain_access, private_mode):
    from PyQt4.QtWebKit import QWebSecurityOrigin, QWebSettings
    if js_disable_cross_domain_access is False:
        # In order to enable cross domain requests it is necessary to add
        # the http and https to the local scheme, this way all the urls are
        # seen as inside the same security origin.
        for scheme in ['http', 'https']:
            QWebSecurityOrigin.addLocalScheme(scheme)

    settings = QWebSettings.globalSettings()
    settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, private_mode)
    settings.setAttribute(QWebSettings.LocalStorageEnabled, not private_mode)
开发者ID:hotbaby,项目名称:splash,代码行数:14,代码来源:server.py

示例11: prepare

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
 def prepare(self, metaData):
     """
     Public method to prepare the disk cache file.
     
     @param metaData meta data for a URL (QNetworkCacheMetaData)
     @return reference to the IO device (QIODevice)
     """
     if QWebSettings.globalSettings().testAttribute(
             QWebSettings.PrivateBrowsingEnabled):
         return None
     
     return QNetworkDiskCache.prepare(self, metaData)
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:14,代码来源:NetworkDiskCache.py

示例12: _addHistoryEntry

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
 def _addHistoryEntry(self, itm):
     """
     Protected method to add a history item.
     
     @param itm reference to the history item to add (HistoryEntry)
     """
     globalSettings = QWebSettings.globalSettings()
     if globalSettings.testAttribute(QWebSettings.PrivateBrowsingEnabled):
         return
     
     self.__history.insert(0, itm)
     self.emit(SIGNAL("entryAdded"), itm)
     if len(self.__history) == 1:
         self.__checkForExpired()
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:16,代码来源:HistoryManager.py

示例13: cookiesForUrl

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
 def cookiesForUrl(self, url):
     """
     Public method to get the cookies for a URL.
     
     @param url URL to get cookies for (QUrl)
     @return list of cookies (list of QNetworkCookie)
     """
     if not self.__loaded:
         self.load()
     
     globalSettings = QWebSettings.globalSettings()
     if globalSettings.testAttribute(QWebSettings.PrivateBrowsingEnabled):
         return []
     
     return QNetworkCookieJar.cookiesForUrl(self, url)
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:17,代码来源:CookieJar.py

示例14: __init__

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
 def __init__(self, window):
     QWebView.__init__(self)
     self.window = window
     with open(get_resource_path("scudcloud.js"), "r") as f:
         self.js = f.read()
     QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True)
     QWebSettings.globalSettings().setAttribute(QWebSettings.JavascriptCanAccessClipboard, True)
     QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, self.window.debug)
     self.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
     self.connect(self, SIGNAL("urlChanged(const QUrl&)"), self.urlChanged)
     self.connect(self, SIGNAL("linkClicked(const QUrl&)"), self.linkClicked)
     self.addActions()
开发者ID:chreble,项目名称:scudcloud,代码行数:14,代码来源:wrapper.py

示例15: __searchNow

# 需要导入模块: from PyQt4.QtWebKit import QWebSettings [as 别名]
# 或者: from PyQt4.QtWebKit.QWebSettings import globalSettings [as 别名]
 def __searchNow(self):
     """
     Private slot to perform the web search.
     """
     searchText = self.__searchEdit.text()
     if searchText.isEmpty():
         return
     
     globalSettings = QWebSettings.globalSettings()
     if not globalSettings.testAttribute(QWebSettings.PrivateBrowsingEnabled):
         self.__recentSearches.removeAll(searchText)
         self.__recentSearches.prepend(searchText)
         if len(self.__recentSearches) > self.__maxSavedSearches:
             self.__recentSearches = self.__recentSearches[:self.__maxSavedSearches]
         self.__setupCompleterMenu()
     
     url = self.__openSearchManager.currentEngine().searchUrl(searchText)
     self.emit(SIGNAL("search"), url)
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:20,代码来源:HelpWebSearchWidget.py


注:本文中的PyQt4.QtWebKit.QWebSettings.globalSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。