Пример #1
0
    def mouseMoveEvent(self, event):
        position = self.mapFromGlobal(event.globalPos())
        key = (position.y() // self.cellSize) * self.columns + position.x() // self.cellSize

        text = '<p>Character: <span style="font-size: 24pt; font-family: %s">%s</span><p>code: %d' % (
                self.displayFont.family(), self._chr(key), key+32)
        QToolTip.showText(event.globalPos(), text, self)
Пример #2
0
 def event(self, ev):
     if ev.type() == QEvent.ToolTip:
         if self._showToolTips:
             c = self.charcodeAt(ev.pos())
             if c:
                 text = self.getToolTipText(c)
                 if text:
                     rect = self.charcodeRect(c)
                     QToolTip.showText(ev.globalPos(), text, self, rect)
                     ev.accept()
                     return True
     elif ev.type() == QEvent.QueryWhatsThis:
         if self._showWhatsThis:
             ev.accept()
             return True
     elif ev.type() == QEvent.WhatsThis:
         ev.accept()
         if self._showWhatsThis:
             c = self.charcodeAt(ev.pos())
             text = self.getWhatsThisText(c) if c else None
             if text:
                 QWhatsThis.showText(ev.globalPos(), text, self)
             else:
                 QWhatsThis.leaveWhatsThisMode()
         return True
     return super(CharMap, self).event(ev)
Пример #3
0
 def moved(self, pos):
     with self.lock:
         fee_rate = self.config.dynfee(pos) if self.dyn else self.config.static_fee(pos)
         tooltip = self.get_tooltip(pos, fee_rate)
         QToolTip.showText(QCursor.pos(), tooltip, self)
         self.setToolTip(tooltip)
         self.callback(self.dyn, pos, fee_rate)
Пример #4
0
 def mouseMoveEvent(self, event):
     cursor = self._neditor.cursorForPosition(event.pos())
     line = cursor.blockNumber()
     bookmarks = self._bookmark_manager.bookmarks(self._neditor.file_path)
     for book in bookmarks:
         if book.lineno == line and book.note:
             QToolTip.showText(self.mapToGlobal(event.pos()), book.note)
Пример #5
0
 def verifier_feuille(self, eq1, eq2):
     print(eq1, eq2)
     for nom, eq in (('d1', eq1), ('d2', eq2)):
         if nom in self.feuille_actuelle.objets.noms:
             d = self.feuille_actuelle.objets[nom]
             d.label(mode='nom')
             champ = self.feuille_actuelle.objets['champcache_' + nom]
             M, N = d
             M = (int(M.x), int(M.y))
             N = (int(N.x), int(N.y))
             if self.eq_reduite(M, N) == eq:
                 d.style(couleur='g')
                 champ.texte = 'ok'
                 msg = 'La droite %s est correcte.' % nom
                 if nom == 'd1':
                     msg += ' Construisez maintenant d2.'
             else:
                 print(self.eq_reduite(*d), eq)
                 d.style(couleur='r')
                 # On peut mettre n'importe quoi différent de ok dans
                 # champ, l'idée étant que si la droite est fausse mais
                 # n'a pas changé, on ne perde pas de point, et par
                 # contre on perde des points en cas de changement si
                 # c'est toujours faux.
                 champ.texte = str(d.equation)
                 msg = "Attention, la droite %s est fausse." % nom
             QToolTip.showText(QCursor.pos(), msg)
             self.canvas.message(msg, temporaire=False)
Пример #6
0
 def mouseMoveEvent(self, event):
     super().mouseMoveEvent(event)
     # tooltip_position = event.globalPos() - QPoint(event.pos().x(), 0)
     from_line = self._neditor.first_visible_block().blockNumber() + 1
     to_line = self._neditor.last_visible_block().blockNumber()
     text = "<center>%d<br/>&#x2014;<br/>%d</center>"
     QToolTip.showText(self._tooltip_pos, text % (from_line, to_line))
Пример #7
0
 def mousePressEvent(self, event):
     super().mousePressEvent(event)
     if event.button() == Qt.LeftButton:
         self._tooltip_pos = event.globalPos() - QPoint(event.pos().x(), 0)
         from_line = self._neditor.first_visible_block().blockNumber() + 1
         to_line = self._neditor.last_visible_block().blockNumber()
         text = "<center>%d<br/>&#x2014;<br/>%d</center>"
         QToolTip.showText(self._tooltip_pos, text % (from_line, to_line))
Пример #8
0
    def mouseMoveEvent(self, event):
        blockNumber = self._qpart.cursorForPosition(event.pos()).blockNumber()
        if blockNumber in self._qpart._lintMarks:
            msgType, msgText = self._qpart._lintMarks[blockNumber]
            QToolTip.showText(event.globalPos(), msgText)
        else:
            QToolTip.hideText()

        return QWidget.mouseMoveEvent(self, event)
Пример #9
0
 def event(self, ev):
     if ev.type() == QEvent.ToolTip:
         text = self.defaultAction().text()
         key = self.key()
         if key:
             text = _("{name} ({key})").format(name=text, key=key)
         QToolTip.showText(ev.globalPos(), text)
         return True
     return super(Button, self).event(ev)
Пример #10
0
 def mouseMoveEvent(self, event):
     if not self.cross:
         mouse_x = event.pos().x()
         mouse_y = event.pos().y()
         self.mouse_pos = event.pos()
         if self.img != None:
             rgb = QColor(self.img.pixel(self.mouse_pos))
             text = "XY[" + str(mouse_x) + "," + str(mouse_y)+ "] RGB(" + str(rgb.red()) + "," + str(rgb.green()) + "," + str(rgb.blue()) + ")"
             QToolTip.showText(QPoint(QCursor.pos()), text)
         self.repaint()
Пример #11
0
 def linkHelpEvent(self, globalPos, page, link):
     """Called when a QHelpEvent occurs on a link.
     
     The default implementation shows a tooltip if showUrls() is True,
     and emits the linkHelpRequested() signal.
     
     """
     if self._showUrlTips and isinstance(link, popplerqt5.Poppler.LinkBrowse):
         QToolTip.showText(globalPos, link.url(), self, page.linkRect(link.linkArea()))
     self.linkHelpRequested.emit(globalPos, page, link)
Пример #12
0
 def moved(self, pos):
     with self.lock:
         if self.dyn:
             fee_rate = self.config.depth_to_fee(pos) if self.config.use_mempool_fees() else self.config.eta_to_fee(pos)
         else:
             fee_rate = self.config.static_fee(pos)
         tooltip = self.get_tooltip(pos, fee_rate)
         QToolTip.showText(QCursor.pos(), tooltip, self)
         self.setToolTip(tooltip)
         self.callback(self.dyn, pos, fee_rate)
Пример #13
0
 def event(self, e):
     action = self.activeAction()
     if e.type() == QEvent.ToolTip and \
         action                    and \
         action.toolTip() != action.text():
             QToolTip.showText(e.globalPos(),
                               self.activeAction().toolTip())
     else:
         QToolTip.hideText()
     return super(Menu, self).event(e)
Пример #14
0
 def mouseMoveEvent(self, event):
     if not self.__checkers:
         return
     line = self._editor.line_from_position(event.pos().y())
     for checker in self.__checkers:
         obj, _, _ = checker
         message = obj.message(line)
         if message is not None:
             # Formatting text
             text = "<div style='color: green'>Lint</div><hr>%s" % message
             QToolTip.showText(self.mapToGlobal(event.pos()), text, self)
Пример #15
0
    def event(self, event):
        if event.type() == QEvent.ToolTip:
            helpEvent = event
            index = self.itemAt(helpEvent.pos())
            if index != -1:
                QToolTip.showText(helpEvent.globalPos(), self.shapeItems[index].toolTip())
            else:
                QToolTip.hideText()
                event.ignore()

            return True

        return super(SortingBox, self).event(event)
Пример #16
0
 def slotLinkHelpRequested(self, pos, page, link):
     """Called when a ToolTip wants to appear above the hovered link."""
     if isinstance(link, popplerqt5.Poppler.LinkBrowse):
         cursor = self._links.cursor(link)
         if cursor:
             import documenttooltip
             text = documenttooltip.text(cursor)
         elif link.url():
             l = textedit.link(link.url())
             if l:
                 text = "{0} ({1}:{2})".format(os.path.basename(l.filename), l.line, l.column)
             else:
                 text = link.url()
         QToolTip.showText(pos, text, self.view.surface(), page.linkRect(link.linkArea()))
Пример #17
0
    def mouseMoveEvent(self, event):
        textEditView.mouseMoveEvent(self, event)

        onRef = [r for r in self.refRects if r.contains(event.pos())]

        if not onRef:
            qApp.restoreOverrideCursor()
            QToolTip.hideText()
            return

        cursor = self.cursorForPosition(event.pos())
        ref = self.refUnderCursor(cursor)
        if ref:
            if not qApp.overrideCursor():
                qApp.setOverrideCursor(Qt.PointingHandCursor)
            QToolTip.showText(self.mapToGlobal(event.pos()), Ref.tooltip(ref))
Пример #18
0
 def mouseReleaseEvent(self, event):
     """鼠标释放"""
     if event.button() == Qt.LeftButton:
         self._change_image_("normal")
         self.moveCanPlay = False
         if not self.canPlay:    # 移动了,不播放
             self.canPlay = True
             return
         # 只是点击才播放
         self.cindex = self.cindex + 1
         # 当当前序号大于了排除drag的个数或者是当前序号为drag的序号0时,改为1
         if self.cindex > self.player.mediaCount() - 1: self.cindex = 1
         self.player.play(self.cindex)    # 播放
         text = self.player.getText(self.cindex)
         QToolTip.showText(self.pos() + QPoint(0, -50), text, self)
     QLabel.mouseReleaseEvent(self, event)
Пример #19
0
    def helpEvent(self, event, view, option, index):
        if not event or not view:
            return False

        if event.type() == QEvent.ToolTip:
            rect = view.visualRect(index)
            size = self.sizeHint(option, index)

            if rect.width() < size.width():
                tooltip = index.data(Qt.DisplayRole)

                QToolTip.showText(event.globalPos(), tooltip)
                return True

            if not QStyledItemDelegate.helpEvent(self, event, view, option, index):
                QToolTip.hideText()

            return True

        return QStyledItemDelegate.helpEvent(self, event, view, option, index)
Пример #20
0
 def mousePressEvent(self, event):
     event = QMouseEvent(event)
     if event.button() == Qt.LeftButton:
         plottable = self.plottableAt(event.pos())
         if plottable is not None:
             x = self.xAxis.pixelToCoord(event.pos().x())
             y = self.yAxis.pixelToCoord(event.pos().y())
             bar = self.plottableBarsAt(event.pos())
             graph = self.plottableGraphAt(event.pos())
             if bar:
                 data = QCPBarData(bar.data()[4.0])
                 y = data.value
                 QToolTip.showText(event.globalPos(),
                                   QCoreApplication.translate('MousePlot',
                                                              '<table>'
                                                              '<tr>'
                                                              '<th colspan="2">%s</th>'
                                                              '</tr>'
                                                              '<tr>'
                                                              '<td>%s rub.</td>'
                                                              '</tr>'
                                                              '</table>') % (plottable.name(), str(y)))
             elif graph:
                 labels = self.xAxis.tickVectorLabels()
                 label_x = str(labels[int(x)])
                 y = round(y, 2)
                 if not label_x == '':
                     QToolTip.showText(event.globalPos(),
                                       QCoreApplication.translate('MousePlot',
                                                                  '<table>'
                                                                  '<tr>'
                                                                  '<th colspan="2">%s</th>'
                                                                  '</tr>'
                                                                  '<tr>'
                                                                  '<td>%s: %s rub.</td>'
                                                                  '</tr>'
                                                                  '</table>') % (plottable.name(), label_x, str(y)))
     super().mousePressEvent(event)
Пример #21
0
 def mouseReleaseEvent(self, event):
     """鼠标释放"""
     if event.button() == Qt.LeftButton:
         if self.moveOut:
             self.move(self.moveOut)    # 限制到窗口内
             self.moveOut = None
         self._change_image_("normal")
         self.update()
         self.moveCanPlay = False
         if not self.canPlay:    # 移动了,不播放
             self.canPlay = True
             return
         # 只是点击才播放
         self.cindex = self.cindex + 1
         # 当当前序号大于了排除drag的个数或者是当前序号为drag的序号0时,改为1
         if self.cindex > self.player.mediaCount() - 1: self.cindex = 1
         self.player.play(self.cindex)    # 播放
         text = self.player.getText(self.cindex)
         # print(event.globalPos(), self.pos())
         # 解决有父窗口后无父窗口的文字坐标问题(还是解决的不是很好)
         pos = self.pos() + QPoint(0, -50) if not self.parent else event.globalPos() + QPoint(0, -50)
         QToolTip.showText(pos, text, self)
     event.accept()
Пример #22
0
    def itemClickedHandler(self, tree_widget_item: QTreeWidgetItem, column: int):
        # print("I'm click", tree_widget_item.__class__.__name__,
        #       tree_widget_item.isSelected())
        # print("click column", column)

        # 1. handle clicks on check marks to speed things up over using an editor
        if column == LOCKED_COL or column == VISIBLE_COL:
            self.blockSignals(True)
            if tree_widget_item.data(column, Qt.DisplayRole):
                # print("unchecking", tree_widget_item.__class__.__name__)
                tree_widget_item.setData(column, Qt.EditRole, False)
            else:
                # print("checking", tree_widget_item.__class__.__name__)
                tree_widget_item.setData(column, Qt.EditRole, True)
            self.blockSignals(False)
        # end if

        filter_set = self._document.filter_set
        if hasattr(tree_widget_item, "FILTER_NAME") and\
           tree_widget_item.FILTER_NAME not in filter_set:
            rect = self.visualItemRect(tree_widget_item)
            QToolTip.showText(self.mapToGlobal(rect.center()), "Change filter to select")
            return
        self.processSelections()
Пример #23
0
    def show_tool_tip(self, e):
        sum_pos = self.pos()

        parent = self.parent()
        sum_pos += parent.pos()

        grand_parent = parent.parent()
        sum_pos += grand_parent.pos()

        great_grand_parent = grand_parent.parent()
        sum_pos += great_grand_parent.pos()

        great_great_grand_parent = great_grand_parent.parent()
        sum_pos += great_great_grand_parent.pos()

        great_great_great_grand_parent = great_great_grand_parent.parent()
        sum_pos += great_great_great_grand_parent.pos()

        great_great_great_great_grand_parent = great_great_great_grand_parent.parent()
        sum_pos += great_great_great_great_grand_parent.pos()

        sum_pos += QPoint(float(self.width())/2.0, float(self.height())/2.0)

        QToolTip.showText(sum_pos, self.text, self)
Пример #24
0
 def viewportEvent(self, event):
     if event.type() == QEvent.ToolTip:
         pos = event.pos()
         tc = self.cursorForPosition(pos)
         block = tc.block()
         line = block.layout().lineForTextPosition(tc.positionInBlock())
         if line.isValid():
             if pos.x() <= self.blockBoundingRect(block).left() + \
                     line.naturalTextRect().right():
                 column = tc.positionInBlock()
                 line = self.line_from_position(pos.y())
                 checkers = self._neditable.sorted_checkers
                 for items in checkers:
                     checker, _, _ = items
                     messages_for_line = checker.message(line)
                     if messages_for_line is not None:
                         for (start, end), message, content in \
                                 messages_for_line:
                             if column >= start and column <= end:
                                 QToolTip.showText(
                                     self.mapToGlobal(pos), message, self)
                 return True
             QToolTip.hideText()
     return super().viewportEvent(event)
 def refresh_uart2_info(self):
     if self.__uart2State == ON:
         QToolTip.showText(QCursor.pos(),"Please turn off the current device first.")
     else:
         self.uart2_init()
Пример #26
0
 def _sliderCellSizeChanged(self):
     cellSize = self.cellSizeSlider.value()
     self.glyphCellView.setCellSize(cellSize)
     QToolTip.showText(QCursor.pos(), str(cellSize), self)
Пример #27
0
 def enterEvent(self, QEvent):
     self.show = round(self.value() / 1000, self.precision)
     if self.show == int(self.show):
         self.show = int(self.show)
     QToolTip.showText(QtGui.QCursor.pos(), str(self.show), self)
Пример #28
0
 def showIncludeToolTip(self):
     """Show a tooltip with the currently determined include target"""
     QToolTip.showText(QCursor.pos(), '\n'.join(self.include_target))
Пример #29
0
 def mouseMoveEvent(self, e):
     QToolTip.showText(QCursor.pos(), "")
     QToolTip.showText(QCursor.pos(), self.tooltip)
Пример #30
0
 def on_copy(self):
     self.app.clipboard().setText(self.text())
     QToolTip.showText(QCursor.pos(), _("Text copied to clipboard"), self)
Пример #31
0
 def linkHovered(self, link):
     if link:
         QToolTip.showText(QCursor.pos(), Ref.tooltip(link))
Пример #32
0
def copy_to_clipboard(qrw, widget):
    p = qrw and qrw.grab()
    if p and not p.isNull():
        QApplication.clipboard().setPixmap(p)
        QToolTip.showText(QCursor.pos(), _("QR code copied to clipboard"),
                          widget)
Пример #33
0
 def show_tooltip(self, text, position, duration=1000 * 60):
     QToolTip.showText(position, text, self, self.rect(), duration)
 def mouseMoveEvent(self, event):
     QFrame.mouseMoveEvent(self, event)
     x = event.pos().x()
     rating = int(x / self.width() * 5.0) + 1
     QToolTip.showText(QCursor.pos(), str(rating), self)
    def cb_mouse_motion(self, event):
        """
        Callback to process a mouse movement event.

        If the group selection option is enabled, then any points with
        Y-coordinate less than the cursor's Y-coordinate will be marked in a
        different opacity level, but not highlighted. If the user clicks with
        the mouse, then the points will be highlighted, but this event is
        processed in another method.

        This method also processes tooltip-related events when the group
        selection is disabled. If the user hovers the mouse cursor over a data
        point, then the name associated to that point will be shown in a
        tooltip.

        Parameters
        ----------
        event: matplotlib.backend_bases.MouseEvent
            Data about the event.
        """
        # We remove the horizonal line here (if any), regardless of the mouse
        # cursor position. We also restore the points colors.
        if self._hthresh_line:
            lines = self.axes.get_lines()
            for l in lines:
                self.axes.lines.remove(l)
                del l

            self._hthresh_line = None

            for i, p in enumerate(self.axes.collections):
                if i not in self._reference_idx:
                    p.set_facecolor(self._points_colors[i])
            self.draw()

        # Restoring the points' original size.
        if self._point_artists:
            for art in self._point_artists:
                if art is None:
                    continue
                art.set_sizes([self._plot_params['s']])

        if event.xdata is None or event.ydata is None or self._points is None:
            return False
        if self.group_selection_enabled:
            # We must get only the points above the cursor.
            diff = self._points - event.ydata
            above = []
            above = [i for i in reversed(self._yidx_points) if diff[i] >= 0]

            for a in above:
                if a in self._reference_idx:
                    continue
                self.axes.collections[a].set_facecolor(cm.gray(200))

                self._hthresh_line = self.axes.axhline(y=event.ydata,
                                                       c='b',
                                                       linewidth=2)
        else:
            # Testing if the cursor is over a point. If it is, we plot the
            # tooltip and notify this event by calling the registered
            # callback, if any.
            if not self.curvenames:
                return False
            else:
                hover_idx = None
                for i, art in enumerate(self._point_artists):
                    if not art:
                        continue
                    contains, _ = art.contains(event)
                    if contains:
                        art.set_sizes([self._plot_params['s'] * 3])
                        if i > len(self.curvenames):
                            return False
                        hover_idx = i
                        break

                if hover_idx is not None:
                    palette = QPalette()
                    palette.setColor(QPalette.ToolTipBase,
                                     QColor(252, 243, 207))
                    palette.setColor(QPalette.ToolTipText, QColor(0, 0, 0))
                    QToolTip.setPalette(palette)
                    QToolTip.setFont(QFont('Arial', 14, QFont.Bold))
                    pos = self.mapToGlobal(
                        QPoint(event.x,
                               self.height() - event.y))
                    QToolTip.showText(pos,
                                      '{}'.format(self.curvenames[hover_idx]))
                else:
                    QToolTip.hideText()

                if self._cb_notify_tooltip:
                    self._cb_notify_tooltip(self.name, hover_idx)

        self.draw()
Пример #36
0
 def showEmotionTips(self, index):
     if index.isValid():
         QToolTip.showText(QCursor.pos(), "Hello", None)
Пример #37
0
    def _show_tooltip(self, text):

        QToolTip.showText(self.mapToGlobal(QPoint(0, self.height())), text)
Пример #38
0
    def mouseMoveEvent(self, event):
        widgetPosition = self.mapFromGlobal(event.globalPos())
        key = (widgetPosition.y() // self.squareSize) * self.columns + widgetPosition.x() // self.squareSize

        text = '<p>Character: <span style="font-size: 24pt; font-family: %s">%s</span><p>Value: 0x%x' % (self.displayFont.family(), self._chr(key), key)
        QToolTip.showText(event.globalPos(), text, self)
Пример #39
0
 def linkHovered(self, link):
     if link:
         QToolTip.showText(QCursor.pos(), Ref.tooltip(link))
Пример #40
0
    def itemClickedHandler(self, tree_widget_item, column):
        # print("I'm click", tree_widget_item.__class__.__name__,
        #       tree_widget_item.isSelected())
        document = self._document
        model_to_be_selected, model_to_be_deselected = self.model_selection_changes
        # print("click column", column)

        # 1. handle clicks on check marks to speed things up over using an editor
        if column == VISIBLE_COL:
            self.blockSignals(True)
            if tree_widget_item.data(column, Qt.DisplayRole):
                # print("unchecking", tree_widget_item.__class__.__name__)
                tree_widget_item.setData(column, Qt.EditRole, False)
            else:
                # print("checking", tree_widget_item.__class__.__name__)
                tree_widget_item.setData(column, Qt.EditRole, True)
            self.blockSignals(False)
        # end if

        filter_set = self._document.filter_set
        if hasattr(tree_widget_item, "FILTER_NAME") and\
           tree_widget_item.FILTER_NAME not in filter_set:
            rect = self.visualItemRect(tree_widget_item)
            QToolTip.showText(self.mapToGlobal(rect.center()),
                              "Change filter to select")

        # 2. handle document selection
        # self.blockSignals(True)
        if isinstance(tree_widget_item, OutlineNucleicAcidPartItem):
            pass
        elif isinstance(tree_widget_item, OutlineVirtualHelixItem):
            for item in model_to_be_selected:
                if isinstance(item, OutlineVirtualHelixItem):
                    id_num, part = item.idNum(), item.part()
                    is_selected = document.isVirtualHelixSelected(part, id_num)
                    # print("select id_num", id_num, is_selected)
                    if not is_selected:
                        # print("selecting vh", id_num)
                        document.addVirtualHelicesToSelection(part, [id_num])
            model_to_be_selected.clear()
            for item in model_to_be_deselected:
                if isinstance(item, OutlineVirtualHelixItem):
                    id_num, part = item.idNum(), item.part()
                    is_selected = document.isVirtualHelixSelected(part, id_num)
                    # print("de id_num", id_num, is_selected)
                    if is_selected:
                        # print("deselecting vh", id_num)
                        document.removeVirtualHelicesFromSelection(
                            part, [id_num])
            model_to_be_deselected.clear()
        elif isinstance(tree_widget_item, OutlineOligoItem):
            for item in model_to_be_selected:
                if isinstance(item, OutlineOligoItem):
                    m_oligo = item.cnModel()
                    is_selected = document.isOligoSelected(m_oligo)
                    if not is_selected:
                        # print("selecting", m_oligo)
                        document.selectOligo(m_oligo)
            model_to_be_selected.clear()
            for item in model_to_be_deselected:
                if isinstance(item, OutlineOligoItem):
                    m_oligo = item.cnModel()
                    is_selected = document.isOligoSelected(m_oligo)
                    if is_selected:
                        # print("deselecting", m_oligo)
                        document.deselectOligo(m_oligo)
            model_to_be_deselected.clear()
Пример #41
0
 def doTooltip(self, pos, message):
     QToolTip.showText(self.mapToGlobal(pos), message)
Пример #42
0
 def on_copy(self):
     self.app.clipboard().setText(self.text())
     QToolTip.showText(QCursor.pos(), _("Text copied to clipboard"), self)
Пример #43
0
    def mouseMoveEvent(self, event):
        position = event.pos()
        cursor = self.cursorForPosition(position)
        block = cursor.block()
        line = block.layout().lineForTextPosition(cursor.positionInBlock())
        # Only handle tool tip for text cursor if mouse is within the
        # block for the text cursor
        if position.x() <= self.blockBoundingGeometry(block).left() + \
                line.naturalTextRect().right():
            column = cursor.positionInBlock()
            line = self.line_from_position(position.y())
            checkers = self._neditable.sorted_checkers
            for items in checkers:
                checker, _, _ = items
                messages_for_line = checker.message(line)
                if messages_for_line is not None:
                    for (start, end), message, content in messages_for_line:
                        if column >= start and column <= end:
                            QToolTip.showText(self.mapToGlobal(position),
                                              message, self)

        # Go to def link emulation
        if event.modifiers() == Qt.ControlModifier:
            cursor = self.cursorForPosition(event.pos())
            text = self.word_under_cursor(cursor).selectedText()
            block = cursor.block()
            if text and not self.is_keyword(text) and \
                    not self.inside_string_or_comment(cursor):
                start, end = cursor.selectionStart(), cursor.selectionEnd()
                selection = extra_selection.ExtraSelection(cursor,
                                                           start_pos=start,
                                                           end_pos=end)
                link_color = resources.COLOR_SCHEME.get("editor.link.navigate")
                selection.set_underline(link_color, style=1)
                selection.set_foreground(link_color)
                self._extra_selections.add("link", selection)
                self.viewport().setCursor(Qt.PointingHandCursor)
        else:
            self.clear_link()
        # Restore mouse cursor if settings say hide while typing
        if self.viewport().cursor().shape() == Qt.BlankCursor:
            self.viewport().setCursor(Qt.IBeamCursor)
        '''if event.modifiers() == Qt.ControlModifier:
            if self.__link_selection is not None:
                return
            cursor = self.cursorForPosition(event.pos())
            # Check that the mouse was actually on the text somewhere
            on_text = self.cursorRect(cursor).right() >= event.x()
            if on_text:
                cursor.select(QTextCursor.WordUnderCursor)
                selection_start = cursor.selectionStart()
                selection_end = cursor.selectionEnd()
                self.__link_selection = extra_selection.ExtraSelection(
                    cursor,
                    start_pos=selection_start,
                    end_pos=selection_end
                )
                self.__link_selection.set_underline("red")
                self.__link_selection.set_full_width()
                self.add_extra_selection(self.__link_selection)
                self.viewport().setCursor(Qt.PointingHandCursor)'''
        super(NEditor, self).mouseMoveEvent(event)
Пример #44
0
 def show_tip(self):
     QToolTip.showText(self.sender().mapToGlobal(QPoint(30, 20)), markdown_file_to_html('data_augmentation.md'))
Пример #45
0
 def show_tool_tip(self, event):
     QToolTip.showText(
         event.screenPos(), "%s (%s, %s)" %
         (self.name, self.ship_info.position.x, self.ship_info.position.y))
Пример #46
0
 def _on_click_copy_tx_id(self) -> None:
     app_state.app.clipboard().setText(hash_to_hex_str(self._tx_hash))
     QToolTip.showText(QCursor.pos(),
                       _("Transaction ID copied to clipboard"), self)
    def mouseMoveEvent(self, event):
        QToolTip.showText(event.globalPos(), self.toolTip, self)

        return super().mouseMoveEvent(event)
Пример #48
0
 def mouseMoveEvent(self, event: QMouseEvent):
     if isinstance(self.scene(), GridScene):
         freq = self.scene().get_freq_for_pos(int(self.mapToScene(event.pos()).x()))
         if freq is not None:
             QToolTip.showText(self.mapToGlobal(event.pos()), "Tune to:" + Formatter.big_value_with_suffix(freq),
                               None, QRect(), 10000)
Пример #49
0
 def on_clicked_about_threshold_button(self):
     QToolTip.showText(QCursor.pos(),
                       self.ui.about_threshold_button.toolTip())
Пример #50
0
 def sliderChange(self, change: int) -> None:
     """ Show a tooltip with the current numerical value when the slider is moved. """
     if change == self.SliderValueChange:
         global_pos = self.parentWidget().pos() + self.pos()
         QToolTip.showText(global_pos, str(self.value()), self)
     super().sliderChange(change)
Пример #51
0
 def _sliderLineHeightChanged(self, value):
     QToolTip.showText(QCursor.pos(), str(value / 100), self)
Пример #52
0
    def mouseMoveEvent(self, event):
        widgetPosition = self.mapFromGlobal(event.globalPos())
        key = (widgetPosition.y() // self.squareSize) * self.columns + widgetPosition.x() // self.squareSize

        text = '<p>Character: <span style="font-size: 24pt; font-family: %s">%s</span><p>Value: 0x%x' % (self.displayFont.family(), self._chr(key), key)
        QToolTip.showText(event.globalPos(), text, self)
Пример #53
0
    def cb_mouse_motion(self, event):
        """
        Callback to process a mouse movement event.

        If a point is hit by the mouse cursor, we query its index and notify
        the parent object. The parent object must then notify the fanchart (or
        any plot with a time based X axis) in order to highlight the time.

        Parameters
        ----------
        event: matplotlib.backend_bases.MouseEvent
            Data about the event.
        """
        # Restoting the original parameters.
        if self.plot_points:
            for art in self.axes.collections:
                art.set_sizes([self.point_plot_params['s']])
        if self.plot_lines:
            for art in self.axes.lines:
                art.set_linewidth(self.line_plot_params['linewidth'])

        # If the event is outside the axes, we call the timestep callback to
        # notify anyone.
        if event.xdata is None or event.ydata is None:
            if self._cb_notify_timestep:
                self._cb_notify_timestep(self.name, None)
            return False

        if not self._tree:
            return False

        _, idx = self._tree.query(np.array([event.xdata, event.ydata]))

        # Since we need only the time-step, we just take the remainder of the
        # index / number_of_curves, which gives us the timestep selected.
        pidx = math.ceil(idx / self.curves.shape[1]) - 1
        timestep = idx % self.curves.shape[1]

        art = None
        if self.plot_lines:
            art = self.axes.lines
        elif self.plot_points:
            art = self.axes.collections
        if not art:
            return True

        contains, _ = art[pidx].contains(event)

        if contains:
            if self.curvenames:
                if self.plot_points:
                    art = self.axes.collections[pidx]
                    art.set_sizes([self.point_plot_params['s'] * 3])
                if self.plot_lines:
                    art = self.axes.lines[pidx]
                    art.set_linewidth(self.line_plot_params['linewidth'] * 2)

                palette = QPalette()
                palette.setColor(QPalette.ToolTipBase, QColor(252, 243, 207))
                palette.setColor(QPalette.ToolTipText, QColor(0, 0, 0))
                QToolTip.setPalette(palette)
                QToolTip.setFont(QFont('Arial', 14, QFont.Bold))
                pos = self.mapToGlobal(QPoint(event.x,
                                              self.height() - event.y))
                QToolTip.showText(pos, '{}'.format(self.curvenames[pidx]))

                if self._cb_notify_tooltip:
                    self._cb_notify_tooltip(self.name, pidx)

            if self._cb_notify_timestep:
                self._cb_notify_timestep(self.name, timestep + 1)
        else:
            if self._cb_notify_tooltip:
                self._cb_notify_tooltip(self.name, None)
            if self._cb_notify_timestep:
                self._cb_notify_timestep(self.name, None)
            QToolTip.hideText()

        self.draw()
Пример #54
0
 def showTooltip(self, pos, text):
     QToolTip.showText(pos, text)
     self._tooltip['active'] = self._tooltip['depth']
Пример #55
0
    def mouseMoveEvent(self, QMouseEvent):

        # font = textCursor.block().charFormat().font()
        # metrics = QFontMetrics(font)
        #
        # b = self.document().findBlockByLineNumber(0)
        #
        # cursor = QTextCursor(b)
        #
        # cursor.select(QTextCursor.BlockUnderCursor)
        #
        # cursor.removeSelectedText()
        #
        # height = metrics.height() + 2
        # y = QMouseEvent.pos().y()
        #print(y, height)
        #print(y/height)
        cursor_main = self.cursorForPosition(QMouseEvent.pos())
        if QApplication.queryKeyboardModifiers() == Qt.ControlModifier:

            cursor_main.select(QTextCursor.WordUnderCursor)
            text = cursor_main.selectedText()
            self.text = text
            if self.text is not None:
                url = "https://docs.python.org/3/library/functions.html#" + self.text
                word = self.text
                # self.parent.parent.showBrowser(url, word)

                if self.check_func(word):
                    extraSelections = self.highlightCurrentLine()
                    selection = QTextEdit.ExtraSelection()
                    selection.format.setFontUnderline(True)
                    selection.format.setUnderlineColor(QColor("#00d2ff"))
                    selection.format.setForeground(QColor("#00d2ff"))
                    selection.format.setProperty(
                        QTextFormat.FullWidthSelection, True)
                    selection.cursor = self.cursorForPosition(
                        QMouseEvent.pos())
                    selection.cursor.select(QTextCursor.WordUnderCursor)
                    extraSelections.append(selection)
                    self.setExtraSelections(extraSelections)
                    cursor = QCursor(Qt.PointingHandCursor)
                    # tooltip = QToolTip()
                    QToolTip.setFont(
                        QFont(editor["ToolTipFont"],
                              editor["ToolTipFontSize"]))
                    word_shown = eval(word).__doc__

                    if len(word_shown) > 2000:
                        word_shown = word_shown[:2000]

                    QToolTip.showText(QCursor.pos(), "{}".format(word_shown))
                    QApplication.setOverrideCursor(cursor)
                    QApplication.changeOverrideCursor(cursor)
                else:
                    self.returnCursorToNormal()
            else:

                pass
        else:
            self.returnCursorToNormal()
            extraSelections = self.highlightCurrentLine()
            self.setExtraSelections(extraSelections)

        super().mouseMoveEvent(QMouseEvent)
Пример #56
0
 def onReturnNoShift(self):
     QToolTip.showText(
         self.searchLine.mapToGlobal(QPoint(30, self.searchLine.height())),
         iSearchUseShiftReturn(), self.searchLine, QRect(0, 0, 0, 0), 1800)
Пример #57
0
 def enterEvent(self, event):
     QToolTip.showText(event.globalPos(), self.toolTip(), self)
Пример #58
0
 def show_status_message(self, text: str) -> None:
     QToolTip.showText(QCursor.pos(), text)
Пример #59
0
 def _inner_copy_field():
     desktop.copy_to_clipboard(widget.text())
     QToolTip.showText(button.mapToGlobal(QPoint(0, 0)),
                       _("TEXT_INVITE_USER_COPIED_TO_CLIPBOARD"))