mwxlib 1.6.10__py3-none-any.whl → 1.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mwxlib might be problematic. Click here for more details.
- mwx/bookshelf.py +26 -22
- mwx/controls.py +142 -143
- mwx/framework.py +105 -105
- mwx/graphman.py +85 -85
- mwx/matplot2.py +82 -81
- mwx/matplot2g.py +165 -165
- mwx/matplot2lg.py +57 -57
- mwx/mgplt.py +12 -12
- mwx/nutshell.py +305 -287
- mwx/plugins/ffmpeg_view.py +15 -15
- mwx/plugins/fft_view.py +4 -4
- mwx/plugins/frame_listview.py +26 -26
- mwx/plugins/line_profile.py +1 -1
- mwx/utilus.py +40 -40
- mwx/wxmon.py +20 -20
- mwx/wxpdb.py +45 -45
- mwx/wxwil.py +11 -11
- mwx/wxwit.py +15 -15
- {mwxlib-1.6.10.dist-info → mwxlib-1.7.0.dist-info}/METADATA +1 -1
- mwxlib-1.7.0.dist-info/RECORD +28 -0
- mwxlib-1.6.10.dist-info/RECORD +0 -28
- {mwxlib-1.6.10.dist-info → mwxlib-1.7.0.dist-info}/WHEEL +0 -0
- {mwxlib-1.6.10.dist-info → mwxlib-1.7.0.dist-info}/top_level.txt +0 -0
mwx/matplot2.py
CHANGED
|
@@ -34,7 +34,8 @@ if matplotlib.parse_version(matplotlib.__version__).release < (3,8,0):
|
|
|
34
34
|
Event.__init__ = __init__
|
|
35
35
|
del __init__
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
## Monkey-patch (local) for matplotlib 3.8/WXAgg
|
|
38
39
|
if 1:
|
|
39
40
|
class Cursor(Cursor):
|
|
40
41
|
def onmove(self, event):
|
|
@@ -68,7 +69,7 @@ if 1:
|
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
class MatplotPanel(wx.Panel):
|
|
71
|
-
"""MPL panel for general graph
|
|
72
|
+
"""MPL panel for general graph.
|
|
72
73
|
|
|
73
74
|
Attributes:
|
|
74
75
|
figure: <matplotlib.figure.Figure>
|
|
@@ -78,7 +79,7 @@ class MatplotPanel(wx.Panel):
|
|
|
78
79
|
selected: Selected points <matplotlib.lines.Line2D>
|
|
79
80
|
"""
|
|
80
81
|
handler = property(lambda self: self.__handler)
|
|
81
|
-
|
|
82
|
+
|
|
82
83
|
def __init__(self, parent, log=None, margin=(.1,.1,.9,.9), **kwargs):
|
|
83
84
|
wx.Panel.__init__(self, parent, **kwargs)
|
|
84
85
|
|
|
@@ -296,7 +297,7 @@ class MatplotPanel(wx.Panel):
|
|
|
296
297
|
self.__isMenu = None
|
|
297
298
|
self.__isPressed = None
|
|
298
299
|
self.__isDragging = False # True if dragging. (None if dblclicked)
|
|
299
|
-
|
|
300
|
+
|
|
300
301
|
def clear(self):
|
|
301
302
|
"""Initialize the plot figure."""
|
|
302
303
|
#<matplotlib.axes.Axes>
|
|
@@ -311,7 +312,7 @@ class MatplotPanel(wx.Panel):
|
|
|
311
312
|
#<matplotlib.widgets.Cursor>
|
|
312
313
|
self.cursor = Cursor(self.axes, useblit=True, color='grey', linewidth=1)
|
|
313
314
|
self.cursor.visible = 1
|
|
314
|
-
|
|
315
|
+
|
|
315
316
|
## Note: To avoid a wxAssertionError when running in a thread.
|
|
316
317
|
@postcall
|
|
317
318
|
def draw(self, art=None):
|
|
@@ -325,76 +326,76 @@ class MatplotPanel(wx.Panel):
|
|
|
325
326
|
else:
|
|
326
327
|
self.handler('canvas_draw', self.frame)
|
|
327
328
|
self.canvas.draw()
|
|
328
|
-
|
|
329
|
+
|
|
329
330
|
def set_margin(self, lbrt):
|
|
330
331
|
self.figure.subplots_adjust(*lbrt)
|
|
331
|
-
|
|
332
|
+
|
|
332
333
|
def set_wxcursor(self, c):
|
|
333
334
|
self.canvas.SetCursor(wx.Cursor(c))
|
|
334
|
-
|
|
335
|
+
|
|
335
336
|
## --------------------------------
|
|
336
337
|
## Property of the current frame
|
|
337
338
|
## --------------------------------
|
|
338
|
-
|
|
339
|
+
|
|
339
340
|
## to be overridden (referenced in draw).
|
|
340
341
|
frame = property(lambda self: self)
|
|
341
|
-
|
|
342
|
+
|
|
342
343
|
axes = property(
|
|
343
344
|
lambda self: self.figure.axes[0],
|
|
344
|
-
doc="The first figure axes <matplotlib.axes.Axes
|
|
345
|
-
|
|
345
|
+
doc="The first figure axes <matplotlib.axes.Axes>.")
|
|
346
|
+
|
|
346
347
|
xbound = property(
|
|
347
348
|
lambda self: np.array(self.axes.get_xbound()),
|
|
348
349
|
lambda self, v: self.axes.set_xbound(v),
|
|
349
|
-
doc="X-axis numerical bounds where lowerBound < upperBound
|
|
350
|
-
|
|
350
|
+
doc="X-axis numerical bounds where lowerBound < upperBound.")
|
|
351
|
+
|
|
351
352
|
ybound = property(
|
|
352
353
|
lambda self: np.array(self.axes.get_ybound()),
|
|
353
354
|
lambda self, v: self.axes.set_ybound(v),
|
|
354
|
-
doc="Y-axis numerical bounds where lowerBound < upperBound
|
|
355
|
-
|
|
355
|
+
doc="Y-axis numerical bounds where lowerBound < upperBound.")
|
|
356
|
+
|
|
356
357
|
xlim = property(
|
|
357
358
|
lambda self: np.array(self.axes.get_xlim()),
|
|
358
359
|
lambda self, v: self.axes.set_xlim(v),
|
|
359
|
-
doc="X-axis range [left, right]")
|
|
360
|
-
|
|
360
|
+
doc="X-axis range [left, right].")
|
|
361
|
+
|
|
361
362
|
ylim = property(
|
|
362
363
|
lambda self: np.array(self.axes.get_ylim()),
|
|
363
364
|
lambda self, v: self.axes.set_ylim(v),
|
|
364
|
-
doc="Y-axis range [bottom, top]")
|
|
365
|
-
|
|
365
|
+
doc="Y-axis range [bottom, top].")
|
|
366
|
+
|
|
366
367
|
@property
|
|
367
368
|
def ddpu(self):
|
|
368
369
|
"""Display-dot resolution (x, y) [dots per arb.unit]."""
|
|
369
370
|
## return self.mapxy2disp(1,1) - self.mapxy2disp(0,0)
|
|
370
371
|
a, b = self.mapxy2disp([0,1],[0,1])
|
|
371
372
|
return b - a
|
|
372
|
-
|
|
373
|
+
|
|
373
374
|
def mapxy2disp(self, x, y):
|
|
374
375
|
"""Map xydata --> display dot pixel coordinates."""
|
|
375
376
|
v = np.array((x, y)).T
|
|
376
377
|
return self.axes.transData.transform(v)
|
|
377
|
-
|
|
378
|
+
|
|
378
379
|
def mapdisp2xy(self, px, py):
|
|
379
380
|
"""Map display dot pixel coordinates --> xydata."""
|
|
380
381
|
v = np.array((px, py)).T
|
|
381
382
|
return self.axes.transData.inverted().transform(v)
|
|
382
|
-
|
|
383
|
+
|
|
383
384
|
## --------------------------------
|
|
384
385
|
## Property of the modeline
|
|
385
386
|
## --------------------------------
|
|
386
|
-
|
|
387
|
+
|
|
387
388
|
selectedModeLineBg = '#000000'
|
|
388
389
|
selectedModeLineFg = '#f0f0f0'
|
|
389
390
|
unselectedModeLineBg = 'auto'
|
|
390
391
|
unselectedModeLineFg = 'auto'
|
|
391
|
-
|
|
392
|
+
|
|
392
393
|
def on_modeline_tip(self, evt): #<wx._core.MouseEvent>
|
|
393
394
|
flag = self.modeline.HitTest(evt.Position)
|
|
394
395
|
if flag == wx.HT_WINDOW_INSIDE:
|
|
395
396
|
self.modeline.SetToolTip(self.modeline.Label)
|
|
396
397
|
evt.Skip()
|
|
397
|
-
|
|
398
|
+
|
|
398
399
|
def on_focus_set(self, evt): #<wx._core.FocusEvent>
|
|
399
400
|
if self.modeline.IsShown():
|
|
400
401
|
self.modeline.SetBackgroundColour(self.selectedModeLineBg)
|
|
@@ -402,7 +403,7 @@ class MatplotPanel(wx.Panel):
|
|
|
402
403
|
self.modeline.Refresh()
|
|
403
404
|
self.escape()
|
|
404
405
|
evt.Skip()
|
|
405
|
-
|
|
406
|
+
|
|
406
407
|
def on_focus_kill(self, evt): #<wx._core.FocusEvent>
|
|
407
408
|
if self.modeline.IsShown():
|
|
408
409
|
self.modeline.SetBackgroundColour(self.unselectedModeLineBg)
|
|
@@ -410,17 +411,17 @@ class MatplotPanel(wx.Panel):
|
|
|
410
411
|
self.modeline.Refresh()
|
|
411
412
|
self.escape()
|
|
412
413
|
evt.Skip()
|
|
413
|
-
|
|
414
|
+
|
|
414
415
|
def escape(self, evt=None):
|
|
415
416
|
"""Feel like pressing {escape}.
|
|
416
417
|
エスケープキーを押した気持ちになる
|
|
417
418
|
"""
|
|
418
419
|
wx.UIActionSimulator().KeyUp(wx.WXK_ESCAPE)
|
|
419
|
-
|
|
420
|
+
|
|
420
421
|
## --------------------------------
|
|
421
422
|
## External I/O file and clipboard
|
|
422
423
|
## --------------------------------
|
|
423
|
-
|
|
424
|
+
|
|
424
425
|
def copy_to_clipboard(self):
|
|
425
426
|
"""Copy canvas image to clipboard."""
|
|
426
427
|
## b = self.selected.get_visible()
|
|
@@ -435,30 +436,30 @@ class MatplotPanel(wx.Panel):
|
|
|
435
436
|
## self.selected.set_visible(b)
|
|
436
437
|
self.cursor.visible = c
|
|
437
438
|
self.canvas.draw()
|
|
438
|
-
|
|
439
|
+
|
|
439
440
|
## --------------------------------
|
|
440
441
|
## Selector interface
|
|
441
442
|
## --------------------------------
|
|
442
|
-
|
|
443
|
+
|
|
443
444
|
def trace_point(self, x, y):
|
|
444
445
|
if hasattr(x, '__iter__'):
|
|
445
446
|
if not len(x):
|
|
446
447
|
return
|
|
447
448
|
x, y = x[0], y[0]
|
|
448
449
|
self.message("({:g}, {:g})".format(x, y))
|
|
449
|
-
|
|
450
|
+
|
|
450
451
|
def on_figure_enter(self, evt): #<matplotlib.backend_bases.MouseEvent>
|
|
451
452
|
pass
|
|
452
|
-
|
|
453
|
+
|
|
453
454
|
def on_figure_leave(self, evt): #<matplotlib.backend_bases.MouseEvent>
|
|
454
455
|
self.cursor.clear(evt)
|
|
455
456
|
self.canvas.draw()
|
|
456
|
-
|
|
457
|
+
|
|
457
458
|
@property
|
|
458
459
|
def selector(self):
|
|
459
460
|
"""Selected points array [[x],[y]]."""
|
|
460
461
|
return np.array(self.selected.get_data(orig=0))
|
|
461
|
-
|
|
462
|
+
|
|
462
463
|
@selector.setter
|
|
463
464
|
def selector(self, v):
|
|
464
465
|
x, y = v
|
|
@@ -469,36 +470,36 @@ class MatplotPanel(wx.Panel):
|
|
|
469
470
|
self.handler('selector_drawn', self.frame)
|
|
470
471
|
self.draw(self.selected)
|
|
471
472
|
self.trace_point(*v)
|
|
472
|
-
|
|
473
|
+
|
|
473
474
|
@selector.deleter
|
|
474
475
|
def selector(self):
|
|
475
476
|
self.selected.set_visible(0)
|
|
476
477
|
self.selected.set_data([], [])
|
|
477
478
|
self.handler('selector_removed', self.frame)
|
|
478
479
|
self.draw(self.selected)
|
|
479
|
-
|
|
480
|
+
|
|
480
481
|
## --------------------------------
|
|
481
482
|
## matplotlib interfaces
|
|
482
483
|
## --------------------------------
|
|
483
|
-
|
|
484
|
+
|
|
484
485
|
@property
|
|
485
486
|
def p_event(self):
|
|
486
487
|
"""Last `pressed` event <matplotlib.backend_bases.MouseEvent>."""
|
|
487
488
|
return self.__isPressed
|
|
488
|
-
|
|
489
|
+
|
|
489
490
|
@p_event.setter
|
|
490
491
|
def p_event(self, v):
|
|
491
492
|
self.__isPressed = v
|
|
492
|
-
|
|
493
|
+
|
|
493
494
|
def on_menu_lock(self, evt): #<matplotlib.backend_bases.MouseEvent>
|
|
494
495
|
self.__isMenu = 1
|
|
495
|
-
|
|
496
|
+
|
|
496
497
|
def on_menu(self, evt): #<matplotlib.backend_bases.MouseEvent>
|
|
497
498
|
if self.__isMenu:
|
|
498
499
|
self.canvas.SetFocus()
|
|
499
500
|
Menu.Popup(self, self.menu)
|
|
500
501
|
self.__isMenu = 0
|
|
501
|
-
|
|
502
|
+
|
|
502
503
|
def on_pick(self, evt): #<matplotlib.backend_bases.PickEvent>
|
|
503
504
|
"""Find index near (x,y) and set the selector.
|
|
504
505
|
Called (maybe) after mouse button pressed.
|
|
@@ -529,14 +530,14 @@ class MatplotPanel(wx.Panel):
|
|
|
529
530
|
self.canvas.draw_idle()
|
|
530
531
|
self.handler('art_picked', evt)
|
|
531
532
|
self.message("({:g}, {:g}) index {}".format(x, y, evt.index))
|
|
532
|
-
|
|
533
|
+
|
|
533
534
|
def on_hotkey_press(self, evt): #<wx._core.KeyEvent>
|
|
534
535
|
"""Called when a key is pressed."""
|
|
535
536
|
key = hotkey(evt)
|
|
536
537
|
self.__key = regulate_key(key + '-')
|
|
537
538
|
if self.handler('{} pressed'.format(key), evt) is None:
|
|
538
539
|
evt.Skip()
|
|
539
|
-
|
|
540
|
+
|
|
540
541
|
def on_hotkey_down(self, evt): #<wx._core.KeyEvent>
|
|
541
542
|
"""Called when a key is pressed while dragging.
|
|
542
543
|
Specifically called when the mouse is being captured.
|
|
@@ -545,14 +546,14 @@ class MatplotPanel(wx.Panel):
|
|
|
545
546
|
self.on_hotkey_press(evt)
|
|
546
547
|
else:
|
|
547
548
|
evt.Skip()
|
|
548
|
-
|
|
549
|
+
|
|
549
550
|
def on_hotkey_up(self, evt): #<wx._core.KeyEvent>
|
|
550
551
|
"""Called when a key is released."""
|
|
551
552
|
key = hotkey(evt)
|
|
552
553
|
self.__key = ''
|
|
553
554
|
if self.handler('{} released'.format(key), evt) is None:
|
|
554
555
|
evt.Skip()
|
|
555
|
-
|
|
556
|
+
|
|
556
557
|
def _on_mouse_event(self, evt): #<matplotlib.backend_bases.MouseEvent>
|
|
557
558
|
"""Called in mouse event handlers."""
|
|
558
559
|
if not evt.inaxes or evt.inaxes is not self.axes:
|
|
@@ -567,7 +568,7 @@ class MatplotPanel(wx.Panel):
|
|
|
567
568
|
key += 'wheel{}'.format(evt.button) # wheel[up|down]
|
|
568
569
|
evt.key = key
|
|
569
570
|
return key
|
|
570
|
-
|
|
571
|
+
|
|
571
572
|
def on_button_press(self, evt): #<matplotlib.backend_bases.MouseEvent>
|
|
572
573
|
"""Called when the mouse button is pressed."""
|
|
573
574
|
self.p_event = evt
|
|
@@ -578,7 +579,7 @@ class MatplotPanel(wx.Panel):
|
|
|
578
579
|
else:
|
|
579
580
|
self.__isDragging = False
|
|
580
581
|
self.handler('{}button pressed'.format(key), evt)
|
|
581
|
-
|
|
582
|
+
|
|
582
583
|
def on_button_release(self, evt): #<matplotlib.backend_bases.MouseEvent>
|
|
583
584
|
"""Called when the mouse button is released."""
|
|
584
585
|
key = self._on_mouse_event(evt)
|
|
@@ -591,7 +592,7 @@ class MatplotPanel(wx.Panel):
|
|
|
591
592
|
return
|
|
592
593
|
self.handler('{}button released'.format(key), evt)
|
|
593
594
|
self.p_event = None
|
|
594
|
-
|
|
595
|
+
|
|
595
596
|
def on_motion_notify(self, evt): #<matplotlib.backend_bases.MouseEvent>
|
|
596
597
|
"""Called when the mouse is moved."""
|
|
597
598
|
key = self._on_mouse_event(evt)
|
|
@@ -612,52 +613,52 @@ class MatplotPanel(wx.Panel):
|
|
|
612
613
|
else:
|
|
613
614
|
return
|
|
614
615
|
self.handler('{} motion'.format(event), evt)
|
|
615
|
-
|
|
616
|
+
|
|
616
617
|
def on_scroll(self, evt): #<matplotlib.backend_bases.MouseEvent>
|
|
617
618
|
"""Called when scrolling the mouse wheel."""
|
|
618
619
|
self.p_event = evt
|
|
619
620
|
key = self._on_mouse_event(evt)
|
|
620
621
|
self.handler('{} pressed'.format(key), evt)
|
|
621
622
|
self.p_event = None
|
|
622
|
-
|
|
623
|
+
|
|
623
624
|
## --------------------------------
|
|
624
625
|
## Pan/Zoom actions
|
|
625
626
|
## --------------------------------
|
|
626
|
-
|
|
627
|
+
|
|
627
628
|
ZOOM_RATIO = 10 ** 0.2
|
|
628
629
|
ZOOM_LIMIT = 0.1 # logical limit <= epsilon
|
|
629
|
-
|
|
630
|
+
|
|
630
631
|
def OnDraw(self, evt):
|
|
631
632
|
"""Called before canvas.draw."""
|
|
632
633
|
pass
|
|
633
|
-
|
|
634
|
+
|
|
634
635
|
def OnMotion(self, evt):
|
|
635
636
|
"""Called when mouse moves in axes."""
|
|
636
637
|
if not self.selector.size:
|
|
637
638
|
self.trace_point(evt.xdata, evt.ydata)
|
|
638
|
-
|
|
639
|
+
|
|
639
640
|
def OnForwardPosition(self, evt):
|
|
640
641
|
"""Go forward view position."""
|
|
641
642
|
self.toolbar.forward()
|
|
642
643
|
self.draw()
|
|
643
|
-
|
|
644
|
+
|
|
644
645
|
def OnBackPosition(self, evt):
|
|
645
646
|
"""Go backward view position."""
|
|
646
647
|
self.toolbar.back()
|
|
647
648
|
self.draw()
|
|
648
|
-
|
|
649
|
+
|
|
649
650
|
def OnHomePosition(self, evt):
|
|
650
651
|
"""Go back to home position."""
|
|
651
652
|
self.toolbar.home()
|
|
652
653
|
self.toolbar.update()
|
|
653
654
|
self.toolbar.push_current()
|
|
654
655
|
self.draw()
|
|
655
|
-
|
|
656
|
+
|
|
656
657
|
def OnEscapeSelection(self, evt):
|
|
657
658
|
"""Escape from selection."""
|
|
658
659
|
del self.selector
|
|
659
660
|
self.canvas.draw_idle()
|
|
660
|
-
|
|
661
|
+
|
|
661
662
|
def zoomlim(self, lim, M, c=None):
|
|
662
663
|
## The limitation of zoom is necessary; If the axes is enlarged too much,
|
|
663
664
|
## the processing speed will significantly slow down.
|
|
@@ -666,7 +667,7 @@ class MatplotPanel(wx.Panel):
|
|
|
666
667
|
y = c - M * (c - lim)
|
|
667
668
|
if abs(y[1] - y[0]) > self.ZOOM_LIMIT:
|
|
668
669
|
return y
|
|
669
|
-
|
|
670
|
+
|
|
670
671
|
def OnZoom(self, evt):
|
|
671
672
|
M = 1/self.ZOOM_RATIO if evt.key[-1] in '+;' else self.ZOOM_RATIO
|
|
672
673
|
self.xlim = x = self.zoomlim(self.xlim, M)
|
|
@@ -675,7 +676,7 @@ class MatplotPanel(wx.Panel):
|
|
|
675
676
|
if x is not None or y is not None:
|
|
676
677
|
self.toolbar.push_current()
|
|
677
678
|
self.draw()
|
|
678
|
-
|
|
679
|
+
|
|
679
680
|
def OnScrollZoom(self, evt):
|
|
680
681
|
M = 1/self.ZOOM_RATIO if evt.button == 'up' else self.ZOOM_RATIO
|
|
681
682
|
self.xlim = x = self.zoomlim(self.xlim, M, evt.xdata if evt.inaxes else None)
|
|
@@ -684,35 +685,35 @@ class MatplotPanel(wx.Panel):
|
|
|
684
685
|
if x is not None or y is not None:
|
|
685
686
|
self.toolbar.push_current()
|
|
686
687
|
self.draw()
|
|
687
|
-
|
|
688
|
+
|
|
688
689
|
def OnPanBegin(self, evt):
|
|
689
690
|
"""Toolbar pan - While panning, press x/y to constrain the direction."""
|
|
690
691
|
## self.toolbar.set_cursor(2)
|
|
691
692
|
self.set_wxcursor(wx.CURSOR_HAND)
|
|
692
693
|
self.toolbar.pan()
|
|
693
694
|
self.__prev = self.handler.previous_state # save previous state of PAN
|
|
694
|
-
|
|
695
|
+
|
|
695
696
|
def OnPanEnd(self, evt):
|
|
696
697
|
## self.toolbar.set_cursor(1)
|
|
697
698
|
self.set_wxcursor(wx.CURSOR_ARROW)
|
|
698
699
|
self.toolbar.pan()
|
|
699
700
|
self.handler.current_state = self.__prev # --> previous state of PAN
|
|
700
701
|
del self.__prev
|
|
701
|
-
|
|
702
|
+
|
|
702
703
|
def OnZoomBegin(self, evt):
|
|
703
704
|
"""Toolbar zoom - While zooming, press x/y to constrain the direction."""
|
|
704
705
|
## self.toolbar.set_cursor(3)
|
|
705
706
|
self.set_wxcursor(wx.CURSOR_CROSS)
|
|
706
707
|
self.toolbar.zoom()
|
|
707
708
|
self.__prev = self.handler.previous_state # save previous state of ZOOM
|
|
708
|
-
|
|
709
|
+
|
|
709
710
|
def OnZoomEnd(self, evt):
|
|
710
711
|
## self.toolbar.set_cursor(1)
|
|
711
712
|
self.set_wxcursor(wx.CURSOR_ARROW)
|
|
712
713
|
self.toolbar.zoom()
|
|
713
714
|
self.handler.current_state = self.__prev # --> previous state of ZOOM
|
|
714
715
|
del self.__prev
|
|
715
|
-
|
|
716
|
+
|
|
716
717
|
## def OnZoomMove(self, evt):
|
|
717
718
|
## """Zoom."""
|
|
718
719
|
## ## http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/189744
|
|
@@ -759,39 +760,39 @@ class MatplotPanel(wx.Panel):
|
|
|
759
760
|
## pass
|
|
760
761
|
## self.toolbar.set_cursor(1)
|
|
761
762
|
## self.draw()
|
|
762
|
-
|
|
763
|
+
|
|
763
764
|
## --------------------------------
|
|
764
765
|
## Axis actions
|
|
765
766
|
## --------------------------------
|
|
766
|
-
|
|
767
|
+
|
|
767
768
|
def OnHomeXPosition(self, evt):
|
|
768
769
|
self.OnHomePosition(evt)
|
|
769
|
-
|
|
770
|
+
|
|
770
771
|
def OnHomeYPosition(self, evt):
|
|
771
772
|
self.OnHomePosition(evt)
|
|
772
|
-
|
|
773
|
+
|
|
773
774
|
def OnAxisEnter(self, evt):
|
|
774
775
|
self.set_wxcursor(wx.CURSOR_HAND)
|
|
775
|
-
|
|
776
|
+
|
|
776
777
|
def OnAxisLeave(self, evt):
|
|
777
778
|
self.set_wxcursor(wx.CURSOR_ARROW)
|
|
778
|
-
|
|
779
|
+
|
|
779
780
|
def OnAxisDragBegin(self, evt):
|
|
780
781
|
org = self.p_event
|
|
781
782
|
w, h = self.canvas.Size
|
|
782
783
|
p = self.canvas.ScreenToClient(wx.GetMousePosition())
|
|
783
784
|
org.x, org.y = (p[0], h-p[1])
|
|
784
785
|
org.xdata, org.ydata = self.mapdisp2xy(org.x, org.y) # p_event overwrites
|
|
785
|
-
|
|
786
|
+
|
|
786
787
|
def OnAxisDragEnd(self, evt):
|
|
787
788
|
self.toolbar.push_current()
|
|
788
789
|
if evt.inaxes:
|
|
789
790
|
self.handler('axes_enter', evt)
|
|
790
|
-
|
|
791
|
+
|
|
791
792
|
def OnXAxisPanMove(self, evt):
|
|
792
793
|
self.xlim -= (evt.xdata - self.p_event.xdata)
|
|
793
794
|
self.draw()
|
|
794
|
-
|
|
795
|
+
|
|
795
796
|
def OnXAxisPanZoom(self, evt, c=None):
|
|
796
797
|
org = self.p_event
|
|
797
798
|
M = np.exp(-(evt.x - org.x)/100)
|
|
@@ -800,14 +801,14 @@ class MatplotPanel(wx.Panel):
|
|
|
800
801
|
self.xlim = self.zoomlim(self.xlim, M, c)
|
|
801
802
|
org.x, org.y = evt.x, evt.y
|
|
802
803
|
self.draw()
|
|
803
|
-
|
|
804
|
+
|
|
804
805
|
def OnXAxisPanZoomOrig(self, evt):
|
|
805
806
|
self.OnXAxisPanZoom(evt, c=self.xlim[0])
|
|
806
|
-
|
|
807
|
+
|
|
807
808
|
def OnYAxisPanMove(self, evt):
|
|
808
809
|
self.ylim -= (evt.ydata - self.p_event.ydata)
|
|
809
810
|
self.draw()
|
|
810
|
-
|
|
811
|
+
|
|
811
812
|
def OnYAxisPanZoom(self, evt, c=None):
|
|
812
813
|
org = self.p_event
|
|
813
814
|
M = np.exp(-(evt.y - org.y)/100)
|
|
@@ -816,9 +817,9 @@ class MatplotPanel(wx.Panel):
|
|
|
816
817
|
self.ylim = self.zoomlim(self.ylim, M, c)
|
|
817
818
|
org.x, org.y = evt.x, evt.y
|
|
818
819
|
self.draw()
|
|
819
|
-
|
|
820
|
+
|
|
820
821
|
def OnYAxisPanZoomOrig(self, evt):
|
|
821
822
|
self.OnYAxisPanZoom(evt, c=self.ylim[0])
|
|
822
|
-
|
|
823
|
+
|
|
823
824
|
def OnYAxisPanZoomEdge(self, evt):
|
|
824
825
|
self.OnYAxisPanZoom(evt, c=self.ylim[1])
|