Exemplo n.º 1
0
# syntax_style for the console must be one of the supported styles from
# pygments - see here for examples https://help.farbox.com/pygments.html
import re
from ast import literal_eval

try:
    from qtpy import QT_VERSION

    major, minor, *rest = QT_VERSION.split('.')
    use_gradients = (int(major) >= 5) and (int(minor) >= 12)
except Exception:
    use_gradients = False

palettes = {
    'dark': {
        'folder': 'dark',
        'background': 'rgb(38, 41, 48)',
        'foreground': 'rgb(65, 72, 81)',
        'primary': 'rgb(90, 98, 108)',
        'secondary': 'rgb(134, 142, 147)',
        'highlight': 'rgb(106, 115, 128)',
        'text': 'rgb(240, 241, 242)',
        'icon': 'rgb(209, 210, 212)',
        'warning': 'rgb(153, 18, 31)',
        'current': 'rgb(0, 122, 204)',
        'syntax_style': 'native',
        'console': 'rgb(0, 0, 0)',
        'canvas': 'black',
    },
    'light': {
        'folder': 'light',
Exemplo n.º 2
0
try:
    import msgpack
    MSGPACK_SUPPORT = True
except ImportError:
    MSGPACK_SUPPORT = False

try:
    import cbor
    CBOR_SUPPORT = True
except ImportError:
    CBOR_SUPPORT = False


# @Future: when Qt 5.6 becomes standard, remove this:
QT_VER = QT_VERSION.split('.')
if QT_VER[0] == '5' and int(QT_VER[1]) < 6:
    QT55_COMPAT = True
else:
    QT55_COMPAT = False


# Maybe there should be one common enum with all options instead of
# one enum for each thing? I guess I'll decide when there will be
# more than one thing in total.
class Exc_Indication(enum.IntEnum):
    RED_BG = 0
    MSG_ICON = 1
    ICON_AND_RED_BG = 2

Exemplo n.º 3
0
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from qtpy import QT_VERSION
from . import QT_API, PYQT4_API, PYQT5_API

__version__ = QT_VERSION
__version_info__ = tuple(map(int, QT_VERSION.split('.')))
from qtpy.QtCore import *

if QT_API in PYQT4_API or QT_API in PYQT5_API:
    QDateTime.toPython = QDateTime.__dict__['toPyDateTime']
    QDate.toPython = QDate.__dict__['toPyDate']
    QTime.toPython = QTime.__dict__['toPyTime']
    # Remove the input hook or pdb.set_trace() will infinitely recurse
    pyqtRemoveInputHook()
Exemplo n.º 4
0
from qtpy import QT_VERSION
from qtpy.QtWidgets import QSlider  # noqa
from superqt import QDoubleSlider

# here until we can debug why labeled sliders render differently on 5.12
if tuple(int(x) for x in QT_VERSION.split(".")) >= (5, 14):
    from superqt import QLabeledDoubleSlider as QDoubleSlider  # noqa
    from superqt import QLabeledSlider as QSlider  # noqa
Exemplo n.º 5
0
from typing import Optional, Any, Union, Type

from qtpy.QtCore import Qt, QObject, QRegExp
from qtpy.QtGui import QPainter, QPixmap, QIcon
from qtpy.QtWidgets import QApplication
from qtpy import QT_VERSION
# if needed, you can import specific boolean API variables from this module
# when implementing API code elsewhere
from qtpy import API, PYQT4, PYQT5, PYSIDE, PYSIDE2

from .dock_splitter import DockSplitter

DEBUG_LEVEL = 0
QT_VERSION_TUPLE = tuple(int(i) for i in QT_VERSION.split('.')[:3])
del QT_VERSION


def emit_top_level_event_for_widget(widget: Optional['DockWidget'],
                                    floating: bool):
    '''
    Call this function to emit a topLevelChanged() signal and to update the
    dock area tool bar visibility

    Parameters
    ----------
    widget : DockWidget
        The top-level dock widget
    floating : bool
    '''
    if widget is None:
        return
Exemplo n.º 6
0
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#------------------------------------------------------------------------------
from qtpy import QT_VERSION
from . import QT_API, PYQT4_API, PYQT5_API

__version__ = QT_VERSION
__version_info__ = tuple(map(int, QT_VERSION.split('.')))
from qtpy.QtCore import *

if QT_API in PYQT4_API or QT_API in PYQT5_API:
    QDateTime.toPython = QDateTime.__dict__['toPyDateTime']
    QDate.toPython = QDate.__dict__['toPyDate']
    QTime.toPython = QTime.__dict__['toPyTime']
    # Remove the input hook or pdb.set_trace() will infinitely recurse
    pyqtRemoveInputHook()
Exemplo n.º 7
0
 def qt_version(self):
     return tuple(int(v) for v in QT_VERSION.split('.'))