本文整理汇总了Python中PySide.QtWebKit.QWebView.reload方法的典型用法代码示例。如果您正苦于以下问题:Python QWebView.reload方法的具体用法?Python QWebView.reload怎么用?Python QWebView.reload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtWebKit.QWebView
的用法示例。
在下文中一共展示了QWebView.reload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Browser
# 需要导入模块: from PySide.QtWebKit import QWebView [as 别名]
# 或者: from PySide.QtWebKit.QWebView import reload [as 别名]
class Browser(QWidget):
def __init__(self):
super(Browser, self).__init__()
self.layout = QStackedLayout(self)
self.frontView = QWebView(self)
self.backView = QWebView(self)
self.frontView.page().networkAccessManager().sslErrors.connect(self.onSslErrors)
self.backView.page().networkAccessManager().sslErrors.connect(self.onSslErrors)
self.hostname = os.uname()[1]
self.layout.setStackingMode(QStackedLayout.StackAll)
self.layout.addWidget(self.frontView)
self.layout.addWidget(self.backView)
self.commands = {
'help' : self.cmdHelp,
'refresh' : self.cmdRefresh,
'add' : self.cmdAdd,
'del' : self.cmdDel,
'list' : self.cmdList,
'zoom' : self.cmdZoom,
'fs' : self.cmdFs,
'exit' : self.cmdExit,
'next' : self.cmdNext,
'restart' : self.cmdRestart,
'upgrade' : self.cmdUpgrade,
}
self.timer = QTimer()
self.timer.setSingleShot(False)
self.sites = list()
self.siteId = -1
self.socket = False
url = QUrl("http://dmr.tokiogroup.com/rrs.php")
self.sites.append(Site(url, 10, 1))
url = QUrl("http://dmr.tokiogroup.com/lastheard.php")
self.sites.append(Site(url, 10, 1))
self.server = QTcpServer()
self.server.listen(QHostAddress.Any, 4242)
self.connect(self.server, SIGNAL("newConnection()"), self, SLOT("onConnection()"));
self.connect(self.timer, SIGNAL("timeout()"), self, SLOT("goNext()"));
self.goNext()
self.goNext()
def goNext(self):
self.cmdNext(list())
def onConnection(self):
self.socket = self.server.nextPendingConnection()
self.socket.write(self.hostname + ' % ')
self.connect(self.socket, SIGNAL("readyRead()"), self, SLOT("onDataReceived()"));
def print_(self, text):
if (self.socket != False):
self.socket.write(text + '\n')
print(text)
def onDataReceived(self):
data = self.socket.readAll().data().strip()
try:
args = data.split(' ')
map(lambda x : x.strip(), args)
self.commands.get(args[0])(args)
except Exception:
self.print_('>> syntax error')
self.printCommandsList()
if self.socket.isOpen():
self.socket.write(self.hostname + ' % ')
def printCommandsList(self):
self.print_('avaible commands:')
for command in self.commands:
self.print_(' ' + command)
def onSslErrors(self, reply, errors):
url = unicode(reply.url().toString())
reply.ignoreSslErrors()
# commands
def cmdHelp(self, args):
self.print_('>> help')
self.printCommandsList()
def cmdRefresh(self, args):
self.print_('>> refresh ' + self.url.toString().encode())
self.frontView.reload()
def cmdAdd(self, args):
#.........这里部分代码省略.........