36 from python_qt_binding
import loadUi
37 from python_qt_binding.QtCore
import Qt, QUrl
38 from python_qt_binding.QtGui
import QIcon
41 from python_qt_binding.QtWebEngine
import QWebEnginePage
as QWebPage
42 from python_qt_binding.QtWebEngine
import QWebEngineView
as QWebView
46 from python_qt_binding.QtWebKitWidgets
import QWebPage, QWebView
49 from python_qt_binding.QtWebKit
import QWebPage, QWebView
50 from python_qt_binding.QtWidgets
import QCompleter, QWidget
54 """Check if the argument is a string which works for both Python 2 and 3."""
56 return isinstance(s, basestring)
58 return isinstance(s, str)
65 Class to load a webpage in a widget.
67 :param url: If url is empty then a navigation bar is shown otherwise the url is loaded and the navigation bar is hidden, ''str''
71 ui_file = os.path.join(rp.get_path(
'rqt_web'),
'resource',
'web_widget.ui')
73 self.setObjectName(
'WebWidget')
82 self.verticalLayout.addWidget(self.
_view)
84 self.
set_url(
"http://ros.org",
True)
96 Sets the url and begins loading that page
97 :param url: url to load in the webview, ''str or QUrl''
98 :param showinput: if true the input bar will be shown, else hidden, ''bool''
107 Sets the value of the show_url_input flag and hides/shows the widgets as required
108 :param showinput: true - show inputbar false - hide , ''bool''
114 self.
_view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
116 self.
_view.page().setLinkDelegationPolicy(QWebPage.DontDelegateLinks)
120 settings.set_value(
'url_current', self.
_url.toString())
125 url = settings.value(
'url_current')
130 self.
set_url(self.url_lineedit.text(),
True)
147 self.url_lineedit.setText(url.toString())
159 self.
_view.page().currentFrame().setHtml(
160 '<html><h2>The url you entered seems to be faulty.</h2></html>')
167 self.
_completer.setCaseSensitivity(Qt.CaseInsensitive)
168 self.
_completer.setCompletionMode(QCompleter.PopupCompletion)
169 self.url_lineedit.setCompleter(self.
_completer)
174 Packs 'data' into a form that can be easily and readably written to an ini file
175 :param data: A list of strings to be flattened into a string ''list''
176 :return: A string suitable for output to ini files ''str''
187 Unpacks the values read from an ini file
188 :param data: An entry taken from an ini file ''list or string''
189 :return: A list of strings ''list''
191 if data
is None or data ==
'':