def test_legend(self): test.goto_manual() self.frame.SetSize((400, 60)) leg = legend.AxisLegend(self.panel) leg.SetBackgroundColour(wx.RED) self.add_control(leg, flags=wx.EXPAND) test.gui_loop() def set_range(): start, end = 0, 1 while end < 10e6: end *= 1.0001 leg.unit = 'm' leg.range = (start, end) threading._sleep(0.0005) self.frame.Destroy() test.gui_loop(500) t = threading.Thread(target=set_range) # Setting Daemon to True, will cause the thread to exit when the parent does t.setDaemon(True) t.start() test.gui_loop()
def test_legend(self): test.goto_manual() self.frame.SetSize((400, 60)) leg = legend.AxisLegend(self.panel) leg.SetBackgroundColour(wx.RED) self.add_control(leg, flags=wx.EXPAND) test.gui_loop() is_done = threading.Event() def set_range(): start, end = 0, 1 while end < 10e6: end *= 1.001 leg.unit = 'm' leg.range = (start, end) time.sleep(0.0005) is_done.set() test.gui_loop(0.5) t = threading.Thread(target=set_range) # Setting Daemon to True, will cause the thread to exit when the parent does t.setDaemon(True) t.start() for i in range(30): # Fail after 30s not yet finished test.gui_loop(1) if is_done.is_set(): return self.assertTrue(is_done.is_set())
def test_legend(self): test.goto_manual() self.frame.SetSize((400, 60)) leg = legend.AxisLegend(self.panel) leg.SetBackgroundColour(wx.RED) self.add_control(leg, flags=wx.EXPAND) test.gui_loop() is_done = threading.Event() def set_range(): start, end = 0, 1 while end < 10e6: end *= 1.001 leg.unit = 'm' leg.range = (start, end) time.sleep(0.0005) self.frame.Destroy() is_done.set() test.gui_loop(0.5) t = threading.Thread(target=set_range) # Setting Daemon to True, will cause the thread to exit when the parent does t.setDaemon(True) t.start() for i in range(30): # Fail after 30s not yet finished test.gui_loop(1) if is_done.is_set(): return self.assertTrue(is_done.is_set())
def test_int_txt_ctrl(self): ctrl = IntegerTextCtrl(self.panel, value=123456789) self.add_control(ctrl, label=ctrl.__class__.__name__, flags=wx.EXPAND | wx.ALL) test.goto_manual()
def test_gtk(self): test.goto_manual() cbr = wx.CheckBox(self.panel, -1, "Label text") self.add_control(cbr) cb = wx.CheckBox(self.panel, -1, "") self.add_control(cb) cbl = wx.CheckBox(self.panel, -1, "Label left", style=wx.ALIGN_RIGHT) self.add_control(cbl)
def test_view_select_overlay(self): test.goto_manual() # Create and add a miccanvas cnvs = miccanvas.DblMicroscopeCanvas(self.panel) self.add_control(cnvs, wx.EXPAND, proportion=1, clear=True) vsol = vol.ViewSelectOverlay(cnvs) vsol.activate() cnvs.add_view_overlay(vsol) # cnvs.current_mode = guimodel.TOOL_ZOOM test.gui_loop()
def test_threaded_plot(self): test.goto_manual() vwp = viewport.PointSpectrumViewport(self.panel) vwp.canvas.SetBackgroundColour("#333") vwp.canvas.SetForegroundColour("#A0CC27") self.add_control(vwp, wx.EXPAND, proportion=1) vwp.canvas.set_plot_mode(canvas.PLOT_MODE_BAR) vwp.canvas.set_plot_mode(canvas.PLOT_MODE_LINE) # vwp.canvas.set_plot_mode(canvas.PLOT_MODE_POINT) data_size = 100 xs = range(data_size) ys = self._generate_sine_list(data_size) def rotate(q, v): # v.bottom_legend.unit = 'm' scale = 1.001 timeout = time.time() + 600 while True: v.canvas.set_1d_data(xs, ys, unit_x='m', unit_y='g') q[-1] *= scale q.rotate(1) if time.time() > timeout: break v.bottom_legend.range = (min(xs), max(xs)) v.bottom_legend.SetToolTipString(u"Time (s)") v.left_legend.range = (min(ys), max(ys)) v.left_legend.SetToolTipString(u"Count per second") # threading._sleep(0.000001) self.frame.Destroy() t = threading.Thread(target=rotate, args=(ys, vwp)) # Setting Daemon to True, will cause the thread to exit when the parent does t.setDaemon(True) t.start() test.gui_loop()
def test_threaded_plot(self): test.goto_manual() cnvs = miccanvas.BarPlotCanvas(self.panel) cnvs.SetBackgroundColour(wx.BLACK) cnvs.SetForegroundColour("#DDDDDD") cnvs.set_closure(canvas.PLOT_CLOSE_STRAIGHT) self.add_control(cnvs, wx.EXPAND, proportion=1) cnvs.set_plot_mode(canvas.PLOT_MODE_BAR) data_size = 100 xs = range(data_size) ys = self._generate_sine_list(data_size) is_done = threading.Event() def rotate(q): scale = 1.001 timeout = time.time() + 6 while True: cnvs.set_1d_data(xs, ys, unit_x='m', unit_y='g') q[-1] *= scale q.rotate(1) time.sleep(0.01) if time.time() > timeout: break print("No error detected in threaded plotting") is_done.set() t = threading.Thread(target=rotate, args=(ys, )) # Setting Daemon to True, will cause the thread to exit when the parent does t.setDaemon(True) t.start() for i in range(10): # Fail after 10s not yet finished test.gui_loop(1) if is_done.is_set(): return self.assertTrue(is_done.is_set())
def test_unit_float(self): test.goto_manual() self.app.test_frame.unit_float.unit = u"☠" for acc in (None, 1, 2, 4, 8): self.app.test_frame.unit_float.accuracy = acc self.app.test_frame.unit_float_label.SetLabel("Sig = %s" % acc) for f in TEST_FLT: self.app.test_frame.unit_float.SetValue(f) test.gui_loop() self.app.test_frame.unit_float.SetFocus() test.gui_loop() for f in TEST_FLT: self.app.test_frame.unit_float.SetValue(f) test.gui_loop() test.gui_loop(100)
def test_unit_float(self): test.goto_manual() self.app.test_frame.unit_float.unit = u"☠" for acc in (None, 1, 2, 4, 8): self.app.test_frame.unit_float.accuracy = acc self.app.test_frame.unit_float_label.SetLabel("Sig = %s" % acc) for f in TEST_FLT: self.app.test_frame.unit_float.SetValue(f) test.gui_loop() self.app.test_frame.unit_float.SetFocus() test.gui_loop() for f in TEST_FLT: self.app.test_frame.unit_float.SetValue(f) test.gui_loop() test.gui_loop(0.1)
def test_threaded_plot(self): test.goto_manual() cnvs = miccanvas.BarPlotCanvas(self.panel) cnvs.SetBackgroundColour(wx.BLACK) cnvs.SetForegroundColour("#DDDDDD") cnvs.set_closure(canvas.PLOT_CLOSE_STRAIGHT) self.add_control(cnvs, wx.EXPAND, proportion=1) cnvs.set_plot_mode(canvas.PLOT_MODE_BAR) data_size = 100 xs = range(data_size) ys = self._generate_sine_list(data_size) def rotate(q): scale = 1.001 timeout = time.time() + 600 while True: cnvs.set_1d_data(xs, ys, unit_x='m', unit_y='g') q[-1] *= scale q.rotate(1) if time.time() > timeout: break # threading._sleep(0.0005) print "No error..." self.frame.Destroy() t = threading.Thread(target=rotate, args=(ys, )) # Setting Daemon to True, will cause the thread to exit when the parent does t.setDaemon(True) t.start() test.gui_loop()
""" # =============================================================================== # Test module for Odemis' custom FoldPanelBar in gui.comp # =============================================================================== from __future__ import division import unittest import wx import odemis.gui.comp.foldpanelbar as fpb import odemis.gui.test as test test.goto_manual() # Keep the test frame open after the tests are run # test.goto_inspect() # logging.getLogger().setLevel(logging.DEBUG) FPB_SPACING = 0 class FoldPanelBarTestCase(test.GuiTestCase): frame_class = test.test_gui.xrcfpb_frame @classmethod def setUpClass(cls): super(FoldPanelBarTestCase, cls).setUpClass() cls.foldpanelitems = [cls.app.test_frame.panel_1, cls.app.test_frame.panel_2,
You should have received a copy of the GNU General Public License along with Odemis. If not, see http://www.gnu.org/licenses/. """ from __future__ import division import logging import unittest import wx import odemis.gui.test as test from odemis.gui.test import gui_loop test.goto_manual() class GridPanelTestCase(test.GuiTestCase): frame_class = test.test_gui.xrcgrid_frame # test.set_log_level(logging.DEBUG) def test_grid_view(self): test.set_sleep_time(200) gp = self.frame.grid_panel gui_loop()
You should have received a copy of the GNU General Public License along with Odemis. If not, see http://www.gnu.org/licenses/. """ from __future__ import division import logging import unittest import odemis.gui.test as test from odemis.gui.test import gui_loop from odemis.gui.model import StreamView test.goto_manual() class GridPanelTestCase(test.GuiTestCase): frame_class = test.test_gui.xrcgrid_frame # test.set_log_level(logging.DEBUG) @classmethod def setUpClass(cls): super(GridPanelTestCase, cls).setUpClass() # Make the Panels look like ViewPorts v = StreamView("everything") f = cls.frame for vp in (f.red, f.blue, f.purple, f.brown, f.yellow, f.green):