MCPcopy Create free account
hub / github.com/cztomczak/cefpython / NavigationBar

Class NavigationBar

examples/qt.py:360–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358
359
360class NavigationBar(QFrame):
361 def __init__(self, cef_widget):
362 # noinspection PyArgumentList
363 super(NavigationBar, self).__init__()
364 self.cef_widget = cef_widget
365
366 # Init layout
367 layout = QGridLayout()
368 layout.setContentsMargins(0, 0, 0, 0)
369 layout.setSpacing(0)
370
371 # Back button
372 self.back = self.createButton("back")
373 # noinspection PyUnresolvedReferences
374 self.back.clicked.connect(self.onBack)
375 # noinspection PyArgumentList
376 layout.addWidget(self.back, 0, 0)
377
378 # Forward button
379 self.forward = self.createButton("forward")
380 # noinspection PyUnresolvedReferences
381 self.forward.clicked.connect(self.onForward)
382 # noinspection PyArgumentList
383 layout.addWidget(self.forward, 0, 1)
384
385 # Reload button
386 self.reload = self.createButton("reload")
387 # noinspection PyUnresolvedReferences
388 self.reload.clicked.connect(self.onReload)
389 # noinspection PyArgumentList
390 layout.addWidget(self.reload, 0, 2)
391
392 # Url input
393 self.url = QLineEdit("")
394 # noinspection PyUnresolvedReferences
395 self.url.returnPressed.connect(self.onGoUrl)
396 # noinspection PyArgumentList
397 layout.addWidget(self.url, 0, 3)
398
399 # Layout
400 self.setLayout(layout)
401 self.updateState()
402
403 def onBack(self):
404 if self.cef_widget.browser:
405 self.cef_widget.browser.GoBack()
406
407 def onForward(self):
408 if self.cef_widget.browser:
409 self.cef_widget.browser.GoForward()
410
411 def onReload(self):
412 if self.cef_widget.browser:
413 self.cef_widget.browser.Reload()
414
415 def onGoUrl(self):
416 if self.cef_widget.browser:
417 self.cef_widget.browser.LoadUrl(self.url.text())

Callers 1

setupLayoutMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected