当前位置: 首页>>代码示例>>Python>>正文


Python QToolTip.isVisible方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QToolTip.isVisible方法的典型用法代码示例。如果您正苦于以下问题:Python QToolTip.isVisible方法的具体用法?Python QToolTip.isVisible怎么用?Python QToolTip.isVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QToolTip的用法示例。


在下文中一共展示了QToolTip.isVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute_queries

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import isVisible [as 别名]
    def execute_queries(self, query=''):
        """ This function executes queries """

        # Hide tooltip if visible
        if QToolTip.isVisible():
            QToolTip.hideText()

        # If text is selected, then this text is the query,
        # otherwise the query is all text that has the editor
        editor_widget = self.currentWidget().get_editor()
        if editor_widget.textCursor().hasSelection():
            query = editor_widget.textCursor().selectedText()
        else:
            query = editor_widget.toPlainText()

        relations = self.currentWidget().relations
        central = Pireal.get_service("central")
        table_widget = central.get_active_db().table_widget

        # Restore
        relations.clear()
        self.currentWidget().clear_results()

        # Parse query
        sc = scanner.Scanner(query)
        lex = lexer.Lexer(sc)
        try:
            par = parser.Parser(lex)
            interpreter = parser.Interpreter(par)
            interpreter.clear()
            interpreter.to_python()
        except Exception as reason:
            pireal = Pireal.get_service("pireal")
            pireal.show_error_message(self.parse_error(reason.__str__()))
            return
        relations.update(table_widget.relations)
        for relation_name, expression in list(interpreter.SCOPE.items()):
            if relation_name in relations:
                QMessageBox.critical(self,
                                     self.tr("Query Error"),
                                     self.tr("<b>{}</b> is a duplicate "
                                             "relation name.<br><br> "
                                             "Please choose a unique name "
                                             "and re-execute the "
                                             "queries.".format(
                                                 relation_name)))
                del interpreter.SCOPE[relation_name]
                return
            try:
                new_relation = eval(expression, {}, relations)

            except Exception as reason:
                pireal = Pireal.get_service("pireal")
                pireal.show_error_message(self.parse_error(reason.__str__()),
                                          syntax_error=False)
                return

            relations[relation_name] = new_relation
            self.__add_table(new_relation, relation_name)
开发者ID:centaurialpha,项目名称:pireal,代码行数:61,代码来源:query_container.py

示例2: updateKineticCursor

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import isVisible [as 别名]
 def updateKineticCursor(self, active):
     """Cursor handling when kinetic move starts/stops.
     
     - reset the cursor and hide tooltips if visible at start,
     - update the cursor and show the appropriate tooltips at stop.
     
     Used as a slot linked to the kineticStarted() signal.
     """
     if active:
         self.unsetCursor()
         if QToolTip.isVisible():
             QToolTip.hideText()
     else:
         self.updateCursor(QCursor.pos())
         if self._linksEnabled:
             page, link = self.pageLayout().linkAt(self.mapFromGlobal(QCursor.pos()))
             if link:
                 self.linkHelpEvent(QCursor.pos(), page, link)
开发者ID:AlexSchr,项目名称:frescobaldi,代码行数:20,代码来源:surface.py


注:本文中的PyQt5.QtWidgets.QToolTip.isVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。