Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class QDockWindowButtons(QFrame):
""" A custom QFrame which provides the buttons for a QDockWindow.
"""
#: A signal emitted when the maximize button is clicked.
maximizeButtonClicked = Signal(bool)
#: A signal emitted when the restore button is clicked.
restoreButtonClicked = Signal(bool)
#: A signal emitted when the close button is closed.
closeButtonClicked = Signal(bool)
#: A signal emitted when the link button is toggled.
linkButtonToggled = Signal(bool)
#: Do not show any buttons in the widget.
NoButtons = 0x0
#: Show the maximize button in the widget.
MaximizeButton = 0x1
#: Show the restore button in the widget.
RestoreButton = 0x2
#: Show the close button in the widget.
CloseButton = 0x4
#: Show the link button in the widget.
LinkButton = 0x8
""" A concrete implementation of IDockTitleBar.
This class serves as the default title bar for a QDockItem.
"""
#: A signal emitted when the maximize button is clicked.
maximizeButtonClicked = Signal(bool)
#: A signal emitted when the restore button is clicked.
restoreButtonClicked = Signal(bool)
#: A signal emitted when the close button is clicked.
closeButtonClicked = Signal(bool)
#: A signal emitted when the link button is toggled.
linkButtonToggled = Signal(bool)
#: A signal emitted when the pin button is toggled.
pinButtonToggled = Signal(bool)
#: A signal emitted when the title is edited by the user.
titleEdited = Signal(str)
#: A signal emitted when the empty area is left double clicked.
leftDoubleClicked = Signal(QPoint)
#: A signal emitted when the empty area is right clicked.
rightClicked = Signal(QPoint)
def __init__(self, parent=None):
""" Initialize a QDockTitleBar.
restoreButtonClicked = Signal(bool)
#: A signal emitted when the close button is clicked.
closeButtonClicked = Signal(bool)
#: A signal emitted when the link button is toggled.
linkButtonToggled = Signal(bool)
#: A signal emitted when the pin button is toggled.
pinButtonToggled = Signal(bool)
#: A signal emitted when the title is edited by the user.
titleEdited = Signal(unicode)
#: A signal emitted when the title bar is left double clicked.
leftDoubleClicked = Signal(QPoint)
#: A signal emitted when the title bar is right clicked.
rightClicked = Signal(QPoint)
#: Do not show any buttons in the title bar.
NoButtons = 0x0
#: Show the maximize button in the title bar.
MaximizeButton = 0x1
#: Show the restore button in the title bar.
RestoreButton = 0x2
#: Show the close button in the title bar.
CloseButton = 0x4
----------
hidden : bool
True if the title bar should be hidden, False otherwise.
"""
raise NotImplementedError
class QDockTitleBar(QFrame, IDockTitleBar):
""" A concrete implementation of IDockTitleBar.
This class serves as the default title bar for a QDockItem.
"""
#: A signal emitted when the maximize button is clicked.
maximizeButtonClicked = Signal(bool)
#: A signal emitted when the restore button is clicked.
restoreButtonClicked = Signal(bool)
#: A signal emitted when the close button is clicked.
closeButtonClicked = Signal(bool)
#: A signal emitted when the link button is toggled.
linkButtonToggled = Signal(bool)
#: A signal emitted when the pin button is toggled.
pinButtonToggled = Signal(bool)
#: A signal emitted when the title is edited by the user.
titleEdited = Signal(str)
#: A signal emitted when the title is edited by the user. This
#: signal is proxied from the current dock item title bar.
titleEdited = Signal(str)
#: A signal emitted when the empty area is left double clicked.
#: This signal is proxied from the current dock item title bar.
titleBarLeftDoubleClicked = Signal(QPoint)
#: A signal emitted when the empty area is right clicked. This
#: signal is proxied from the current dock item title bar.
titleBarRightClicked = Signal(QPoint)
#: A signal emitted when the item is alerted. The payload is the
#: new alert level. An empty string indicates no alert.
alerted = Signal(str)
def __init__(self, parent=None):
""" Initialize a QDockItem.
Parameters
----------
parent : QWidget, optional
The parent of the dock item.
"""
super(QDockItem, self).__init__(parent)
layout = QDockItemLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSizeConstraint(QLayout.SetMinAndMaxSize)
self.setLayout(layout)
self.setTitleBarWidget(QDockTitleBar())
----------
hidden : bool
True if the title bar should be hidden, False otherwise.
"""
raise NotImplementedError
class QDockTitleBar(QFrame, IDockTitleBar):
""" A concrete implementation of IDockTitleBar.
This class serves as the default title bar for a QDockItem.
"""
#: A signal emitted when the maximize button is clicked.
maximizeButtonClicked = Signal(bool)
#: A signal emitted when the restore button is clicked.
restoreButtonClicked = Signal(bool)
#: A signal emitted when the close button is clicked.
closeButtonClicked = Signal(bool)
#: A signal emitted when the link button is toggled.
linkButtonToggled = Signal(bool)
#: A signal emitted when the pin button is toggled.
pinButtonToggled = Signal(bool)
#: A signal emitted when the title is edited by the user.
titleEdited = Signal(unicode)
restoreButtonClicked = Signal(bool)
#: A signal emitted when the close button is clicked.
closeButtonClicked = Signal(bool)
#: A signal emitted when the link button is toggled.
linkButtonToggled = Signal(bool)
#: A signal emitted when the pin button is toggled.
pinButtonToggled = Signal(bool)
#: A signal emitted when the title is edited by the user.
titleEdited = Signal(str)
#: A signal emitted when the empty area is left double clicked.
leftDoubleClicked = Signal(QPoint)
#: A signal emitted when the empty area is right clicked.
rightClicked = Signal(QPoint)
def __init__(self, parent=None):
""" Initialize a QDockTitleBar.
Parameters
----------
parent : QWidget or None
The parent of the title bar.
"""
super(QDockTitleBar, self).__init__(parent)
self._buttons = self.CloseButton | self.MaximizeButton | self.PinButton
self._is_editable = False
}
class QCustomDockWidget(QDockWidget):
""" A custom QDockWidget which adds some Enaml specific features.
"""
#: A signal emitted when the dock widget is closed by the user.
closed = Signal()
#: A signal emitted when the dock widget is floated.
floated = Signal()
#: A signal emitted when the dock widget is docked. The payload
#: will be the new dock area.
docked = Signal(object)
def __init__(self, parent=None):
""" Initialize a QCustomDockWidget.
"""
super(QCustomDockWidget, self).__init__(parent)
self._title_bar_visible = True
self._dock_area = Qt.LeftDockWidgetArea
self.topLevelChanged.connect(self._onTopLevelChanged)
#--------------------------------------------------------------------------
# Private API
#--------------------------------------------------------------------------
def _onTopLevelChanged(self, top_level):
""" The signal handler for the the 'topLevelChanged' signal.
class QDualSlider(QSlider):
""" A Qt implementation of a dual slider.
Dragging on the slider track will cause both the low and high values
to move equally (i.e. the difference between them stays constant).
TODO: Add support for tracking.
"""
#: A signal emitted when the low value of the slider changes.
lowValueChanged = Signal(int)
#: A signal emitted when the high value of the slider changes.
highValueChanged = Signal(int)
#: Enums identifier the active slider thumb.
BothThumbs = -1
LowThumb = 0
HighThumb = 1
def __init__(self, parent=None):
""" Initialize a QDualSlider.
Parameters
----------
parent : QWidget, optional
The parent widget for the dual slider, or None.
"""
super(QDualSlider, self).__init__(parent)
class QDockWindowButtons(QFrame):
""" A custom QFrame which provides the buttons for a QDockWindow.
"""
#: A signal emitted when the maximize button is clicked.
maximizeButtonClicked = Signal(bool)
#: A signal emitted when the restore button is clicked.
restoreButtonClicked = Signal(bool)
#: A signal emitted when the close button is closed.
closeButtonClicked = Signal(bool)
#: A signal emitted when the link button is toggled.
linkButtonToggled = Signal(bool)
#: Do not show any buttons in the widget.
NoButtons = 0x0
#: Show the maximize button in the widget.
MaximizeButton = 0x1
#: Show the restore button in the widget.
RestoreButton = 0x2
#: Show the close button in the widget.
CloseButton = 0x4
#: Show the link button in the widget.
LinkButton = 0x8