Пример #1
0
 def handleMenuHovered(self, action):
     if action.toolTip() != action.iconText():
         # Bypass the default mechanism which displays the action name when
         # the tooltip is not present because it does not add any pertinent information to the user,
         # does not offer the multi-line.
         QToolTip.showText(QCursor.pos(), action.toolTip(), self,
                           self.actionGeometry(action))
 def toolTipEvent(self, e: QtCore.QEvent):
     if not self._completer.popup().isVisible():
         prefix, base, _ = self._textCursorGetText(
             self.cursorForPosition(e.pos()))
         for item in self._command_hints:
             if item['Command'] == prefix + base:
                 QToolTip.showText(e.globalPos(), item['Hint'])
                 break
             else:
                 QToolTip.hideText()
Пример #3
0
    def hoverEnterEvent(self, event):
        """Shows notifications as tool tip.

        Args:
            event (QGraphicsSceneMouseEvent): Event
        """
        if not self._notifications:
            return
        tip = "<p>" + "<p>".join(self._notifications)
        QToolTip.showText(event.screenPos(), tip)
Пример #4
0
    def _on_menu_hovered(self, action, menu):
        if not action.tooltip:
            return

        a_geometry = menu.actionGeometry(action)
        point = menu.mapToGlobal(
            QPoint(a_geometry.x() + 30,
                   a_geometry.y() + 5))
        QToolTip.showText(point, action.tooltip, menu, a_geometry,
                          60 * 60 * 1000)
Пример #5
0
 def _tool_tip(self, command):
     popup = self.popup()
     point = QtCore.QPoint(popup.pos().x() + popup.width(),
                           popup.pos().y() - 16)
     for item in self._command_hints:
         if item['Command'] == command:
             QToolTip.showText(point, item['Hint'])
             break
         else:
             QToolTip.hideText()
Пример #6
0
    def event(self, ev):
        """
        Event filter for generating tool tips.

        :param ev: a QEvent instance.
        :return:
        """
        if ev.type() == QEvent.ToolTip:
            for thread, port, y1, y2 in self.portYCoords:
                if ev.pos().y() >= y1 and ev.pos().y() <= y2:
                    QToolTip.showText(ev.globalPos(),
                                      self.textDescription(thread, port))
            return True
        return super().event(ev)
Пример #7
0
    def event(self, event: QEvent):
        if event.type() == QEvent.ToolTip:
            help_event: QHelpEvent = event
            anchor = self.anchorAt(help_event.pos())
            if anchor:
                tooltip = self._get_tooltip(anchor)
                # html = "<img src='G:/app-data/cc-pim/icons/finn.ico'>Hallo</img>"
                QToolTip.showText(help_event.globalPos(), tooltip)
            else:
                QToolTip.hideText()
                event.ignore()
            return True

        return super().event(event)
Пример #8
0
    def handleItemEntered(self, index):
        """Process event when mouse enters an item and
        create a `QTooltip` which describes the category, with a timer

        Parameter:
            index: a `QModelIndex` instance
        """
        if index.isValid():
            row = index.row()
        else:
            return
        try:
            idString = self.proxyModel.sibling(row, 0, index).data()
        except AttributeError:
            pBLogger.debug("", exc_info=True)
            return
        try:
            idCat, catName = idString.split(": ")
        except AttributeError:
            pBLogger.debug("", exc_info=True)
            return
        idCat = idCat.strip()
        try:
            self.timer.stop()
            QToolTip.showText(QCursor.pos(), "", self.tree.viewport())
        except AttributeError:
            pass
        try:
            catData = pBDB.cats.getByID(idCat)[0]
        except IndexError:
            pBGUILogger.exception(cwstr.failedFind)
            return
        self.timer = QTimer(self)
        self.timer.setSingleShot(True)
        self.timer.timeout.connect(lambda: QToolTip.showText(
            QCursor.pos(),
            cwstr.catId.format(idC=idCat, cat=catData["name"]) + cwstr.
            entriesCorrespondent.format(en=pBDB.catBib.countByCat(idCat)) +
            cwstr.expsAssociated.format(ex=pBDB.catExp.countByCat(idCat)),
            self.tree.viewport(),
            self.tree.visualRect(index),
            3000,
        ))
        self.timer.start(500)
Пример #9
0
    def showTip(self, _):
        if self.isVisible() and self.tipVisible:
            self.initStyleOption(self.opt)
            rectHandle = self.style.subControlRect(self.style.CC_Slider, self.opt, self.style.SC_SliderHandle)

            pos_local = rectHandle.topLeft() + self.offset
            pos_global = self.mapToGlobal(pos_local)
            currentms = self.maxTime * (float(self.value()) / max(self.maximum(), 1))
            currentTime = f"{int(currentms / (1000*60*60)) % 24:02d}:{int(currentms / (1000*60)) % 60:02d}:{(currentms / (1000)) % 60:04.02f} ({self.value()})"
            self.tip = QToolTip.showText(pos_global, currentTime, self)
Пример #10
0
 def showInstructionHelp(self, e):
     super(CodeEditor, self).mouseMoveEvent(e)
     cursor = self.cursorForPosition(e.pos())
     cursor.select(QTextCursor.WordUnderCursor)
     keyword = cursor.selectedText()
     if e.modifiers(
     ) == Qt.ControlModifier and keyword in self.labelPositions:
         self.viewport().setCursor(Qt.PointingHandCursor)
         self.mouseOverLabel(e)
     else:
         if self.previousKeywordFormat['cursor']:
             self.resetActiveLabelFormat()
         if self.viewport().cursor() == Qt.PointingHandCursor:
             self.viewport().setCursor(Qt.IBeamCursor)
     if keyword and keyword in InstructionsInfo.INFO and self.tooltipManager.showInstructionTooltips:
         QToolTip.showText(e.globalPos(), InstructionsInfo.INFO[keyword])
     elif keyword and NumbersInfo.checkIfNumber(
             keyword) and self.tooltipManager.showNumberConversion:
         QToolTip.showText(e.globalPos(),
                           NumbersInfo.showConvertedNumbers(keyword))
     else:
         QToolTip.hideText()
Пример #11
0
    def show_toolTip(self, pos, parent, index):
        '''
        **Parameters**
            pos:    list
                list of all parent widget up to the upmost

            parent: PySide.QtGui.QAction
                the parent QAction

            index:  int
                place within the QMenu, beginning with zero
        '''
        position_x = 0
        position_y = 0
        for widget in pos:
            position_x += widget.pos().x()
            position_y += widget.pos().y()

        point = QtCore.QPoint()
        point.setX(position_x)
        point.setY(position_y + index * 22)  # set y Position of QToolTip
        QToolTip.showText(point, parent.toolTip())
Пример #12
0
    def mousePressEvent(self, event):
        """This handles the definition tooltip (if enabled from the dictionary menu)."""
        if event.button(
        ) == Qt.LeftButton and self._parent._definition_tool_tips:
            cursor = self.cursorForPosition(event.pos())
            cursor.select(QTextCursor.WordUnderCursor)
            self.setTextCursor(cursor)
            word = cursor.selectedText()
            cursor.clearSelection()
            self.setTextCursor(cursor)
            tool_tip = QToolTip()

            if word.isalpha():
                word = self.formatWordForDictionary(word)
                if word in self.getWords():
                    definition = self._database.getDefinition(word[0], word)
                    if definition != None and len(definition):
                        tool_tip.showText(event.globalPos(),
                                          "<b><u>" + word + "</u></b> - " +
                                          definition,
                                          msecShowTime=90000)

        return super().mousePressEvent(event)
Пример #13
0
    def handleItemEntered(self, index):
        """Process event when mouse enters an item and
        create a `QTooltip` which describes the category, with a timer

        Parameter:
            index: a `QModelIndex` instance
        """
        if index.isValid():
            row = index.row()
        else:
            return
        idExp = str(self.proxyModel.sibling(row, 0, index).data())
        try:
            self.timer.stop()
            QToolTip.showText(QCursor.pos(), "", self.tableview.viewport())
        except AttributeError:
            pass
        try:
            expData = pBDB.exps.getByID(idExp)[0]
        except IndexError:
            pBGUILogger.exception(ewstr.failedFind)
            return
        self.timer = QTimer(self)
        self.timer.setSingleShot(True)
        self.timer.timeout.connect(
            lambda: QToolTip.showText(
                QCursor.pos(),
                ewstr.expId.format(idE=idExp, exp=expData["name"])
                + ewstr.entriesCorrespondent.format(en=pBDB.bibExp.countByExp(idExp))
                + ewstr.catsAssociated.format(ca=pBDB.catExp.countByExp(idExp)),
                self.tableview.viewport(),
                self.tableview.visualRect(index),
                3000,
            )
        )
        self.timer.start(500)
Пример #14
0
 def hoverEnterEvent(self, event):
     tip = (
         f"<p><b>Execution {self._execution_state}</b>. Select to see messages in Event Log and Process Output.</p>"
     )
     QToolTip.showText(event.screenPos(), tip)
Пример #15
0
 def mouse_move_event(self, model, event: QMouseEvent):
     if self.common_model.show_cursor_position:
         QToolTip.showText(event.globalPos(),
                           f"{event.globalPos().x()}, {event.globalPos().y()}")
     return True
Пример #16
0
 def f2(e, p, q):
     self.currentPb = p / float(self.bSliderWidth)
     self.graphicsScene.slider2D.QImg.setPb(self.currentPb)
     self.graphicsScene.slider2D.setPixmap(self.graphicsScene.slider2D.QImg.rPixmap)
     QToolTip.showText(e.screenPos(), (str(int(self.currentPb * 100.0))), self)
Пример #17
0
 def hoverEnterEvent(self, event):
     tip = f"<p><b>Execution {self._execution_state}</b>. Select this item to see Console and Log messages.</p>"
     QToolTip.showText(event.screenPos(), tip)
Пример #18
0
    def event(self, event):
        if event.type() == QEvent.ToolTip:
            QToolTip.showText(event.globalPos(), self.toolTip())
            return True

        return super(QAbstractButton, self).event(event)
Пример #19
0
 def f2(e, p, q):
     self.currentPb = p / float(self.bSliderWidth)
     QToolTip.showText(e.screenPos(), (str(int(self.currentPb * 100.0))), self)
 def copyAddress(self, address):
     QToolTip.showText(QCursor.pos(),
                       "Address %s has been copied to clipboard!" % address)
     clipboard = QApplication.clipboard()
     clipboard.setText(address)
Пример #21
0
 def mouseMoveEvent(self, evt):
     QGraphicsView.mouseMoveEvent(self, evt)
     # implement a real time tooltip
     item = self.itemAt(evt.pos())
     if item:
         QToolTip.showText(evt.globalPos(), str(item))
Пример #22
0
 def _analysisNameError(self):
     text = "Caractères autorisés : alphanumérique, espace, #, - et _\nLongueur maximale : 30 caractères"
     QToolTip.showText(
         self._name_text.mapToGlobal(QPoint()) +
         self._name_text.cursorRect().topLeft(), text, self)
Пример #23
0
 def copy(self, item):
     QApplication.clipboard().setText(item.text())
     QToolTip.showText(QCursor.pos(),
                       self.tr('Cell contents copied to clipboard'), self,
                       QRect(), 3000)