Esempio n. 1
0
def _backend():
    """Get the backend line with relevant information."""
    if objects.backend == usertypes.Backend.QtWebKit:
        return 'QtWebKit{} (WebKit {})'.format(
            '-NG' if qtutils.is_qtwebkit_ng(qWebKitVersion()) else '',
            qWebKitVersion())
    else:
        webengine = usertypes.Backend.QtWebEngine
        assert objects.backend == webengine, objects.backend
        return 'QtWebEngine (Chromium {})'.format(_chromium_version())
Esempio n. 2
0
def versions():
    print("ScudCloud", __version__)
    print("Python", platform.python_version())
    print("Qt", QT_VERSION_STR)
    print("WebKit", qWebKitVersion())
    print("PyQt", PYQT_VERSION_STR)
    print("SIP", SIP_VERSION_STR)
Esempio n. 3
0
def main(argv):
    app = QApplication(argv)
    app.setApplicationName("Githost")
    app.setApplicationVersion(qWebKitVersion())
    win = MainWindow()
    win.show()
    sys.exit(app.exec_())
Esempio n. 4
0
def version():
    """Return a string with various version informations."""
    lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
    gitver = _git_str()
    if gitver is not None:
        lines.append("Git commit: {}".format(gitver))
    lines += [
        '',
        '{}: {}'.format(platform.python_implementation(),
                        platform.python_version()),
        'Qt: {}, runtime: {}'.format(QT_VERSION_STR, qVersion()),
        'PyQt: {}'.format(PYQT_VERSION_STR),
    ]
    lines += _module_versions()

    if QSslSocket is not None and QSslSocket.supportsSsl():
        ssl_version = QSslSocket.sslLibraryVersionString()
    else:
        ssl_version = 'unavailable'
    lines += [
        'Webkit: {}'.format(qWebKitVersion()),
        'Harfbuzz: {}'.format(os.environ.get('QT_HARFBUZZ', 'system')),
        'SSL: {}'.format(ssl_version),
        '',
        'Frozen: {}'.format(hasattr(sys, 'frozen')),
        'Platform: {}, {}'.format(platform.platform(),
                                  platform.architecture()[0]),
    ]
    lines += _os_info()
    return '\n'.join(lines)
Esempio n. 5
0
def version():
    """Return a string with various version informations."""
    lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
    gitver = _git_str()
    if gitver is not None:
        lines.append("Git commit: {}".format(gitver))
    lines += [
        '',
        '{}: {}'.format(platform.python_implementation(),
                        platform.python_version()),
        'Qt: {}, runtime: {}'.format(QT_VERSION_STR, qVersion()),
        'PyQt: {}'.format(PYQT_VERSION_STR),
    ]
    lines += _module_versions()

    if QSslSocket is not None and QSslSocket.supportsSsl():
        ssl_version = QSslSocket.sslLibraryVersionString()
    else:
        ssl_version = 'unavailable'
    lines += [
        'Webkit: {}'.format(qWebKitVersion()),
        'Harfbuzz: {}'.format(os.environ.get('QT_HARFBUZZ', 'system')),
        'SSL: {}'.format(ssl_version),
        '',
        'Frozen: {}'.format(hasattr(sys, 'frozen')),
        'Platform: {}, {}'.format(platform.platform(),
                                  platform.architecture()[0]),
    ]
    lines += _os_info()
    return '\n'.join(lines)
Esempio n. 6
0
def _backend():
    """Get the backend line with relevant information."""
    if objects.backend == usertypes.Backend.QtWebKit:
        return 'new QtWebKit (WebKit {})'.format(qWebKitVersion())
    else:
        webengine = usertypes.Backend.QtWebEngine
        assert objects.backend == webengine, objects.backend
        return 'QtWebEngine (Chromium {})'.format(_chromium_version())
Esempio n. 7
0
def _init_private_browsing():
    if config.get('general', 'private-browsing'):
        if qtutils.is_qtwebkit_ng(qWebKitVersion()):
            message.warning("Private browsing is not fully implemented by "
                            "QtWebKit-NG!")
        QWebSettings.setIconDatabasePath('')
    else:
        QWebSettings.setIconDatabasePath(standarddir.cache())
Esempio n. 8
0
def _backend():
    """Get the backend line with relevant information."""
    if objects.backend == usertypes.Backend.QtWebKit:
        return 'new QtWebKit (WebKit {})'.format(qWebKitVersion())
    else:
        webengine = usertypes.Backend.QtWebEngine
        assert objects.backend == webengine, objects.backend
        return 'QtWebEngine (Chromium {})'.format(_chromium_version())
Esempio n. 9
0
def version():
    """Return a string with various version informations."""
    lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
    gitver = _git_str()
    if gitver is not None:
        lines.append("Git commit: {}".format(gitver))

    if qVersion() != QT_VERSION_STR:
        qt_version = 'Qt: {} (compiled {})'.format(qVersion(), QT_VERSION_STR)
    else:
        qt_version = 'Qt: {}'.format(qVersion())

    lines += [
        '',
        '{}: {}'.format(platform.python_implementation(),
                        platform.python_version()),
        qt_version,
        'PyQt: {}'.format(PYQT_VERSION_STR),
        '',
    ]

    lines += _module_versions()

    lines += ['pdf.js: {}'.format(_pdfjs_version())]

    if qWebKitVersion is None:
        lines.append('Webkit: no')
    else:
        lines.append('Webkit: {}'.format(qWebKitVersion()))

    lines += [
        'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
        '',
    ]

    qapp = QApplication.instance()
    if qapp:
        style = qapp.style()
        lines.append('Style: {}'.format(style.metaObject().className()))

    importpath = os.path.dirname(os.path.abspath(qutebrowser.__file__))

    lines += [
        'Platform: {}, {}'.format(platform.platform(),
                                  platform.architecture()[0]),
        'Frozen: {}'.format(hasattr(sys, 'frozen')),
        "Imported from {}".format(importpath),
    ]
    lines += _os_info()

    lines += [
        '',
        'Paths:',
    ]
    for name, path in _path_info().items():
        lines += ['{}: {}'.format(name, path)]

    return '\n'.join(lines)
Esempio n. 10
0
def version():
    """Return a string with various version informations."""
    lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
    gitver = _git_str()
    if gitver is not None:
        lines.append("Git commit: {}".format(gitver))

    if qVersion() != QT_VERSION_STR:
        qt_version = 'Qt: {} (compiled {})'.format(qVersion(), QT_VERSION_STR)
    else:
        qt_version = 'Qt: {}'.format(qVersion())

    lines += [
        '',
        '{}: {}'.format(platform.python_implementation(),
                        platform.python_version()),
        qt_version,
        'PyQt: {}'.format(PYQT_VERSION_STR),
        '',
    ]

    lines += _module_versions()

    lines += ['pdf.js: {}'.format(_pdfjs_version())]

    if qWebKitVersion is None:
        lines.append('Webkit: no')
    else:
        lines.append('Webkit: {}'.format(qWebKitVersion()))

    lines += [
        'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
        '',
    ]

    qapp = QApplication.instance()
    if qapp:
        style = qapp.style()
        lines.append('Style: {}'.format(style.metaObject().className()))

    importpath = os.path.dirname(os.path.abspath(qutebrowser.__file__))

    lines += [
        'Platform: {}, {}'.format(platform.platform(),
                                  platform.architecture()[0]),
        'Frozen: {}'.format(hasattr(sys, 'frozen')),
        "Imported from {}".format(importpath),
    ]
    lines += _os_info()

    lines += [
        '',
        'Paths:',
    ]
    for name, path in _path_info().items():
        lines += ['{}: {}'.format(name, path)]

    return '\n'.join(lines)
Esempio n. 11
0
def _backend() -> str:
    """Get the backend line with relevant information."""
    if objects.backend == usertypes.Backend.QtWebKit:
        return 'new QtWebKit (WebKit {})'.format(qWebKitVersion())
    else:
        webengine = usertypes.Backend.QtWebEngine
        if objects.backend != webengine:
            raise AssertionError(objects.backend)
        return 'QtWebEngine (Chromium {})'.format(_chromium_version())
Esempio n. 12
0
def _backend() -> str:
    """Get the backend line with relevant information."""
    if objects.backend == usertypes.Backend.QtWebKit:
        return 'new QtWebKit (WebKit {})'.format(qWebKitVersion())
    elif objects.backend == usertypes.Backend.QtWebEngine:
        return str(
            qtwebengine_versions(
                avoid_init='avoid-chromium-init' in objects.debug_flags))
    raise utils.Unreachable(objects.backend)
Esempio n. 13
0
def _backend():
    """Get the backend line with relevant information."""
    if objects.backend == usertypes.Backend.QtWebKit:
        return 'QtWebKit{} (WebKit {})'.format(
            '-NG' if qtutils.is_qtwebkit_ng() else '', qWebKitVersion())
    else:
        webengine = usertypes.Backend.QtWebEngine
        assert objects.backend == webengine, objects.backend
        return 'QtWebEngine (Chromium {})'.format(_chromium_version())
Esempio n. 14
0
def get_versions():
    """ Return a dictionary with qt/pyqt/webkit/sip versions """
    from sip import SIP_VERSION_STR
    from PyQt5.QtCore import PYQT_VERSION_STR, QT_VERSION_STR
    from PyQt5.QtWebKit import qWebKitVersion

    return {
        'qt': QT_VERSION_STR,
        'pyqt': PYQT_VERSION_STR,
        'webkit': qWebKitVersion(),
        'sip': SIP_VERSION_STR
    }
Esempio n. 15
0
def get_versions():
    """ Return a dictionary with qt/pyqt/webkit/sip versions """
    from sip import SIP_VERSION_STR
    from PyQt5.QtCore import PYQT_VERSION_STR, QT_VERSION_STR
    from PyQt5.QtWebKit import qWebKitVersion

    return {
        'qt': QT_VERSION_STR,
        'pyqt': PYQT_VERSION_STR,
        'webkit': qWebKitVersion(),
        'sip': SIP_VERSION_STR
    }
Esempio n. 16
0
def serialize(items):
    """Serialize a list of QWebHistoryItems to a data stream.

    Args:
        items: An iterable of WebHistoryItems.

    Return:
        A (stream, data, user_data) tuple.
            stream: The reset QDataStream.
            data: The QByteArray with the raw data.
            user_data: A list with each item's user data.

    Warning:
        If 'data' goes out of scope, reading from 'stream' will result in a
        segfault!
    """
    data = QByteArray()
    stream = QDataStream(data, QIODevice.ReadWrite)
    user_data = []

    current_idx = None

    for i, item in enumerate(items):
        if item.active:
            if current_idx is not None:
                raise ValueError("Multiple active items ({} and {}) "
                                 "found!".format(current_idx, i))
            else:
                current_idx = i

    if items:
        if current_idx is None:
            raise ValueError("No active item found!")
    else:
        current_idx = 0

    if qtutils.is_qtwebkit_ng(qWebKitVersion()):
        _serialize_ng(items, current_idx, stream)
    else:
        _serialize_old(items, current_idx, stream)

    user_data += [item.user_data for item in items]

    stream.device().reset()
    qtutils.check_qdatastream(stream)
    return stream, data, user_data
Esempio n. 17
0
 def __setDiskCache(self):
     """
     Private method to set the disk cache.
     """
     if Preferences.getHelp("DiskCacheEnabled"):
         from PyQt5.QtWebKit import qWebKitVersion
         from .NetworkDiskCache import NetworkDiskCache
         diskCache = NetworkDiskCache(self)
         location = os.path.join(
             Utilities.getConfigDir(), "browser", 'cache',
             "{0}-Qt{1}".format(qWebKitVersion(), qVersion()))
         size = Preferences.getHelp("DiskCacheSize") * 1024 * 1024
         diskCache.setCacheDirectory(location)
         diskCache.setMaximumCacheSize(size)
     else:
         diskCache = None
     self.setCache(diskCache)
Esempio n. 18
0
 def __setDiskCache(self):
     """
     Private method to set the disk cache.
     """
     if Preferences.getHelp("DiskCacheEnabled"):
         from PyQt5.QtWebKit import qWebKitVersion
         from .NetworkDiskCache import NetworkDiskCache
         diskCache = NetworkDiskCache(self)
         location = os.path.join(
             Utilities.getConfigDir(), "browser", 'cache',
             "{0}-Qt{1}".format(qWebKitVersion(), qVersion()))
         size = Preferences.getHelp("DiskCacheSize") * 1024 * 1024
         diskCache.setCacheDirectory(location)
         diskCache.setMaximumCacheSize(size)
     else:
         diskCache = None
     self.setCache(diskCache)
Esempio n. 19
0
def version():
    """Return a string with various version informations."""
    lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
    gitver = _git_str()
    if gitver is not None:
        lines.append("Git commit: {}".format(gitver))

    if qVersion() != QT_VERSION_STR:
        qt_version = "Qt: {} (compiled {})".format(qVersion(), QT_VERSION_STR)
    else:
        qt_version = "Qt: {}".format(qVersion())

    lines += [
        "",
        "{}: {}".format(platform.python_implementation(), platform.python_version()),
        qt_version,
        "PyQt: {}".format(PYQT_VERSION_STR),
        "",
    ]

    lines += _module_versions()

    lines += ["pdf.js: {}".format(_pdfjs_version())]

    if qWebKitVersion is None:
        lines.append("Webkit: no")
    else:
        lines.append("Webkit: {}".format(qWebKitVersion()))

    lines += ["SSL: {}".format(QSslSocket.sslLibraryVersionString()), ""]

    qapp = QApplication.instance()
    if qapp:
        style = qapp.style()
        lines.append("Style: {}".format(style.metaObject().className()))

    importpath = os.path.dirname(os.path.abspath(qutebrowser.__file__))

    lines += [
        "Platform: {}, {}".format(platform.platform(), platform.architecture()[0]),
        "Frozen: {}".format(hasattr(sys, "frozen")),
        "Imported from {}".format(importpath),
    ]
    lines += _os_info()
    return "\n".join(lines)
Esempio n. 20
0
def version(short=False):
    """Return a string with various version informations.

    Args:
        short: Return a shortened output.
    """
    lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
    gitver = _git_str()
    if gitver is not None:
        lines.append("Git commit: {}".format(gitver))
    lines += [
        '',
        '{}: {}'.format(platform.python_implementation(),
                        platform.python_version()),
        'Qt: {}, runtime: {}'.format(QT_VERSION_STR, qVersion()),
        'PyQt: {}'.format(PYQT_VERSION_STR),
    ]

    if not short:
        style = QApplication.instance().style()
        lines += [
            'Style: {}'.format(style.metaObject().className()),
            'Desktop: {}'.format(os.environ.get('DESKTOP_SESSION')),
        ]

        lines += _module_versions()

        lines += [
            'pdf.js: {}'.format(_pdfjs_version()),
            'Webkit: {}'.format(qWebKitVersion()),
            'Harfbuzz: {}'.format(os.environ.get('QT_HARFBUZZ', 'system')),
            'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
            '',
            'Frozen: {}'.format(hasattr(sys, 'frozen')),
            'Platform: {}, {}'.format(platform.platform(),
                                      platform.architecture()[0]),
        ]
        lines += _os_info()
    return '\n'.join(lines)
Esempio n. 21
0
def version(short=False):
    """Return a string with various version informations.

    Args:
        short: Return a shortened output.
    """
    lines = ["qutebrowser v{}".format(qutebrowser.__version__)]
    gitver = _git_str()
    if gitver is not None:
        lines.append("Git commit: {}".format(gitver))
    lines += [
        '',
        '{}: {}'.format(platform.python_implementation(),
                        platform.python_version()),
        'Qt: {}, runtime: {}'.format(QT_VERSION_STR, qVersion()),
        'PyQt: {}'.format(PYQT_VERSION_STR),
    ]

    if not short:
        style = QApplication.instance().style()
        lines += [
            'Style: {}'.format(style.metaObject().className()),
            'Desktop: {}'.format(os.environ.get('DESKTOP_SESSION')),
        ]

        lines += _module_versions()

        lines += [
            'pdf.js: {}'.format(_pdfjs_version()),
            'Webkit: {}'.format(qWebKitVersion()),
            'Harfbuzz: {}'.format(os.environ.get('QT_HARFBUZZ', 'system')),
            'SSL: {}'.format(QSslSocket.sslLibraryVersionString()),
            '',
            'Frozen: {}'.format(hasattr(sys, 'frozen')),
            'Platform: {}, {}'.format(platform.platform(),
                                      platform.architecture()[0]),
        ]
        lines += _os_info()
    return '\n'.join(lines)
Esempio n. 22
0
def pytest_collection_modifyitems(config, items):
    """Apply @qtwebengine_* markers; skip unittests with QUTE_BDD_WEBENGINE."""
    if config.webengine:
        qtwebkit_ng_used = False
    else:
        try:
            from PyQt5.QtWebKit import qWebKitVersion
        except ImportError:
            qtwebkit_ng_used = False
        else:
            qtwebkit_ng_used = qtutils.is_qtwebkit_ng(qWebKitVersion())

    markers = [
        ('qtwebengine_todo', 'QtWebEngine TODO', pytest.mark.xfail,
         config.webengine),
        ('qtwebengine_skip', 'Skipped with QtWebEngine', pytest.mark.skipif,
         config.webengine),
        ('qtwebkit_skip', 'Skipped with QtWebKit', pytest.mark.skipif,
         not config.webengine),
        ('qtwebkit_ng_xfail', 'Failing with QtWebKit-NG', pytest.mark.xfail,
         qtwebkit_ng_used),
        ('qtwebkit_ng_skip', 'Skipped with QtWebKit-NG', pytest.mark.skipif,
         qtwebkit_ng_used),
        ('qtwebengine_flaky', 'Flaky with QtWebEngine', pytest.mark.skipif,
         config.webengine),
        ('qtwebengine_osx_xfail', 'Fails on OS X with QtWebEngine',
         pytest.mark.xfail, config.webengine and sys.platform == 'darwin'),
    ]

    for item in items:
        for name, prefix, pytest_mark, condition in markers:
            marker = item.get_marker(name)
            if marker and condition:
                if marker.args:
                    text = '{}: {}'.format(prefix, marker.args[0])
                else:
                    text = prefix
                item.add_marker(
                    pytest_mark(condition, reason=text, **marker.kwargs))
Esempio n. 23
0
qt_version = qVersion()
try:
    qt_version_info = [int(seg) for seg in qt_version.split(".")]
except:
    qt_version_info = [5, 3, 1]

# Default user agent.
def createUserAgent():
    pass

# Python locale
try: app_locale = str(locale.getlocale()[0])
except: app_locale = str(QLocale.system().name())
app_locale_h = app_locale.replace("_", "-")

format_string = {"system": platform.system(), "machine": platform.machine(), "app_name": app_name, "qt_version": qt_version, "app_version": app_version, "webkit_version_m1": qWebKitVersion().split(".")[0], "webkit_version": qWebKitVersion(), "qt_version": qt_version, "locale": app_locale_h.lower(), "release": platform.release()}
defaultUserAgent = "Mozilla/5.0 (%(system)s %(machine)s; U; %(locale)s) AppleWebKit/%(webkit_version_m1)s+ (KHTML, like Gecko) Arora/%(qt_version)s Safari/%(webkit_version)s+ %(app_name)s/%(app_version)s" % format_string
mobileUserAgent = "Mozilla/5.0 (Linux; U; Android 2.3.5; %s) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1" % (app_locale_h,)
simpleUserAgent = "%(app_name)s/%(app_version)s (%(system)s; %(locale)s)" % format_string
chromeUserAgent = "Mozilla/5.0 (%(system)s %(machine)s; U; %(locale)s) AppleWebKit/%(webkit_version)s (KHTML, like Gecko) Chrome/24.%(qt_version)s Safari/%(webkit_version)s" % format_string
elinksUserAgent = "ELinks/%(qt_version)s (textmode; %(system)s %(release)s %(machine)s; 80x24)" % format_string
dilloUserAgent = "Dillo/%s" % (qt_version,)

user_agents = {"&Simplified": simpleUserAgent, "&Chromium": chromeUserAgent, "&Nimbus": defaultUserAgent, "&Qt": "nimbus_generic", "&Android": mobileUserAgent, "&ELinks": elinksUserAgent, "&Dillo": dilloUserAgent}

# WIDGET RELATED #

# This is a global store for the settings dialog.
settingsDialog = None

#####################
Esempio n. 24
0
def is_new_qtwebkit() -> bool:
    """Check if the given version is a new QtWebKit."""
    assert qWebKitVersion is not None
    return (pkg_resources.parse_version(qWebKitVersion()) >
            pkg_resources.parse_version('538.1'))
Esempio n. 25
0
def is_qtwebkit_ng():
    """Check if the given version is QtWebKit-NG."""
    assert qWebKitVersion is not None
    return (pkg_resources.parse_version(qWebKitVersion()) >
            pkg_resources.parse_version('538.1'))
Esempio n. 26
0
File: log.py Progetto: dvska/splash
 def _get_browser():
     return {
         "name": "QWebKit",
         "version": six.text_type(qWebKitVersion()),
         "comment": "PyQt %s, Qt %s" % (PYQT_VERSION_STR, QT_VERSION_STR),
     }
Esempio n. 27
0
 def _get_browser(self):
     return {
         "name": "QWebKit",
         "version": str(qWebKitVersion()),
         "comment": "PyQt %s, Qt %s" % (PYQT_VERSION_STR, QT_VERSION_STR),
     }
Esempio n. 28
0
def is_qtwebkit_ng():
    """Check if the given version is QtWebKit-NG."""
    assert qWebKitVersion is not None
    return (pkg_resources.parse_version(qWebKitVersion()) >
            pkg_resources.parse_version('538.1'))
Esempio n. 29
0
tlds = []
if os.path.isfile(tlds_file):
    try: f = open(tlds_file, "r")
    except: pass
    else:
        try: tlds = ["." + dom for dom in f.read().split("\n") if dom != ""]
        except: pass
        f.close()

def topLevelDomains():
    return tlds

# Qt version.
qt_version = qVersion()

defaultUserAgent = "%(app_name)s/%(app_version)s (%(system)s %(machine)s) AppleWebKit/%(webkit_version)s (KHTML, like Gecko) Chrome/22.%(qt_version)s" % {"app_name": app_name, "app_version": app_version, "system": platform.system(), "qt_version": qt_version, "webkit_version": qWebKitVersion(), "machine": platform.machine()}
mobileUserAgent = "Mozilla/5.0 (Linux; U; Android 2.3.5; en-us) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
firefoxUserAgent = "Mozilla/5.0 (%s %s; rv:24.0) Gecko/20100101 Firefox/24.0" % (platform.system(), platform.machine())
safariUserAgent = "Mozilla/5.0 (%(system)s %(machine)s) AppleWebKit/%(webkit_version)s (KHTML, like Gecko) Version/4.0 Safari/%(webkit_version)s" % {"system": platform.system(), "webkit_version": qWebKitVersion(), "machine": platform.machine()}
chromeUserAgent = "Mozilla/5.0 (%(system)s %(machine)s) AppleWebKit/%(webkit_version)s (KHTML, like Gecko) Chrome/22.%(qt_version)s Safari/%(webkit_version)s" % {"system": platform.system(), "webkit_version": qWebKitVersion(), "qt_version": qt_version, "machine": platform.machine()}
netSurfUserAgent = "NetSurf/%(qt_version)s (%(system)s; %(machine)s)" % {"system": platform.system(), "qt_version": qt_version, "machine": platform.machine()}
elinksUserAgent = "ELinks/%(qt_version)s (textmode; %(system)s %(release)s %(machine)s; 80x24)" % {"system": platform.system(), "qt_version": qt_version, "machine": platform.machine(), "release": platform.release()}
dilloUserAgent = "Dillo/%s" % (qt_version,)

user_agents = {"&Internet Explorer": "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko", "&Firefox": firefoxUserAgent, "&Safari": safariUserAgent, "&Chromium": chromeUserAgent, "&Nimbus": defaultUserAgent, "&Android": mobileUserAgent, "NetSu&rf": netSurfUserAgent, "&ELinks": elinksUserAgent, "&Dillo": dilloUserAgent, "&Qt": "nimbus_generic"}

# Default user agent.
def createUserAgent():
    pass

# Python locale
Esempio n. 30
0

# Python locale
try:
    app_locale = str(locale.getlocale()[0])
except:
    app_locale = str(QLocale.system().name())
app_locale_h = app_locale.replace("_", "-")

format_string = {
    "system": platform.system(),
    "machine": platform.machine(),
    "app_name": app_name,
    "qt_version": qt_version,
    "app_version": app_version,
    "webkit_version_m1": qWebKitVersion().split(".")[0],
    "webkit_version": qWebKitVersion(),
    "qt_version": qt_version,
    "locale": app_locale_h.lower(),
    "release": platform.release()
}
defaultUserAgent = "Mozilla/5.0 (%(system)s %(machine)s; U; %(locale)s) AppleWebKit/%(webkit_version_m1)s+ (KHTML, like Gecko) Arora/%(qt_version)s Safari/%(webkit_version)s+ %(app_name)s/%(app_version)s" % format_string
mobileUserAgent = "Mozilla/5.0 (Linux; U; Android 2.3.5; %s) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1" % (
    app_locale_h, )
simpleUserAgent = "%(app_name)s/%(app_version)s (%(system)s; %(locale)s)" % format_string
chromeUserAgent = "Mozilla/5.0 (%(system)s %(machine)s; U; %(locale)s) AppleWebKit/%(webkit_version)s (KHTML, like Gecko) Chrome/24.%(qt_version)s Safari/%(webkit_version)s" % format_string
elinksUserAgent = "ELinks/%(qt_version)s (textmode; %(system)s %(release)s %(machine)s; 80x24)" % format_string
dilloUserAgent = "Dillo/%s" % (qt_version, )

user_agents = {
    "&Simplified": simpleUserAgent,
Esempio n. 31
0
def is_new_qtwebkit() -> bool:
    """Check if the given version is a new QtWebKit."""
    assert qWebKitVersion is not None
    return (pkg_resources.parse_version(qWebKitVersion()) >
            pkg_resources.parse_version('538.1'))
Esempio n. 32
0
def is_new_qtwebkit() -> bool:
    """Check if the given version is a new QtWebKit."""
    assert qWebKitVersion is not None
    return (utils.VersionNumber.parse(qWebKitVersion()) >
            utils.VersionNumber.parse('538.1'))