def test_pixel_select_overlay(self): cnvs = miccanvas.DblMicroscopeCanvas(self.panel) tab_mod = self.create_simple_tab_model() view = tab_mod.focussedView.value self.add_control(cnvs, wx.EXPAND, proportion=1, clear=True) # FIXME: when setView is called *before* the add_control, the picture goes black and no # pixels are visible cnvs.setView(view, tab_mod) cnvs.current_mode = TOOL_POINT psol = wol.PixelSelectOverlay(cnvs) psol.activate() psol.enabled = True cnvs.add_world_overlay(psol) psol.set_data_properties(1e-05, (0.0, 0.0), (17, 19)) width_va = model.IntVA(1) psol.connect_selection(model.TupleVA(), width_va) view.mpp.value = 1e-06 psol._selected_pixel_va.value = (8, 8) test.gui_loop() # Tool toggle for debugging tol = vol.TextViewOverlay(cnvs) tol.add_label("Right click to toggle tool", (10, 30)) cnvs.add_view_overlay(tol) def toggle(evt): if psol.active: psol.deactivate() else: psol.activate() evt.Skip() cnvs.Bind(wx.EVT_RIGHT_UP, toggle) cnvs.disable_drag() def on_key(evt): k = evt.GetKeyCode() if k == wx.WXK_DOWN and width_va.value > 1: width_va.value -= 1 elif k == wx.WXK_UP: width_va.value += 1 else: pass cnvs.Bind(wx.EVT_KEY_UP, on_key)
def test_pixel_select_overlay(self): cnvs = miccanvas.DblMicroscopeCanvas(self.panel) tab_mod = self.create_simple_tab_model() view = tab_mod.focussedView.value self.add_control(cnvs, wx.EXPAND, proportion=1, clear=True) # FIXME: when setView is called *before* the add_control, the picture goes black and no # pixels are visible cnvs.setView(view, tab_mod) cnvs.current_mode = TOOL_POINT psol = wol.PixelSelectOverlay(cnvs) psol.activate() psol.enabled = True cnvs.add_world_overlay(psol) # psol.set_values(33, (0.0, 0.0), (30, 30)) psol.set_values(1e-05, (0.0, 0.0), (17, 19), omodel.TupleVA()) view.mpp.value = 1e-06 test.gui_loop() # Tool toggle for debugging tol = vol.TextViewOverlay(cnvs) tol.add_label("Right click to toggle tool", (10, 30)) cnvs.add_view_overlay(tol) def toggle(evt): if psol.active: psol.deactivate() else: psol.activate() evt.Skip() cnvs.Bind(wx.EVT_RIGHT_UP, toggle)