def _draw_rect(self, rect, painter): """ Draw the background rectangle using the current style primitive color or foldIndicatorBackground if nativeFoldingIndicator is true. :param rect: The fold zone rect to draw :param painter: The widget's painter. """ c = self._custom_color if self._native: c = self.get_system_bck_color() grad = QtGui.QLinearGradient(rect.topLeft(), rect.topRight()) if sys.platform == 'darwin': grad.setColorAt(0, c.lighter(100)) grad.setColorAt(1, c.lighter(110)) outline = c.darker(110) else: grad.setColorAt(0, c.lighter(110)) grad.setColorAt(1, c.lighter(130)) outline = c.darker(100) painter.fillRect(rect, grad) painter.setPen(QtGui.QPen(outline)) painter.drawLine(rect.topLeft() + QtCore.QPointF(1, 0), rect.topRight() - QtCore.QPointF(1, 0)) painter.drawLine(rect.bottomLeft() + QtCore.QPointF(1, 0), rect.bottomRight() - QtCore.QPointF(1, 0)) painter.drawLine(rect.topRight() + QtCore.QPointF(0, 1), rect.bottomRight() - QtCore.QPointF(0, 1)) painter.drawLine(rect.topLeft() + QtCore.QPointF(0, 1), rect.bottomLeft() - QtCore.QPointF(0, 1))
def test_word_selection(editor): QTest.qWait(1000) mode = get_mode(editor) TextHelper(editor).goto_line(8, 29) QTest.qWait(1000) try: event = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonDblClick, QtCore.QPointF(0, 0), QtCore.Qt.LeftButton, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier) except TypeError: event = QtGui.QMouseEvent(QtCore.QEvent.MouseButtonDblClick, QtCore.QPoint(0, 0), QtCore.Qt.LeftButton, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier) mode._on_double_click(event) assert editor.textCursor().selectedText() == 'modes' QTest.qWait(1000)