def __init__(self, parent=None, userData=None,inspector = True): QWebView.__init__(self, parent) settings = QWebSettings.globalSettings() settings.setFontFamily(QWebSettings.StandardFont, 'Helvetica') settings.setFontSize(QWebSettings.DefaultFontSize, 12) self.webpage = page = PtWebPage(self) self.setPage(page) self.connect(self, SIGNAL('loadFinished(bool)'), self.onLoadFinished) self.settings().setAttribute( QWebSettings.WebAttribute.DeveloperExtrasEnabled, True) #path = os.getcwd() #self.settings().setUserStyleSheetUrl(QUrl.fromLocalFile(path + "/myCustom.css")) font = QFont("Helvetica") font.setPixelSize(12) self.setFont(font) # or globally: # QWebSettings.globalSettings().setAttribute( # QWebSettings.WebAttribute.DeveloperExtrasEnabled, True) if inspector: self.inspector = QWebInspector() self.inspector.setPage(self.page()) self.inspector.hide() self.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks) self.page().linkClicked.connect(self._on_page_link_clicked)
def __init__(self, fn): QWebView.__init__(self) if fn: self.load_file(fn) self.setTextSizeMultiplier(Previwer.DEFAULE_TEXT_MULTIPLIER) self.__set_shortcut()
def __init__(self, display=True): """ Initialize the display with the app. """ self.app = QApplication([]) QWebView.__init__(self) if display: self.show() # show the browser
def __init__(self, app): QWebView.__init__(self) # By storing a reference to the application which started this # instance, we will be able to close the application once we get what # we want self.parent_app = app # connect the loadFinished signal to a method defined by us. # loadFinished is the signal which is triggered when a page is loaded self.loadFinished.connect(self._load_finished)
def __init__(self, path, parent=None, encoding='utf8'): QWebView.__init__(self, parent) self.path = path self.encoding = encoding self.__watcher = QFileSystemWatcher(self) self.__watcher.fileChanged.connect(self.loadFile) self.__watcher.directoryChanged.connect(self.loadFile) self.__watcher.addPath(self.path) self.__watcher.addPath(QFileInfo(self.path).path()) self.setWindowTitle(self.path) self.loadFile()
def __init__(self, authorize_url): """ Custom Webview widget to handle authentication of an authorisation url. authorize_url is string returned via flow_from_clientsecrets.step1_get_authorize_url object If Authorization is successful, returns an access code required for step2 of oauth flow object """ QWebView.__init__(self) self.URL = QUrl.fromPercentEncoding(str(authorize_url)) self.setUrl(self.URL) self.titleChanged.connect(self.handleTitleChange) self.load(self.URL) self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Popup)
def __init__(self, display=True): self.app = QApplication([]) QWebView.__init__(self) if display: self.show() # show the browser
def __init__(self,show=True): self.app = QApplication(sys.argv) QWebView.__init__(self) if show: self.show()#显示浏览器
def __init__ ( self, parent, editor ): """ Initializes the object. """ QWebView.__init__( self, parent ) self._editor = editor
def __init__(self,*args): QWebView.__init__(self)