Example #1
0
    def fillLibVersions(self):
        if __githash__:
            self.label_githash.setText(__githash__)

        self.label_version.setText(__version__)

        self.label_xwareVer.setText(XWARE_VERSION)

        from PyQt5.Qt import QT_VERSION, QT_VERSION_STR, PYQT_VERSION, PYQT_VERSION_STR
        self.label_qtVer.setText("{} ({})".format(QT_VERSION_STR, QT_VERSION))
        self.label_pyqtVer.setText("{} ({})".format(PYQT_VERSION_STR, PYQT_VERSION))

        import sys
        self.label_pythonVer.setText(".".join(map(str, sys.version_info)))

        try:
            import pyinotify
        except ImportError:
            pyinotify = None

        self.label_pyinotifyVer.setText(pyinotify.__version__ if pyinotify else "N/A")

        from PyQt5 import QtWebKit
        self.label_qtwebkitVer.setText(QtWebKit.qWebKitVersion())

        import aiohttp
        self.label_aiohttpVer.setText(aiohttp.__version__)
Example #2
0
    def setupUi(self):
        #self.setFixedSize(800, 500)

        vbox = QtGui.QVBoxLayout()
        self.setLayout(vbox)

        label = self.label = QtGui.QLabel()
        sp = QtGui.QSizePolicy()
        sp.setVerticalStretch(0)
        label.setSizePolicy(sp)
        vbox.addWidget(label)

        view = self.view = QtWebKit.QWebView()

        cache = QtNetwork.QNetworkDiskCache()
        cache.setCacheDirectory("cache")
        view.page().networkAccessManager().setCache(cache)
        view.page().networkAccessManager()

        view.page().mainFrame().addToJavaScriptWindowObject("MainWindow", self)
        view.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
        view.load(QtCore.QUrl('map.html'))
        view.loadFinished.connect(self.onLoadFinished)
        view.linkClicked.connect(QtGui.QDesktopServices.openUrl)

        vbox.addWidget(view)

        button = QtGui.QPushButton('Go to Paris')
        panToParis = functools.partial(self.panMap, 2.3272, 48.8620)
        button.clicked.connect(panToParis)
        vbox.addWidget(button)
Example #3
0
 def test_webkit_version(self):
     """
     Test the webkit_version() function
     """
     # GIVEN: Webkit
     webkit_ver = float(QtWebKit.qWebKitVersion())
     # WHEN: Retrieving the webkit version
     # THEN: Webkit versions should match
     self.assertEquals(webkit_version(), webkit_ver, "The returned webkit version doesn't match the installed one")
Example #4
0
def webkit_version():
    """
    Return the Webkit version in use. Note method added relatively recently, so return 0 if prior to this
    """
    try:
        webkit_ver = float(QtWebKit.qWebKitVersion())
        log.debug('Webkit version = {version}'.format(version=webkit_ver))
    except AttributeError:
        webkit_ver = 0.0
    return webkit_ver
Example #5
0
def webkit_version():
    """
    Return the Webkit version in use. Note method added relatively recently, so return 0 if prior to this
    """
    try:
        webkit_ver = float(QtWebKit.qWebKitVersion())
        log.debug('Webkit version = {version}'.format(version=webkit_ver))
    except AttributeError:
        webkit_ver = 0.0
    return webkit_ver
Example #6
0
    def initUI(self):
        self.browser = QtWebKit.QWebView()
        file_path = os.path.abspath(
            os.path.join(os.path.dirname(__file__), "help.html"))
        local_url = QtCore.QUrl.fromLocalFile(file_path)
        self.browser.load(local_url)

        self.mainLayout = QtGui.QHBoxLayout()
        self.mainLayout.addWidget(self.browser)
        self.setLayout(self.mainLayout)
Example #7
0
 def test_webkit_version(self):
     """
     Test the webkit_version() function
     """
     # GIVEN: Webkit
     webkit_ver = float(QtWebKit.qWebKitVersion())
     # WHEN: Retrieving the webkit version
     # THEN: Webkit versions should match
     assert webkit_version(
     ) == webkit_ver, "The returned webkit version doesn't match the installed one"
Example #8
0
    def fillLibVersions(self):
        self.label_xwareVer.setText(XWARE_VERSION)

        from PyQt5.Qt import QT_VERSION, QT_VERSION_STR, PYQT_VERSION, PYQT_VERSION_STR
        self.label_qtVer.setText("{} ({})".format(QT_VERSION_STR, QT_VERSION))
        self.label_pyqtVer.setText("{} ({})".format(PYQT_VERSION_STR, PYQT_VERSION))

        import sys
        self.label_pythonVer.setText(".".join(map(str, sys.version_info)))

        import requests
        self.label_requestsVer.setText(requests.__version__)

        import pyinotify
        self.label_pyinotifyVer.setText(pyinotify.__version__)

        from PyQt5 import QtWebKit
        self.label_qtwebkitVer.setText(QtWebKit.qWebKitVersion())
Example #9
0
    def __init__(self, tabWidget, helper, *args):
        super(GpsTab, self).__init__(*args)
        self.setupUi(self)

        self.tabName = "GPS"
        self.menuName = "GPS"

        self.tabWidget = tabWidget
        self.helper = helper
        self._cf = helper.cf

        view = self.view = QtWebKit.QWebView()

        cache = QtNetwork.QNetworkDiskCache()
        cache.setCacheDirectory(edclient.config_path + "/cache")
        view.page().networkAccessManager().setCache(cache)
        view.page().networkAccessManager()

        view.page().mainFrame().addToJavaScriptWindowObject("MainWindow", self)
        view.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
        view.load(QtCore.QUrl(edclient.module_path + "/resources/map.html"))
        view.loadFinished.connect(self.onLoadFinished)
        view.linkClicked.connect(QtGui.QDesktopServices.openUrl)

        self.map_layout.addWidget(view)

        self._reset_max_btn.clicked.connect(self._reset_max)

        # Connect the signals
        self._log_data_signal.connect(self._log_data_received)
        self._log_error_signal.connect(self._logging_error)
        self._connected_signal.connect(self._connected)
        self._disconnected_signal.connect(self._disconnected)

        # Connect the callbacks from the Espdrone API
        self.helper.cf.disconnected.add_callback(
            self._disconnected_signal.emit)
        self.helper.cf.connected.add_callback(
            self._connected_signal.emit)

        self._max_speed = 0.0
        self._lat = 0
        self._long = 0
Example #10
0
def openUrl(url):
    from PyQt5 import QtWebKit
    global maxWebWindows, webWindows
    reuseLast = False
    # use the last window if the class is the same and only the attribute differs
    try:
        reuseLast = (len(webWindows) > 0
                     and str(webWindows[-1].url()).split('#')[-1].split('.')[2]
                     == url.split('#')[-1].split('.')[2])
        #print str(webWindows[-1].url()).split('#')[-1].split('.')[2],url.split('#')[-1].split('.')[2]
    except:
        pass
    if not reuseLast:
        if len(webWindows) < maxWebWindows:
            webWindows.append(QtWebKit.QWebView())
        else:
            webWindows = webWindows[1:] + [webWindows[0]]
    web = webWindows[-1]
    web.load(QUrl(url))
    web.setWindowTitle(url)
    web.show()
    web.raise_()
Example #11
0
    def fillLibVersions(self):
        if __githash__:
            self.label_githash.setText(__githash__)

        self.label_version.setText(__version__)

        self.label_xwareVer.setText(XWARE_VERSION)

        from PyQt5.Qt import QT_VERSION, QT_VERSION_STR, PYQT_VERSION, PYQT_VERSION_STR
        self.label_qtVer.setText("{} ({})".format(QT_VERSION_STR, QT_VERSION))
        self.label_pyqtVer.setText("{} ({})".format(PYQT_VERSION_STR,
                                                    PYQT_VERSION))

        import sys
        self.label_pythonVer.setText(".".join(map(str, sys.version_info)))

        import requests
        self.label_requestsVer.setText(requests.__version__)

        import pyinotify
        self.label_pyinotifyVer.setText(pyinotify.__version__)

        from PyQt5 import QtWebKit
        self.label_qtwebkitVer.setText(QtWebKit.qWebKitVersion())
Example #12
0
def QWebView(*args, **kwargs):
    import PyQt5.QtWebKit as QtWebKit
    return QtWebKit.QWebView(*args, **kwargs)
Example #13
0
    webview.loadFinished.connect(loop.quit)
    req = QtNetwork.QNetworkRequest(QtCore.QUrl(url))
    webview.load(req)
    loop.exec_()


app = QtWidgets.QApplication([])
webview = QtWebKitWidgets.QWebView()
webview.show()
download(webview, 'https://passport.baidu.com/v2/?login')
frame = webview.page().mainFrame()
# frame.findFirstElement('#TANGRAM__PSP_3__userName').setAttribute('value','')
# frame.findFirstElement('#TANGRAM__PSP_3__password').setAttribute('value','')
# frame.findFirstElement('#TANGRAM__PSP_3__submit').evaluateJavaScript("this.click()")
#等待结果
elements = QtWebKit.QWebElement()
while elements.isNull():
    #每次循环,都会调用app.processEvents(),用于给Qt事件循环执行任务的时间,比如响应点击事件和更新GUI
    app.processEvents()
    elements = frame.findFirstElement('#displayUsername')

s_cookies = {}
for citem in webview.page().networkAccessManager().cookieJar().cookiesForUrl(
        QtCore.QUrl('http://www.baidu.com')):
    s_cookies[bytes(citem.name()).decode()] = bytes(citem.value()).decode()
# cookiejar = webview.page().networkAccessManager().cookieJar()
# for ck in cookiejar.allCookies():
#     s_cookies[bytes(ck.name()).decode()] = bytes(ck.value()).decode()
webview.close()
download(webview, 'http://tieba.baidu.com/')
for citem in webview.page().networkAccessManager().cookieJar().cookiesForUrl(
Example #14
0
    ENCHANT_VERSION = '-'
try:
    import mako
    MAKO_VERSION = mako.__version__
except ImportError:
    MAKO_VERSION = '-'
try:
    import icu
    try:
        ICU_VERSION = icu.VERSION
    except AttributeError:
        ICU_VERSION = 'OK'
except ImportError:
    ICU_VERSION = '-'
try:
    WEBKIT_VERSION = QtWebKit.qWebKitVersion()
except AttributeError:
    WEBKIT_VERSION = '-'
try:
    from openlp.core.ui.media.vlcplayer import VERSION
    VLC_VERSION = VERSION
except ImportError:
    VLC_VERSION = '-'

from openlp.core.common import is_linux
from openlp.core.common.i18n import UiStrings, translate
from openlp.core.common.mixins import RegistryProperties
from openlp.core.common.settings import Settings
from openlp.core.ui.exceptiondialog import Ui_ExceptionDialog
from openlp.core.widgets.dialogs import FileDialog
from openlp.core.version import get_version
Example #15
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.msg = QtGui.QMessageBox(self)
        self.msg.setWindowTitle(_fromUtf8("Información"))
        self.setWindowTitle(_fromUtf8('Finder'))
        self.resize(529, 440)
        self.input_busqueda = QtGui.QLineEdit(self)
        self.input_busqueda.setGeometry(10, 20, 371, 20)
        self.boton_buscar = QtGui.QPushButton("Buscar", self)
        self.boton_buscar.setGeometry(390, 10, 61, 41)
        self.boton_guardar = QtGui.QPushButton("Guardar", self)
        self.boton_guardar.setGeometry(455, 10, 61, 41)
        self.connect(self.boton_guardar, QtCore.SIGNAL("clicked()"),
                     self.guardar)
        #TABLA ORDENADORA DE RESULTADOS
        self.tabla = QtGui.QTreeWidget(self)
        self.tabla.setGeometry(0, 195, 530, 246)
        self.tabla.headerItem().setText(0, "#")
        self.tabla.headerItem().setText(1, "Id.")
        self.tabla.headerItem().setText(2, _fromUtf8("Tamaño"))
        self.tabla.headerItem().setText(3, "Url")
        #FIN TABLA
        self.grupo_options = QtGui.QGroupBox(self)
        self.grupo_options.setGeometry(10, 47, 291, 101)
        self.icon_perpage_label = QtGui.QLabel(self.grupo_options)
        self.icon_perpage_label.setGeometry(20, 30, 90, 16)
        self.icons_perpage_spin = QtGui.QSpinBox(self.grupo_options)
        self.icons_perpage_spin.setGeometry(113, 27, 47, 22)
        self.icons_perpage_spin.setProperty("value", 20)
        self.minimum_size_label = QtGui.QLabel(self.grupo_options)
        self.minimum_size_label.setGeometry(20, 70, 100, 13)
        self.minimum_size_spin = QtGui.QSpinBox(self.grupo_options)
        self.minimum_size_spin.setMaximum(190)
        self.minimum_size_spin.setGeometry(113, 65, 47, 22)
        self.minimum_size_spin.setProperty("value", 16)
        self.maximum_size_label = QtGui.QLabel(self.grupo_options)
        self.maximum_size_label.setGeometry(170, 70, 70, 13)
        self.maximum_size_spin = QtGui.QSpinBox(self.grupo_options)
        self.maximum_size_spin.setGeometry(241, 67, 42, 22)
        self.maximum_size_spin.setMaximum(190)
        self.maximum_size_spin.setProperty("value", 40)
        self.grupo_preview = QtGui.QGroupBox(self)
        self.grupo_preview.setGeometry(320, 47, 201, 141)
        self.total_results_label = QtGui.QLabel(self)
        self.total_results_label.setGeometry(20, 145, 81, 21)
        self.total_results_label.setStyleSheet("font-weight: bold;")
        self.numero_results_label = QtGui.QLabel(self)
        self.numero_results_label.setGeometry(100, 145, 31, 21)
        self.numero_results_label.setStyleSheet("font-weight: bold;")
        self.viewing_page_label = QtGui.QLabel(self)
        self.viewing_page_label.setGeometry(132, 145, 91, 21)
        self.viewing_page_label.setStyleSheet("font-weight: bold;")
        self.number_vpage_label = QtGui.QLabel(self)
        self.number_vpage_label.setGeometry(190, 145, 51, 21)
        self.number_vpage_label.setStyleSheet("font-weight: bold;")
        self.go_page_label = QtGui.QLabel(_fromUtf8("Ir a página:"), self)
        self.go_page_label.setGeometry(20, 170, 71, 16)
        self.go_page_label.setStyleSheet("font-weight: bold;")
        self.go_page_spin = QtGui.QSpinBox(self)
        self.go_page_spin.setGeometry(89, 168, 42, 22)

        self.grupo_options.setTitle("Opciones")
        self.icon_perpage_label.setText(_fromUtf8("Iconos por página:"))
        self.minimum_size_label.setText(_fromUtf8("Tamaño mínimo    :"))
        self.maximum_size_label.setText(_fromUtf8("Tam. máximo:"))
        self.grupo_preview.setTitle("Prevista")
        self.total_results_label.setText("Resultados:")
        self.numero_results_label.setText("0")
        self.viewing_page_label.setText(_fromUtf8("| Página:"))
        self.number_vpage_label.setText("0")
        self.connect(self.boton_buscar, QtCore.SIGNAL("clicked()"),
                     self.buscar)
        self.connect(self.tabla,
                     QtCore.SIGNAL('itemClicked(QTreeWidgetItem*, int)'),
                     self.ver_link)
        self.preview = QtWebKit.QWebView(self.grupo_preview)
        self.preview.setGeometry(6, 16, 191, 115)

        self.connect(self, QtCore.SIGNAL("closeEvent()"), self.close)