Exemplo n.º 1
0
def do_analysis():
    from Widgets import MainWindow
    try:
        # 获取函数调用图
        from pycallgraph2.config import Config
        from pycallgraph2.globbing_filter import GlobbingFilter
        from pycallgraph2.output.graphviz import GraphvizOutput
        from pycallgraph2.pycallgraph import PyCallGraph
        # 函数流程图调用
        config = Config()
        config.trace_filter = GlobbingFilter(
            include=['Widgets.*', 'Utils.*'],
            exclude=['pycallgraph2.*', '*.secret_function'])
        with PyCallGraph(GraphvizOutput(tool='D:/soft/Graphviz/bin/dot',
                                        output_file='call_detail.png'),
                         config=config):
            MainWindow.main()
    except:
        MainWindow.main()
Exemplo n.º 2
0
def showError(message):

    from PyQt5.QtWidgets import QApplication, QErrorMessage, QCheckBox, \
        QPushButton, QLabel, QStyle
    from PyQt5.QtCore import Qt
    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(True)
    # 设置内置错误图标
    app.setWindowIcon(app.style().standardIcon(QStyle.SP_MessageBoxCritical))
    w = QErrorMessage()
    w.finished.connect(lambda _: app.quit)
    w.resize(600, 400)
    # 去掉右上角?
    w.setWindowFlags(w.windowFlags() & ~Qt.WindowContextHelpButtonHint)
    w.setWindowTitle(w.tr('Error'))
    # 隐藏图标、勾选框、按钮
    w.findChild(QLabel, '').setVisible(False)
    w.findChild(QCheckBox, '').setVisible(False)
    w.findChild(QPushButton, '').setVisible(False)
    w.showMessage(escape(message))
    sys.exit(app.exec_())


try:
    from Widgets import MainWindow

    MainWindow.main()
except SystemExit:
    pass
except:
    showError(traceback.format_exc())