def test_mirror_arc_overlay(self): cnvs = miccanvas.SparcARCanvas(self.panel) cnvs.scale = 20000 cnvs.add_world_overlay(cnvs.mirror_ol) cnvs.mirror_ol.active.value = True self.add_control(cnvs, wx.EXPAND, proportion=1, clear=True) def zoom(evt): mi, ma = 1000, 80000 abs_val = abs(evt.step_value) if evt.direction == wx.RIGHT: old = cnvs.scale cnvs.scale *= 1.1**abs_val print("bigger %0.2f > %0.2f" % (old, cnvs.scale)) if not mi <= cnvs.scale <= ma: cnvs.scale = ma else: print("smaller") cnvs.scale *= 0.9**abs_val if not mi <= cnvs.scale <= ma: cnvs.scale = mi wx.CallAfter(cnvs.update_drawing) try: self.pm = Powermate(self.frame) except LookupError: if TEST_NOHW: self.skipTest("No hardware detected, skipping test") cnvs.Bind(EVT_KNOB_ROTATE, zoom) test.gui_loop()
def test_mirror_arc_overlay(self): cnvs = miccanvas.SparcARCanvas(self.panel) cnvs.scale = 20000 self.add_control(cnvs, wx.EXPAND, proportion=1, clear=True) cnvs.flip = 0 cnvs.update_drawing() def flip(evt): if cnvs.flip == wx.VERTICAL: cnvs.flip = 0 else: cnvs.flip = wx.VERTICAL cnvs.update_drawing() evt.Skip() def zoom(evt): if evt.GetWheelRotation() > 0: cnvs.scale *= 1.1 else: cnvs.scale *= 0.9 cnvs.update_drawing() cnvs.Bind(wx.EVT_LEFT_DCLICK, flip) cnvs.Bind(wx.EVT_MOUSEWHEEL, zoom) test.gui_loop()