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)
def mouseMoveEvent(self, event): position = event.pos() cursor = self.cursorForPosition(position) block = cursor.block() checkers = self._neditable.sorted_checkers for items in checkers: checker, color, _ = items if block.blockNumber() in checker.checks: message = checker.checks[block.blockNumber()][0] QToolTip.showText(self.mapToGlobal(position), message, self) if event.modifiers() == Qt.ControlModifier: cursor.select(QTextCursor.WordUnderCursor) selection_start = cursor.selectionStart() selection_end = cursor.selectionEnd() cursor.setPosition(selection_start - 1) cursor.setPosition(selection_end + 1, QTextCursor.KeepAnchor) if cursor.selectedText()[-1:] in ('(', '.') or \ cursor.selectedText()[:1] in ('.', '@'): self.extraSelections = [] selection = QTextEdit.ExtraSelection() lineColor = QColor( resources.CUSTOM_SCHEME.get( 'linkNavigate', resources.COLOR_SCHEME['linkNavigate'])) selection.format.setForeground(lineColor) selection.format.setFontUnderline(True) selection.cursor = cursor self.extraSelections.append(selection) self.setExtraSelections(self.extraSelections) else: self.extraSelections = [] self.setExtraSelections(self.extraSelections) QPlainTextEdit.mouseMoveEvent(self, event)
def mouseMoveEvent(self, event): super(Editor, self).mouseMoveEvent(event) position = event.pos() line = str(self.lineAt(position) + 1) message = self.checker.data.get(line, None) if message is not None: QToolTip.showText(self.mapToGlobal(position), message)
def show_calltip(self, title, text, color='#2D62FF', at_line=None): """ Show calltip This is here because QScintilla does not implement well calltips """ if text is None or len(text) == 0: return weight = 'bold' if self.calltip_font.bold() else 'normal' size = self.calltip_font.pointSize() family = self.calltip_font.family() format1 = '<div style=\'font-size: %spt; color: %s\'>' % (size, color) format2 = '<hr><div style=\'font-family: "%s"; font-size: %spt; font-weight: %s\'>' % (family, size, weight) if isinstance(text, list): text = "\n ".join(text) text = text.replace('\n', '<br>') if len(text) > self.calltip_size: text = text[:self.calltip_size] + " ..." tiptext = format1 + ('<b>%s</b></div>' % title) \ + format2 + text + "</div>" # Showing tooltip at cursor position: cx, cy = self.get_coordinates('cursor') if at_line is not None: cx = 5 _, cy = self.__get_coordinates_from_lineindex(at_line-1, 0) QToolTip.showText(self.mapToGlobal(QPoint(cx, cy)), tiptext) # Saving cursor position: self.calltip_position = self.get_position('cursor')
def motor(self): """ Modifie l'angle des moteurs a partir de ceux qui ont été changé. Affiche la valeur de l'angle actuel dans le ToolTip """ #récupère le moteur qui a bougé if self.thread_code.isRunning(): return nb=self.hasChanged() if not self.boolOmbre: self.boolOmbre= not self.boolOmbre return sliderEq = ALProxy.getKeys() if self.sliderAxis[nb]!=3: #maj le bon trouvé self.virtualNao.getMembre(sliderEq[nb][:-1]).setAngleFromPercent(self.sliderAxis[nb],self.sliders[nb].value()) QToolTip.showText(self.cursor.pos(),str(self.sliders[nb].value())) else : self.virtualNao.getMembre("hancheD").setAngleFromPercentList([self.horizontalSliderHanche15.value(),0,self.horizontalSliderHanche15.value()]) self.virtualNao.getMembre("hancheG").setAngleFromPercentList([self.horizontalSliderHanche15.value(),0,self.horizontalSliderHanche15.value()]) QToolTip.showText(self.cursor.pos(),str(self.horizontalSliderHanche15.value())) self.virtualNao.getMembre("doigt3D").setAngleFromPercent(0,100-self.horizontalSliderDoigtsD0.value()) self.virtualNao.getMembre("doigt2D").setAngleFromPercent(0,100-self.horizontalSliderDoigtsD0.value()) self.virtualNao.getMembre("doigt1D").setAngleFromPercent(0,100)#=fixe self.virtualNao.getMembre("doigt3G").setAngleFromPercent(0,100-self.horizontalSliderDoigtsG0.value()) self.virtualNao.getMembre("doigt2G").setAngleFromPercent(0,100-self.horizontalSliderDoigtsG0.value()) self.virtualNao.getMembre("doigt1G").setAngleFromPercent(0,100)#=fixe self.updatePhysics() self.Viewer3DWidget.update()
def mouseMoveEvent(self, event): position = event.pos() cursor = self.cursorForPosition(position) block = cursor.block() if settings.ERRORS_HIGHLIGHT_LINE and \ (block.blockNumber()) in self.errors.errorsSummary: message = '\n'.join( self.errors.errorsSummary[block.blockNumber()]) QToolTip.showText(self.mapToGlobal(position), message, self) elif settings.CHECK_HIGHLIGHT_LINE and \ (block.blockNumber()) in self.pep8.pep8checks: message = '\n'.join( self.pep8.pep8checks[block.blockNumber()]) QToolTip.showText(self.mapToGlobal(position), message, self) if event.modifiers() == Qt.ControlModifier: cursor.select(QTextCursor.WordUnderCursor) cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor) if cursor.selectedText().endsWith('(') or \ cursor.selectedText().endsWith('.'): cursor.movePosition(QTextCursor.Left, QTextCursor.KeepAnchor) self.extraSelections = [] selection = QTextEdit.ExtraSelection() lineColor = QColor(resources.CUSTOM_SCHEME.get('linkNavigate', resources.COLOR_SCHEME['linkNavigate'])) selection.format.setForeground(lineColor) selection.format.setFontUnderline(True) selection.cursor = cursor self.extraSelections.append(selection) self.setExtraSelections(self.extraSelections) else: self.extraSelections = [] self.setExtraSelections(self.extraSelections) QPlainTextEdit.mouseMoveEvent(self, event)
def custom_mouse_movement(event): try: # If no thread is selected, just ignore the move thread_id = self.get_active_thread() if not thread_id: return pos = event.pos() c = editor_widget.cursorForPosition(pos) filepath = os.path.abspath(self.editor.get_editor_path()) if filepath not in self.sym_finder: finder = debugger_plugin.core.symbols.SymbolFinder(open(filepath).read()) finder.parse() self.sym_finder[filepath] = finder else: finder = self.sym_finder[filepath] sym = finder.get(c.blockNumber()+1, c.columnNumber()) if sym is not None: ret = self.debugger_adapter.evaluate(thread_id, sym.expression, depth=0) content = "{exp} = ({type}) {value}".format( exp=sym.expression, type=ret['type'], value=ret['value']) QToolTip.showText(editor_widget.mapToGlobal(pos), content) finally: self.__old_mouse_event(event)
def showMethodToolTip( self ): """ Pops up a tooltip message with the help for the object under the \ cursor. :return <bool> success """ self.cancelCompletion() obj = self.objectAtCursor() if ( not obj ): return False docs = inspect.getdoc(obj) if ( not docs ): return False # determine the cursor position rect = self.cursorRect() cursor = self.textCursor() point = QPoint(rect.left(), rect.top() + 18) QToolTip.showText( self.mapToGlobal(point), docs, self ) return True
def mouseMoveEvent(self, event): position = event.pos() cursor = self.cursorForPosition(position) block = cursor.block() checkers = sorted(self._neditable.registered_checkers, key=lambda x: x[2], reverse=True) for items in checkers: checker, color, _ = items if block.blockNumber() in checker.checks: message = '\n'.join(checker.checks[block.blockNumber()]) QToolTip.showText(self.mapToGlobal(position), message, self) if event.modifiers() == Qt.ControlModifier: cursor.select(QTextCursor.WordUnderCursor) selection_start = cursor.selectionStart() selection_end = cursor.selectionEnd() cursor.setPosition(selection_start - 1) cursor.setPosition(selection_end + 1, QTextCursor.KeepAnchor) if cursor.selectedText()[-1:] in ('(', '.') or \ cursor.selectedText()[:1] in ('.', '@'): self.extraSelections = [] selection = QTextEdit.ExtraSelection() lineColor = QColor(resources.CUSTOM_SCHEME.get('linkNavigate', resources.COLOR_SCHEME['linkNavigate'])) selection.format.setForeground(lineColor) selection.format.setFontUnderline(True) selection.cursor = cursor self.extraSelections.append(selection) self.setExtraSelections(self.extraSelections) else: self.extraSelections = [] self.setExtraSelections(self.extraSelections) QPlainTextEdit.mouseMoveEvent(self, event)
def showMethodToolTip(self): """ Pops up a tooltip message with the help for the object under the \ cursor. :return <bool> success """ self.cancelCompletion() obj = self.objectAtCursor() if (not obj): return False docs = inspect.getdoc(obj) if (not docs): return False # determine the cursor position rect = self.cursorRect() cursor = self.textCursor() point = QPoint(rect.left(), rect.top() + 18) QToolTip.showText(self.mapToGlobal(point), docs, self) return True
def mouseMoveEvent(self, event): position = event.pos() cursor = self.cursorForPosition(position) block = cursor.block() if settings.ERRORS_HIGHLIGHT_LINE and \ (block.blockNumber()) in self.errors.errorsSummary: message = '\n'.join(self.errors.errorsSummary[block.blockNumber()]) QToolTip.showText(self.mapToGlobal(position), message, self) elif settings.CHECK_HIGHLIGHT_LINE and \ (block.blockNumber()) in self.pep8.pep8checks: message = '\n'.join(self.pep8.pep8checks[block.blockNumber()]) QToolTip.showText(self.mapToGlobal(position), message, self) if event.modifiers() == Qt.ControlModifier: cursor.select(QTextCursor.WordUnderCursor) cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor) if cursor.selectedText().endsWith('(') or \ cursor.selectedText().endsWith('.'): cursor.movePosition(QTextCursor.Left, QTextCursor.KeepAnchor) self.extraSelections = [] selection = QTextEdit.ExtraSelection() lineColor = QColor( resources.CUSTOM_SCHEME.get( 'linkNavigate', resources.COLOR_SCHEME['linkNavigate'])) selection.format.setForeground(lineColor) selection.format.setFontUnderline(True) selection.cursor = cursor self.extraSelections.append(selection) self.setExtraSelections(self.extraSelections) else: self.extraSelections = [] self.setExtraSelections(self.extraSelections) QPlainTextEdit.mouseMoveEvent(self, event)
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)
def help_event(self, event): if self.scatterplot_item is None: return False act_pos = self.scatterplot_item.mapFromScene(event.scenePos()) points = self.scatterplot_item.pointsAt(act_pos) text = "" if len(points): for i, p in enumerate(points): index = p.data() text += "Attributes:\n" if self.tooltip_shows_all: text += "".join(' {} = {}\n'.format( attr.name, self.raw_data[index][attr]) for attr in self.data_domain.attributes) else: text += ' {} = {}\n {} = {}\n'.format( self.shown_x, self.raw_data[index][self.shown_x], self.shown_y, self.raw_data[index][self.shown_y]) if self.data_domain.class_var: text += 'Class:\n {} = {}\n'.format( self.data_domain.class_var.name, self.raw_data[index][self.raw_data.domain.class_var]) if i < len(points) - 1: text += '------------------\n' text = ('<span style="white-space:pre">{}</span>'.format( escape(text))) QToolTip.showText(event.screenPos(), text, widget=self.plot_widget) return True else: return False
def custom_mouse_movement(event): try: # If no thread is selected, just ignore the move thread_id = self.get_active_thread() if not thread_id: return pos = event.pos() c = editor_widget.cursorForPosition(pos) filepath = os.path.abspath(self.editor.get_editor_path()) if filepath not in self.sym_finder: finder = debugger_plugin.core.symbols.SymbolFinder( open(filepath).read()) finder.parse() self.sym_finder[filepath] = finder else: finder = self.sym_finder[filepath] sym = finder.get(c.blockNumber() + 1, c.columnNumber()) if sym is not None: ret = self.debugger_adapter.evaluate(thread_id, sym.expression, depth=0) content = "{exp} = ({type}) {value}".format( exp=sym.expression, type=ret['type'], value=ret['value']) QToolTip.showText(editor_widget.mapToGlobal(pos), content) finally: self.__old_mouse_event(event)
def show_calltip(self, title, text, color='#2D62FF', at_line=None, at_position=None): """Show calltip""" if text is None or len(text) == 0: return # Saving cursor position: if at_position is None: at_position = self.get_position('cursor') self.calltip_position = at_position # Preparing text: weight = 'bold' if self.calltip_font.bold() else 'normal' size = self.calltip_font.pointSize() family = self.calltip_font.family() format1 = '<div style=\'font-size: %spt; color: %s\'>' % (size, color) format2 = '<hr><div style=\'font-family: "%s"; font-size: %spt; font-weight: %s\'>' % (family, size, weight) if isinstance(text, list): text = "\n ".join(text) text = text.replace('\n', '<br>') if len(text) > self.calltip_size: text = text[:self.calltip_size] + " ..." tiptext = format1 + ('<b>%s</b></div>' % title) \ + format2 + text + "</div>" # Showing tooltip at cursor position: cx, cy = self.get_coordinates('cursor') if at_line is not None: cx = 5 cursor = QTextCursor(self.document().findBlockByNumber(at_line-1)) cy = self.cursorRect(cursor).top() point = self.mapToGlobal(QPoint(cx, cy)) point.setX(point.x()+self.get_linenumberarea_width()) QToolTip.showText(point, tiptext)
def help_event(self, event): if self.scatterplot_item is None: return False act_pos = self.scatterplot_item.mapFromScene(event.scenePos()) points = self.scatterplot_item.pointsAt(act_pos) text = "" if len(points): for i, p in enumerate(points): index = p.data() text += "Attributes:\n" if self.tooltip_shows_all: text += "".join( ' {} = {}\n'.format(attr.name, self.raw_data[index][attr]) for attr in self.data_domain.attributes) else: text += ' {} = {}\n {} = {}\n'.format( self.shown_x, self.raw_data[index][self.shown_x], self.shown_y, self.raw_data[index][self.shown_y]) if self.data_domain.class_var: text += 'Class:\n {} = {}\n'.format( self.data_domain.class_var.name, self.raw_data[index][self.raw_data.domain.class_var]) if i < len(points) - 1: text += '------------------\n' text = ('<span style="white-space:pre">{}</span>' .format(escape(text))) QToolTip.showText(event.screenPos(), text, widget=self.plot_widget) return True else: return False
def mouseMoveEvent(self, event): position = event.pos() line = self.lineAt(position) checkers = self._neditable.sorted_checkers for items in checkers: checker, color, _ = items message = checker.message(line) if message: QToolTip.showText(self.mapToGlobal(position), message, self) if event.modifiers() == Qt.ControlModifier: self._navigation_highlight_active = True word = self.wordAtPoint(position) self.SendScintilla(QsciScintilla.SCI_SETINDICATORCURRENT, self.__indicator_navigation) self.SendScintilla(QsciScintilla.SCI_INDICATORCLEARRANGE, 0, len(self.text())) text = self.text() word_length = len(word) index = text.find(word) while index != -1: self.SendScintilla(QsciScintilla.SCI_INDICATORFILLRANGE, index, word_length) index = text.find(word, index + 1) elif self._navigation_highlight_active: self._navigation_highlight_active = False self.SendScintilla(QsciScintilla.SCI_SETINDICATORCURRENT, self.__indicator_navigation) self.SendScintilla(QsciScintilla.SCI_INDICATORCLEARRANGE, 0, len(self.text())) super(Editor, self).mouseMoveEvent(event)
def show_calltip(self, title, text, color='#2D62FF', at_line=None): """ Show calltip This is here because QScintilla does not implement well calltips """ if text is None or len(text)==0: return weight = 'bold' if self.calltip_font.bold() else 'normal' size = self.calltip_font.pointSize() family = self.calltip_font.family() format1 = '<div style=\'font-size: %spt; color: %s\'>' % (size, color) format2 = '<hr><div style=\'font-family: "%s"; font-size: %spt; font-weight: %s\'>' % (family, size, weight) if isinstance(text, list): text = "\n ".join(text) else: text = text.replace('\n', '<br>') if len(text) > self.calltip_size: text = text[:self.calltip_size] + " ..." tiptext = format1 + ('<b>%s</b></div>' % title) \ + format2 + text + "</div>" # Showing tooltip at cursor position: cx, cy = self.get_coordinates('cursor') if at_line is not None: #TODO: this code has not yet been ported to QPlainTextEdit because it's # only used in editor widgets which are based on QsciScintilla cx = 5 cursor = self.textCursor() block = self.document().findBlockByNumber(at_line-1) cursor.setPosition(block.position()) cy = self.cursorRect(cursor).top() QToolTip.showText(self.mapToGlobal(QPoint(cx, cy)), tiptext) # Saving cursor position: self.calltip_position = self.get_position('cursor')
def show_calltip(self, title, text, color='#2D62FF', at_line=None): """ Show calltip This is here because QScintilla does not implement well calltips """ if text is None or len(text)==0: return weight = 'bold' if self.calltip_font.bold() else 'normal' size = self.calltip_font.pointSize() family = self.calltip_font.family() format1 = '<div style=\'font-size: %spt; color: %s\'>' % (size, color) format2 = '<hr><div style=\'font-family: "%s"; font-size: %spt; font-weight: %s\'>' % (family, size, weight) if isinstance(text, list): text = "\n ".join(text) else: text = text.replace('\n', '<br>') if len(text) > self.calltip_size: text = text[:self.calltip_size] + " ..." tiptext = format1 + ('<b>%s</b></div>' % title) \ + format2 + text + "</div>" # Showing tooltip at cursor position: cx, cy = self.get_coordinates('cursor') if at_line is not None: #TODO: this code has not yet been ported to QTextEdit because it's # only used in editor widgets which are based on QsciScintilla raise NotImplementedError # cx = 5 # _, cy = self.__get_coordinates_from_lineindex(at_line, 0) QToolTip.showText(self.mapToGlobal(QPoint(cx, cy)), tiptext) # Saving cursor position: self.calltip_position = self.get_position('cursor')
def mouseMoveEvent(self, mouseEvent): """ Override so that the tool tip can be shown immediately. :param mouseEvent: Mouse move event :type mouseEvent: QMouseEvent """ QToolTip.showText(mouseEvent.globalPos(), self._user_tip, self)
def show_swatch(self, view): '''Shows the swatch if a valid color is selected''' if view.selection(): color = QColor(view.selectionText()) if color.isValid(): cursor_pos = view.cursorPositionCoordinates() QToolTip.showText(cursor_pos, self.swatch_template) self.change_palette(color)
def event(self, e): if e.type() == QEvent.ToolTip: # show action tooltip instead of widget tooltip act = self.actionAt(e.pos()) if act and act.toolTip() != "None": QToolTip.showText(e.globalPos(), act.toolTip(), self) return True return QMenu.event(self, e)
def mouseMoveEvent(self, event): '''Get the current mouse position and redraw the selection''' self.current_x = event.globalX() self.current_y = event.globalY() self.repaint() text = "Start: %sx%s \nEnd: %sx%s" % (self.start_x, self.start_y, self.current_x, self.current_y) QToolTip.showText(event.pos(), text)
def show_swatch(self, view): """Shows the swatch if a valid color is selected""" if view.selection(): color = QColor(view.selectionText()) if color.isValid(): cursor_pos = view.cursorPositionCoordinates() QToolTip.showText(cursor_pos, self.swatch_template) self.change_palette(color)
def dwellStart(self, pos, x, y): if self.edit.frameGeometry().contains(x, y): name = self.getWordOrSelectionFromPosition(pos) val = self.debugController.evaluateExpression(name.strip()) if val != None: name = cgi.escape(name) val = cgi.escape(val) QToolTip.showText(self.edit.mapToGlobal(QtCore.QPoint(x, y)), "<b>" + name + "</b> = " + val, self.edit, QtCore.QRect())
def event(self, e): if e.type() == QEvent.ToolTip: # show action tooltip instead of widget tooltip act = self.actionAt(e.pos()); if act and act.toolTip() != "None": QToolTip.showText(e.globalPos(), act.toolTip(), self) return True return QMenu.event(self, e)
def resolutionSliderChanged(self, v): self.updateDEMSize() # size = 100 * self.horizontalSlider_DEMSize.value() # QToolTip.showText(self.horizontalSlider_DEMSize.mapToGlobal(QPoint(0, 0)), "about {0} x {0}".format(size), self.horizontalSlider_DEMSize) size = 100 * self.horizontalSlider_Resolution.value() QToolTip.showText( self.horizontalSlider_Resolution.mapToGlobal(QPoint(0, 0)), "about {0} x {0}".format(size), self.horizontalSlider_Resolution)
def showInformationToolTip(self, idx): """ Show an informative string about one sample """ sample = self.model.sample(idx.data().toString(), fullNameEntry=False) if sample is None: return QToolTip.showText(QCursor.pos(), sample.getInfos())
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)
def mouseMoveEvent(self, event): super(Editor, self).mouseMoveEvent(event) if self.checker is None: return position = event.pos() line = str(self.lineAt(position) + 1) message = self.checker.data.get(line, None) if message is not None: QToolTip.showText(self.mapToGlobal(position), message)
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)
def mouseMoveEvent(self, event): QToolTip.showText( event.globalPos(), 'Block logic expects pumps and valves to always\n' 'have two junctions at their endpoints.\n' 'The pump or valve, together with the two junctions,\n' 'are then considered as a single block, and they are\n' 'moved jointly when using the "Move element tool".', self, self.rect())
def show_swatch(self, view): '''Shows the swatch if a valid color is selected''' if view.selection(): color = QColor(view.selectionText()) if color.isValid(): cursor_pos = view.mapToGlobal(view.cursorPositionCoordinates()) QToolTip.showText(cursor_pos, ColorSwatcher._SWATCH_TEMPLATE) self.change_palette(color) else: QToolTip.hideText()
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)
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, popplerqt4.Poppler.LinkBrowse): QToolTip.showText(globalPos, link.url(), self, page.linkRect(link.linkArea())) self.linkHelpRequested.emit(globalPos, page, link)
def _show_tool_tip(self): # Show a tool tip based on the mouse position mouse_line = self._mouse_margin_line() if mouse_line == -1: return for syntax_error in self._syntax_errors: if syntax_error.lineno - 1 == mouse_line: QToolTip.showText(self._global_mouse_position, QString(syntax_error.msg))
def showToolTip(self): """ """ self.timerMapTips.stop() if self.canvas.underMouse(): raster = self.parent.rasterComboBox.currentLayer() if raster: text = self.getPixelValue(raster) p = self.canvas.mapToGlobal( self.canvas.mouseLastXY() ) QToolTip.showText( p, text, self.canvas )
def linkHovered(self, link, title, textContent): """ Overload function. Show tooltip when hovered. # ToFix: tooltip disappear too soon. """ #self.setToolTip(link) if link: self.flag = True self.link = link QToolTip.showText(QCursor.pos(), self.link) else: self.flag = False
def __showRevisionTooltip( self, position, x, y ): # Calculate the line pos = self.SendScintilla( self.SCI_POSITIONFROMPOINT, x, y ) line, posInLine = self.lineIndexFromPosition( pos ) tooltip = self.__getRevisionMarginTooltip( line ) if not tooltip: return QToolTip.showText( self.mapToGlobal( QPoint( x, y ) ), tooltip ) self.__revisionTooltipShown = True return
def showToolTip(self, qgsPoint): """ """ self.timerMapTips.stop() self.timerMapTips.start( 6000 ) # time in milliseconds if self.canvas.underMouse(): raster = self.rasterComboBox.currentLayer() if raster: text = self.getPixelValue(qgsPoint, raster) p = self.canvas.mapToGlobal( self.canvas.mouseLastXY() ) QToolTip.showText( p, text, self.canvas )
def help_event(self, ev): in_graph_coor = self.plot.mapSceneToView(ev.scenePos()) ctooltip = [] for vb, item in self.tooltip_items: if isinstance(item, pg.PlotCurveItem) and item.mouseShape().contains(vb.mapSceneToView(ev.scenePos())): ctooltip.append(item.tooltip) elif isinstance(item, DistributionBarItem) and item.boundingRect().contains(vb.mapSceneToView(ev.scenePos())): ctooltip.append(item.tooltip) if ctooltip: QToolTip.showText(ev.screenPos(), "\n\n".join(ctooltip), widget=self.plotview) return True return False
def __showRevisionTooltip(self, position, x, y): # Calculate the line pos = self.SendScintilla(self.SCI_POSITIONFROMPOINT, x, y) line, posInLine = self.lineIndexFromPosition(pos) tooltip = self.__getRevisionMarginTooltip(line) if not tooltip: return QToolTip.showText(self.mapToGlobal(QPoint(x, y)), tooltip) self.__revisionTooltipShown = True return
def draw(self): # A standard value just displays the value that you have been dragging. if not self.negative: v = str(self.value) # When the value is negative, we don't display a double negative, # but a positive. elif self.value < 0: v = str(abs(self.value)) # When the value is positive, we have to add a minus sign. else: v = "-" + str(self.value) QToolTip.showText(self.viewPoint, v)
def __showTimestampTooltip(self, position, x, y): " Shows a tooltip on the timestamp margin " # Calculate the line pos = self.SendScintilla(self.SCI_POSITIONFROMPOINT, x, y) line, _ = self.lineIndexFromPosition(pos) tooltip = self.__getTimestampMarginTooltip(line) if not tooltip: return QToolTip.showText(self.mapToGlobal(QPoint(x, y)), tooltip) self.__timestampTooltipShown = True return
def event(self, e): if e.type() != QEvent.ToolTip: return QWidget.event(self, e) for v in self.vertices.keys(): rect = self.vertices[v] if rect.contains(e.pos()): txt = v.id for p in v.params.values(): txt += "\n" + p.name + "=" + p.value + " " + p.unit QToolTip.showText(e.globalPos(), txt) return True e.ignore() return True
def hoverEnterEvent(self, event): """ Processes when this hotspot is entered. :param event | <QHoverEvent> :return <bool> | processed """ self._hovered = True if self.toolTip(): QToolTip.showText(QCursor.pos(), self.toolTip()) return True return self.style() == XNodeHotspot.Style.Icon
def motor(self): """ Modifie l'angle des moteurs a partir de ceux qui ont été changé. Affiche la valeur de l'angle actuel dans le ToolTip """ #récupère le moteur qui a bougé if self.thread_code.isRunning(): return nb = self.hasChanged() if not self.boolOmbre: self.boolOmbre = not self.boolOmbre return sliderEq = ALProxy.getKeys() if self.sliderAxis[nb] != 3: #maj le bon trouvé self.virtualNao.getMembre(sliderEq[nb][:-1]).setAngleFromPercent( self.sliderAxis[nb], self.sliders[nb].value()) QToolTip.showText(self.cursor.pos(), str(self.sliders[nb].value())) else: self.virtualNao.getMembre("hancheD").setAngleFromPercentList([ self.horizontalSliderHanche15.value(), 0, self.horizontalSliderHanche15.value() ]) self.virtualNao.getMembre("hancheG").setAngleFromPercentList([ self.horizontalSliderHanche15.value(), 0, self.horizontalSliderHanche15.value() ]) QToolTip.showText(self.cursor.pos(), str(self.horizontalSliderHanche15.value())) self.virtualNao.getMembre("doigt3D").setAngleFromPercent( 0, 100 - self.horizontalSliderDoigtsD0.value()) self.virtualNao.getMembre("doigt2D").setAngleFromPercent( 0, 100 - self.horizontalSliderDoigtsD0.value()) self.virtualNao.getMembre("doigt1D").setAngleFromPercent(0, 100) #=fixe self.virtualNao.getMembre("doigt3G").setAngleFromPercent( 0, 100 - self.horizontalSliderDoigtsG0.value()) self.virtualNao.getMembre("doigt2G").setAngleFromPercent( 0, 100 - self.horizontalSliderDoigtsG0.value()) self.virtualNao.getMembre("doigt1G").setAngleFromPercent(0, 100) #=fixe self.updatePhysics() self.Viewer3DWidget.update()
def slotLinkHelpRequested(self, pos, page, link): """Called when a ToolTip wants to appear above the hovered link.""" if isinstance(link, popplerqt4.Poppler.LinkBrowse): cursor = self._links.cursor(link) if cursor: from . import tooltip text = tooltip.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()))
def mouseMoveEvent(self, event): dx = event.x() - self.lastpos.x() dy = event.y() - self.lastpos.y() if self.mode == "ZOOMING": font = QFont("Typewriter") self.renderText(-self.corner_ - 30.0, self.corner_, 0., "ZOOMING MODE ACTIVATED", font) self.updateGL() glColor(0., 0., 1., .5) XMAX = 900. XMIN = 180. pointer_x = (self.lastpos.x() * 200.) / XMAX norm_dx = (dx * 200.) / XMAX """ if pointer_x > 100. or pointer_x < 100. \ or norm_dx >100. or norm_dx<-100.: event.ignore() """ glBegin(GL_QUADS) glVertex2d(pointer_x, -100.) glVertex2d(pointer_x + norm_dx, -100.) glVertex2d(pointer_x + norm_dx, 100.) glVertex2d(pointer_x, 100.) glEnd() self.updateGL() #update for seeing the rectangle mapping = self.mapFromGlobal cursorPos = self.inGLCoordinate(mapping(self.cursor().pos())) QToolTip.showText(self.cursor().pos(), "x:"+str(cursorPos.x())+ \ ", y:"+str(cursorPos.y()) ) if self.mode == "None": if event.buttons() == Qt.LeftButton: self.trans_y_ -= dy / 5 self.counter_trans_y -= dy / 5 self.trans_x_ += dx / 5 self.counter_trans_x += dx / 5 self.lastpos = QPoint(event.pos()) self.glDraw() self.resetTranslations()
def showMapTip(self): self.timerMapTips.stop() if self.canvas.underMouse(): rLayer = self.iface.activeLayer() if type(rLayer) is QgsRasterLayer: ident = rLayer.dataProvider().identify( self.toMapCoordinates(self.canvas.mouseLastXY()), QgsRaster.IdentifyFormatValue) if ident.isValid(): text = ", ".join([ '{0:g}'.format(r) for r in ident.results().values() if r is not None ]) else: text = "Non valid value" QToolTip.showText( self.canvas.mapToGlobal(self.canvas.mouseLastXY()), text, self.canvas)