示例#1
0
    def __init__(self, max_n, parent=None, **kwargs):
        super(BMDemo, self).__init__(parent=parent)
        self.setWindowTitle('Curve benchmark')
        tabs = QTabWidget()
        self.setCentralWidget(tabs)
        contents = BMText()
        tabs.addTab(contents, 'Contents')
        self.resize(1000, 600)

        # Force window to show up and refresh (for test purpose only)
        self.show()
        QApplication.processEvents()

        t0g = time.time()
        for idx in range(4, -1, -1):
            points = max_n/10**idx
            t0 = time.time()
            widget = BMWidget(points)
            title = '%d points' % points
            tabs.addTab(widget, title)
            tabs.setCurrentWidget(widget)

            # Force widget to refresh (for test purpose only)
            QApplication.processEvents()

            time_str = "Elapsed time: %d ms" % ((time.time()-t0)*1000)
            widget.text.setText(time_str)
            contents.append("<br><i>%s:</i><br>%s" % (title, time_str))
        dt = time.time()-t0g
        contents.append("<br><br><u>Total elapsed time</u>: %d ms" % (dt*1000))
        tabs.setCurrentIndex(0)
示例#2
0
    def __init__(self, max_n, parent=None, **kwargs):
        super(BMDemo, self).__init__(parent=parent)
        self.setWindowTitle('Curve styles')
        tabs = QTabWidget()
        self.resize(1000, 800)

        # Force window to show up and refresh (for test purpose only)
        self.show()
        QApplication.processEvents()

        self.setCentralWidget(tabs)
        pts = 1000
        for points, symbols in zip((pts / 10, pts / 10, pts, pts),
                                   (True, False) * 2):
            t0 = time.time()
            widget = CSWidget(points, symbols)
            symtext = "with%s symbols" % ("" if symbols else "out")
            title = '%d points, %s' % (points, symtext)
            tabs.addTab(widget, title)
            tabs.setCurrentWidget(widget)

            # Force widget to refresh (for test purpose only)
            QApplication.processEvents()

            time_str = "Elapsed time: %d ms" % ((time.time() - t0) * 1000)
            widget.text.setText(time_str)
        tabs.setCurrentIndex(0)
示例#3
0
    def __init__(self, max_n, parent=None, **kwargs):
        super(BMDemo, self).__init__(parent=parent)
        self.setWindowTitle('Curve styles')
        tabs = QTabWidget()
        self.resize(1000, 800)
        
        # Force window to show up and refresh (for test purpose only)
        self.show()
        QApplication.processEvents()

        self.setCentralWidget(tabs)
        pts = 1000
        for points, symbols in zip((pts/10, pts/10, pts, pts),
                                   (True, False)*2):
            t0 = time.time()
            widget = CSWidget(points, symbols)
            symtext = "with%s symbols" % ("" if symbols else "out")
            title = '%d points, %s' % (points, symtext)
            tabs.addTab(widget, title)
            tabs.setCurrentWidget(widget)

            # Force widget to refresh (for test purpose only)
            QApplication.processEvents()

            time_str = "Elapsed time: %d ms" % ((time.time()-t0)*1000)
            widget.text.setText(time_str)
        tabs.setCurrentIndex(0)
示例#4
0
    def process_iteration(self, title, description, widget, t0):
        self.tabs.addTab(widget, title)
        self.tabs.setCurrentWidget(widget)

        # Force widget to refresh (for test purpose only)
        QApplication.processEvents()

        time_str = "Elapsed time: %d ms" % ((time.time() - t0) * 1000)
        widget.text.setText(time_str)
        self.text.append("<br><i>%s:</i><br>%s" % (description, time_str))
示例#5
0
    def process_iteration(self, title, description, widget, t0):
        self.tabs.addTab(widget, title)
        self.tabs.setCurrentWidget(widget)

        # Force widget to refresh (for test purpose only)
        QApplication.processEvents()

        time_str = "Elapsed time: %d ms" % ((time.time()-t0)*1000)
        widget.text.setText(time_str)
        self.text.append("<br><i>%s:</i><br>%s" % (description, time_str))
示例#6
0
    def __init__(self, max_n, parent=None, **kwargs):
        super(BMDemo, self).__init__(parent=parent)
        title = self.TITLE
        if kwargs.get('only_lines', False):
            title = '%s (%s)' % (title, 'only lines')
        self.setWindowTitle(title)
        self.tabs = QTabWidget()
        self.setCentralWidget(self.tabs)
        self.text = BMText(self)
        self.tabs.addTab(self.text, 'Contents')
        self.resize(*self.SIZE)

        # Force window to show up and refresh (for test purpose only)
        self.show()
        QApplication.processEvents()
        
        t0g = time.time()
        self.run_benchmark(max_n, **kwargs)
        dt = time.time()-t0g
        self.text.append("<br><br><u>Total elapsed time</u>: %d ms" % (dt*1e3))
        self.tabs.setCurrentIndex(0)
示例#7
0
    def __init__(self, max_n, parent=None, **kwargs):
        super(BMDemo, self).__init__(parent=parent)
        title = self.TITLE
        if kwargs.get('only_lines', False):
            title = '%s (%s)' % (title, 'only lines')
        self.setWindowTitle(title)
        self.tabs = QTabWidget()
        self.setCentralWidget(self.tabs)
        self.text = BMText(self)
        self.tabs.addTab(self.text, 'Contents')
        self.resize(*self.SIZE)

        # Force window to show up and refresh (for test purpose only)
        self.show()
        QApplication.processEvents()

        t0g = time.time()
        self.run_benchmark(max_n, **kwargs)
        dt = time.time() - t0g
        self.text.append("<br><br><u>Total elapsed time</u>: %d ms" %
                         (dt * 1e3))
        self.tabs.setCurrentIndex(0)