def test_onedimensional_canvas(self): cnvs = miccanvas.TwoDPlotCanvas(self.panel) cnvs.SetBackgroundColour("#00599B") self.add_control(cnvs, wx.EXPAND, proportion=1) im_data = generate_img_data(200, 10, 4) cnvs.set_2d_data(im_data) cnvs.update_drawing() test.gui_loop() test.sleep(200)
def test_polar_overlay(self): cnvs = miccanvas.AngularResolvedCanvas(self.panel) self.add_control(cnvs, wx.EXPAND, proportion=1, clear=True) test.gui_loop() test.sleep(10) cnvs.polar_overlay.phi_deg = 60 cnvs.polar_overlay.theta_deg = 60 cnvs.polar_overlay.intensity_label.text = "101" test.gui_loop()
def test_bitmap_canvas(self): self.frame.SetSize((1000, 1000)) cnvs = canvas.BitmapCanvas(self.panel) cnvs.SetBackgroundColour("#00599B") self.add_control(cnvs, wx.EXPAND, proportion=1) im_data = generate_img_data(300, 300, 4) img = (im_data, (0.0, 0.0), (1.0, 1.0), True, None, None, 0, None, "bitmap test") cnvs.set_images([img, None]) cnvs.update_drawing() test.gui_loop() test.sleep(500)
def test_points_select_overlay(self): # Create stuff cnvs = miccanvas.DblMicroscopeCanvas(self.panel) self.add_control(cnvs, wx.EXPAND, proportion=1, clear=True) mmodel = test.FakeMicroscopeModel() view = mmodel.focussedView.value cnvs.setView(view, mmodel) # Manually add the overlay pol = wol.PointsOverlay(cnvs) cnvs.world_overlays.append(pol) cnvs.active_overlay = pol cnvs.current_mode = gmodel.TOOL_POINT pol.enable(True) test.gui_loop() from itertools import product phys_points = product(xrange(-200, 201, 50), xrange(-200, 201, 50)) phys_points = [(a / 1.0e5, b / 1.0e5) for a, b in phys_points] point = omodel.VAEnumerated( phys_points[0], choices=frozenset(phys_points)) pol.set_point(point) test.gui_loop() cnvs.update_drawing() test.sleep(1000) point.value = (50 / 1.0e5, 50 / 1.0e5) test.sleep(1000) point = omodel.VAEnumerated( phys_points[0], choices=frozenset([(50 / 1.0e5, 50 / 1.0e5)])) pol.set_point(point)
def test_points_select_overlay(self): # Create stuff cnvs = miccanvas.DblMicroscopeCanvas(self.panel) self.add_control(cnvs, wx.EXPAND, proportion=1, clear=True) tab_mod = self.create_simple_tab_model() view = tab_mod.focussedView.value view.mpp.value = 1e-5 cnvs.setView(view, tab_mod) # Manually add the overlay pol = wol.PointsOverlay(cnvs) cnvs.add_world_overlay(pol) cnvs.current_mode = guimodel.TOOL_POINT pol.activate() test.gui_loop() from itertools import product phys_points = product(xrange(-200, 201, 50), xrange(-200, 201, 50)) phys_points = [(a / 1.0e5, b / 1.0e5) for a, b in phys_points] point = omodel.VAEnumerated(phys_points[0], choices=frozenset(phys_points)) pol.set_point(point) test.gui_loop() cnvs.update_drawing() test.sleep(500) point.value = (50 / 1.0e5, 50 / 1.0e5) test.sleep(500)
def test_bitmap_canvas(self): cnvs = canvas.BitmapCanvas(self.panel) cnvs.SetBackgroundColour("#00599B") self.add_control(cnvs, wx.EXPAND, proportion=1) img = (data.gettest_pattern_sImage(), (0.0, 0.0), 1.0, True, None) cnvs.set_images([img, None]) cnvs.update_drawing() test.gui_loop() test.sleep(500) self.remove_all() cnvs = canvas.DraggableCanvas(self.panel) cnvs.SetBackgroundColour("#3C9B00") self.add_control(cnvs, wx.EXPAND, proportion=1) cnvs.set_images([img, None]) cnvs.update_drawing() # cnvs.fit_view_to_content() test.gui_loop() test.sleep(500)