Exemplo n.º 1
0
    def test_start_stop_binrule(self, size, base, scale, histogram):
        print size, base, scale, histogram
        sim_obj = cagen.ElementarySimulator(size, copy_borders=True, base=base, histogram=histogram)

        display = ZasimDisplay(sim_obj)
        display.set_scale(scale)

        if histogram:
            extra_hist = HistogramExtraDisplay(sim_obj, parent=display,
                        height=200, maximum=size[0] * size[1])
            extra_hist.show()
            display.window.attach_display(extra_hist)
            display.window.addDockWidget(Qt.RightDockWidgetArea, extra_hist)

        QTest.qWaitForWindowShown(display.window)

        QTest.mouseClick(display.control.start_button, Qt.LeftButton)

        for execution in seconds(0.1):
            self.app.processEvents()
        assert not display.control.start_button.isVisible()
        for execution in seconds(0.1):
            self.app.processEvents()
        QTest.mouseClick(display.control.stop_button, Qt.LeftButton)
        for execution in seconds(0.1):
            self.app.processEvents()
        assert not display.control.stop_button.isVisible()

        self.app.closeAllWindows()
        fail_on_exceptions()
Exemplo n.º 2
0
Arquivo: main.py Projeto: B-Rich/zasim
def main(width=200, height=200, scale=2,
        beta=100, nondet=100,
        copy_borders=True, black=80,
        histogram=True, activity=True,
        base=7):

    beta = beta / 100.
    nondet = nondet / 100.

    w, h = width, height
    size = w, h

    if black is not None:
        config = RandomConfiguration(base, black)
    else:
        config = None

    sim_obj = SillySim(size=size, config=config, base=base, nondet=nondet, histogram=histogram, activity=activity, beta=beta, copy_borders=copy_borders)

    display = ZasimDisplay(sim_obj)
    display.set_scale(scale)

    display.control.start()

    if histogram:
        extra_hist = HistogramExtraDisplay(sim_obj, parent=display, height=200, maximum= w * h)
        extra_hist.show()
        display.window.attach_display(extra_hist)
        display.window.addDockWidget(Qt.RightDockWidgetArea, extra_hist)

    if activity:
        extra_activity = HistogramExtraDisplay(sim_obj, attribute="activity", parent=display, height=200, maximum=w*h)
        extra_activity.show()
        display.window.attach_display(extra_activity)
        display.window.addDockWidget(Qt.RightDockWidgetArea, extra_activity)

    sys.exit(app.exec_())