mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix(website): fixed designer integration for website widget
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
from qtpy.QtCore import QUrl, qInstallMessageHandler
|
from qtpy.QtCore import Property, QUrl, Slot, qInstallMessageHandler
|
||||||
from qtpy.QtWebEngineWidgets import QWebEngineView
|
from qtpy.QtWebEngineWidgets import QWebEngineView
|
||||||
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
||||||
|
|
||||||
@ -32,6 +32,27 @@ class WebsiteWidget(BECWidget, QWidget):
|
|||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
self.set_url(url)
|
self.set_url(url)
|
||||||
|
|
||||||
|
@Property(str)
|
||||||
|
def url(self) -> str:
|
||||||
|
"""
|
||||||
|
The url of the website widget
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: The url
|
||||||
|
"""
|
||||||
|
return self.get_url()
|
||||||
|
|
||||||
|
@url.setter
|
||||||
|
def url(self, url: str) -> None:
|
||||||
|
"""
|
||||||
|
Set the url of the website widget
|
||||||
|
|
||||||
|
Args:
|
||||||
|
url (str): The url to set
|
||||||
|
"""
|
||||||
|
self.set_url(url)
|
||||||
|
|
||||||
|
@Slot(str)
|
||||||
def set_url(self, url: str) -> None:
|
def set_url(self, url: str) -> None:
|
||||||
"""
|
"""
|
||||||
Set the url of the website widget
|
Set the url of the website widget
|
||||||
@ -41,6 +62,8 @@ class WebsiteWidget(BECWidget, QWidget):
|
|||||||
"""
|
"""
|
||||||
if not url:
|
if not url:
|
||||||
return
|
return
|
||||||
|
if not isinstance(url, str):
|
||||||
|
return
|
||||||
self.website.setUrl(QUrl(url))
|
self.website.setUrl(QUrl(url))
|
||||||
|
|
||||||
def get_url(self) -> str:
|
def get_url(self) -> str:
|
||||||
@ -52,18 +75,21 @@ class WebsiteWidget(BECWidget, QWidget):
|
|||||||
"""
|
"""
|
||||||
return self.website.url().toString()
|
return self.website.url().toString()
|
||||||
|
|
||||||
|
@Slot()
|
||||||
def reload(self):
|
def reload(self):
|
||||||
"""
|
"""
|
||||||
Reload the website
|
Reload the website
|
||||||
"""
|
"""
|
||||||
QWebEngineView.reload(self.website)
|
QWebEngineView.reload(self.website)
|
||||||
|
|
||||||
|
@Slot()
|
||||||
def back(self):
|
def back(self):
|
||||||
"""
|
"""
|
||||||
Go back in the history
|
Go back in the history
|
||||||
"""
|
"""
|
||||||
QWebEngineView.back(self.website)
|
QWebEngineView.back(self.website)
|
||||||
|
|
||||||
|
@Slot()
|
||||||
def forward(self):
|
def forward(self):
|
||||||
"""
|
"""
|
||||||
Go forward in the history
|
Go forward in the history
|
||||||
|
Reference in New Issue
Block a user