<s> from qframer . qt import QtGui <EOL> from qframer . qt import QtCore <EOL> from qframer . qt import QtWebKit <EOL> from qframer . qt import QtNetwork <EOL> class WebkitBasePage ( QtGui . QWidget ) : <EOL> def __init__ ( self , parent = None ) : <EOL> super ( WebkitBasePage , self ) . __init__ ( parent ) <EOL> self . parent = parent <EOL> QtNetwork . QNetworkProxyFactory . setUseSystemConfiguration ( True ) <EOL> QtWebKit . QWebSettings . globalSettings ( ) . setAttribute ( QtWebKit . QWebSettings . PluginsEnabled , True ) <EOL> self . view = QtWebKit . QWebView ( self ) <EOL> self . view . setFocus ( ) <EOL> self . setupInspector ( ) <EOL> self . splitter = QtGui . QSplitter ( self ) <EOL> self . splitter . setOrientation ( QtCore . Qt . Vertical ) <EOL> self . splitter . addWidget ( self . view ) <EOL> self . splitter . addWidget ( self . webInspector ) <EOL> mainlayout = QtGui . QVBoxLayout ( self ) <EOL> mainlayout . addWidget ( self . splitter ) <EOL> self . setLayout ( mainlayout ) <EOL> self . layout ( ) . setContentsMargins ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> def setupInspector ( self ) : <EOL> page = self . view . page ( ) <EOL> page . settings ( ) . setAttribute ( QtWebKit . QWebSettings . DeveloperExtrasEnabled , True ) <EOL> self . webInspector = QtWebKit . QWebInspector ( self ) <EOL> self . webInspector . setPage ( page ) <EOL> shortcut = QtGui . QShortcut ( self ) <EOL> shortcut . setKey ( QtCore . Qt . Key_F11 ) <EOL> shortcut . activated . connect ( self . toggleInspector ) <EOL> self . webInspector . setVisible ( False ) <EOL> def toggleInspector ( self ) : <EOL> self . webInspector . setVisible ( not self . webInspector . isVisible ( ) ) </s>
