Ejemplo 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())
Ejemplo 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)
Ejemplo n.º 3
0
def main(argv):
    app = QApplication(argv)
    app.setApplicationName("Githost")
    app.setApplicationVersion(qWebKitVersion())
    win = MainWindow()
    win.show()
    sys.exit(app.exec_())
Ejemplo 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)
Ejemplo 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)
Ejemplo 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())
Ejemplo 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())
Ejemplo 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())
Ejemplo 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)
Ejemplo 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)
Ejemplo 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())
Ejemplo 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)
Ejemplo 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())
Ejemplo 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
    }
Ejemplo 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
    }
Ejemplo 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
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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))
Ejemplo 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

#####################
Ejemplo 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'))
Ejemplo 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'))
Ejemplo n.º 26
0
Archivo: log.py Proyecto: dvska/splash
 def _get_browser():
     return {
         "name": "QWebKit",
         "version": six.text_type(qWebKitVersion()),
         "comment": "PyQt %s, Qt %s" % (PYQT_VERSION_STR, QT_VERSION_STR),
     }
Ejemplo n.º 27
0
 def _get_browser(self):
     return {
         "name": "QWebKit",
         "version": str(qWebKitVersion()),
         "comment": "PyQt %s, Qt %s" % (PYQT_VERSION_STR, QT_VERSION_STR),
     }
Ejemplo 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'))
Ejemplo 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
Ejemplo 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,
Ejemplo 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'))
Ejemplo 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'))