How to use the enaml.qt.QtCore.Qt function in enaml

To help you get started, we’ve selected a few enaml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nucleic / enaml / enaml / qt / qt_dock_pane.py View on Github external
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from atom.api import Int, Typed

from enaml.widgets.dock_pane import ProxyDockPane

from .QtCore import Qt, Signal
from .QtWidgets import QDockWidget, QWidget

from .qt_container import QtContainer
from .qt_widget import QtWidget


#: A mapping from Enaml dock areas to Qt dock areas.
_DOCK_AREA_MAP = {
    'top': Qt.TopDockWidgetArea,
    'right': Qt.RightDockWidgetArea,
    'bottom': Qt.BottomDockWidgetArea,
    'left': Qt.LeftDockWidgetArea,
    'all': Qt.AllDockWidgetAreas,
}


#: A mapping from Qt dock areas to Enaml dock areas.
_DOCK_AREA_INV_MAP = {
    Qt.TopDockWidgetArea: 'top',
    Qt.RightDockWidgetArea: 'right',
    Qt.BottomDockWidgetArea: 'bottom',
    Qt.LeftDockWidgetArea: 'left',
    Qt.AllDockWidgetAreas: 'all',
}
github nucleic / enaml / enaml / qt / docking / q_guide_rose.py View on Github external
def __init__(self):
        """ Initialize a QGuideRose.

        """
        super(QGuideRose, self).__init__()
        # On Mac, setting the translucent background does not cause the
        # frame shadow to be hidden; it must be explicitly hidden. Mac
        # also requires the window to be a tooltip in order to be raised
        # above the rubber band in the Z-order. On Windows, the tooltip
        # leaves a dropshadow on Qt >= 4.8 whereas tool does not.
        if sys.platform == 'darwin':
            self.setAttribute(Qt.WA_MacNoShadow, True)
            flags = Qt.ToolTip
        else:
            flags = Qt.Tool
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        flags |= Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
        self.setWindowFlags(flags)
        self._mode = self.Mode.NoMode
        self._center_point = QPoint()
        self._border_guide = BorderGuide()
        self._compass_guide = CompassGuide()
        self._compass_ex_guide = CompassExGuide()
        self._vsplit_guide = SplitVerticalGuide()
        self._hsplit_guide = SplitHorizontalGuide()
        self._area_guide = AreaCenterGuide()
github nucleic / enaml / enaml / qt / docking / dock_overlay.py View on Github external
def __init__(self, parent=None):
        """ Initialize a QDockRubberBand.

        Parameters
        ----------
        parent : QWidget, optional
            The parent of the dock rubber band.

        """
        super(QDockRubberBand, self).__init__(parent)
        self.setWindowFlags(Qt.ToolTip | Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground)
github ContinuumIO / ashiba / enaml / qt / docking / q_dock_frame.py View on Github external
#: Resize the window diagonally from the northeast edge.
    NorthEastBorder = 5

    #: Resize the window diagonally from the northwest edge.
    NorthWestBorder = 6

    #: Resize the window diagonally from the southeast edge.
    SouthEastBorder = 7

    #: Resize the window diagonally from the southwest edge.
    SouthWestBorder = 8

    #: The cursors to use for a given resize border.
    ResizeCursors = {
        NorthBorder: Qt.SizeVerCursor,
        SouthBorder: Qt.SizeVerCursor,
        EastBorder: Qt.SizeHorCursor,
        WestBorder: Qt.SizeHorCursor,
        NorthEastBorder: Qt.SizeBDiagCursor,
        SouthWestBorder: Qt.SizeBDiagCursor,
        NorthWestBorder: Qt.SizeFDiagCursor,
        SouthEastBorder: Qt.SizeFDiagCursor,
    }

    #: The handlers to use for resizing the frame.
    ResizeHandlers = {
        NorthBorder: '_resizeNorth',
        SouthBorder: '_resizeSouth',
        EastBorder: '_resizeEast',
        WestBorder: '_resizeWest',
        NorthEastBorder: '_resizeNortheast',
github ContinuumIO / ashiba / enaml / qt / q_flow_layout.py View on Github external
#: direction of the layout flow, relative to the other items in the
    #: line. The minimum is 0 which means the item should not expand.
    #: There is no maximum. The default is 0.
    stretch = 0

    #: The ortho stretch factor of the layout item. This value controls
    #: the amount of space that is taken up by an expandable item in the
    #: direction orthogonal to the layout flow, relative to other items
    #: in the line. The minimum is 0 which means the item should not
    #: expand. There is no maximum. The default is 0.
    ortho_stretch = 0

    #: The alignment of the layout item in the direction orthogonal to
    #: the layout flow. This must be one of the enums Qt.AlignLeading,
    #: Qt.AlignTrailing, or Qt.AlignCenter.
    alignment = Qt.AlignLeading

    #: The preferred size for the layout item. This size will be used
    #: as the size of the layout item to the extent possible. If this
    #: size is invalid in a particular dimension, the sizeHint of the
    #: item in that direction will be used.
    preferred_size = QSize()

    def __init__(self):
        """ Initialize a FlowLayoutData.

        """
        self.preferred_size = QSize()


class QFlowWidgetItem(QWidgetItem):
    """ A custom QWidgetItem for use with the QFlowLayout.
github BBN-Q / PyQLab / widgets / qt_list_str_widget.py View on Github external
def set_items(self, items, widget=None):
        """
        """
        widget = self.get_widget()
        count = widget.count()
        nitems = len(items)
        for idx, item in enumerate(items[:count]):
            itemWidget = widget.item(idx)
            # Update checked state before the text so that we can distinguish a checked state change from a label change
            itemWidget.setCheckState(Qt.Checked if self.items[idx][1] else Qt.Unchecked)
            itemWidget.setText(item[0])
            self.apply_validator(itemWidget, item[0])
        if nitems > count:
            for item in items[count:]:
                self.add_item(widget, item[0])
        elif nitems < count:
            for idx in reversed(range(nitems, count)):
                widget.takeItem(idx)
github inkcut / inkcut / src / inkcut / workbench / ui / widgets / table_view.py View on Github external
def headerData(self, col, orientation, role):
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            return self.model.headers[col][0]
        elif orientation == Qt.Vertical and role == Qt.DisplayRole:
            return col
        return None
github ContinuumIO / ashiba / enaml / qt / docking / q_dock_bar.py View on Github external
def mousePressEvent(self, event):
        """ Handle the mouse press event for the widget.

        """
        event.ignore()
        if event.button() == Qt.LeftButton:
            self._press_pos = event.pos()
            event.accept()
github nucleic / enaml / enaml / qt / qt_splitter.py View on Github external
def updateFrame(self):
        """ Update the internal frame style for the current orientation.

        """
        orientation = self.orientation()
        s = QFrame.VLine if orientation == Qt.Horizontal else QFrame.HLine
        self._frame.setFrameStyle(s | QFrame.Raised)
github nucleic / enaml / enaml / qt / docking / q_guide_rose.py View on Github external
def __init__(self):
        """ Initialize a QGuideRose.

        """
        super(QGuideRose, self).__init__()
        # On Mac, setting the translucent background does not cause the
        # frame shadow to be hidden; it must be explicitly hidden. Mac
        # also requires the window to be a tooltip in order to be raised
        # above the rubber band in the Z-order. On Windows, the tooltip
        # leaves a dropshadow on Qt >= 4.8 whereas tool does not.
        if sys.platform == 'darwin':
            self.setAttribute(Qt.WA_MacNoShadow, True)
            flags = Qt.ToolTip
        else:
            flags = Qt.Tool
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        flags |= Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
        self.setWindowFlags(flags)
        self._mode = self.Mode.NoMode
        self._center_point = QPoint()
        self._border_guide = BorderGuide()
        self._compass_guide = CompassGuide()
        self._compass_ex_guide = CompassExGuide()
        self._vsplit_guide = SplitVerticalGuide()
        self._hsplit_guide = SplitHorizontalGuide()
        self._area_guide = AreaCenterGuide()