mwxlib 1.2.4__py3-none-any.whl → 1.2.5__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/controls.py +5 -3
- mwx/framework.py +1 -1
- mwx/matplot2g.py +31 -40
- mwx/utilus.py +10 -9
- {mwxlib-1.2.4.dist-info → mwxlib-1.2.5.dist-info}/METADATA +1 -1
- {mwxlib-1.2.4.dist-info → mwxlib-1.2.5.dist-info}/RECORD +9 -9
- {mwxlib-1.2.4.dist-info → mwxlib-1.2.5.dist-info}/LICENSE +0 -0
- {mwxlib-1.2.4.dist-info → mwxlib-1.2.5.dist-info}/WHEEL +0 -0
- {mwxlib-1.2.4.dist-info → mwxlib-1.2.5.dist-info}/top_level.txt +0 -0
mwx/controls.py
CHANGED
|
@@ -770,6 +770,7 @@ class Clipboard:
|
|
|
770
770
|
return text
|
|
771
771
|
else:
|
|
772
772
|
print("- Unable to open clipboard.")
|
|
773
|
+
return None
|
|
773
774
|
|
|
774
775
|
@staticmethod
|
|
775
776
|
def write(text, verbose=False):
|
|
@@ -792,7 +793,7 @@ class Clipboard:
|
|
|
792
793
|
bmp = do.GetBitmap()
|
|
793
794
|
else:
|
|
794
795
|
print("- Unable to open clipboard.")
|
|
795
|
-
return
|
|
796
|
+
return None
|
|
796
797
|
try:
|
|
797
798
|
## Convert bmp --> buf
|
|
798
799
|
img = bmp.ConvertToImage()
|
|
@@ -802,7 +803,8 @@ class Clipboard:
|
|
|
802
803
|
w, h = img.GetSize()
|
|
803
804
|
return buf.reshape(h, w, 3)
|
|
804
805
|
except Exception:
|
|
805
|
-
print("-
|
|
806
|
+
print("- Contents of the clipboard are not images.")
|
|
807
|
+
return None
|
|
806
808
|
|
|
807
809
|
@staticmethod
|
|
808
810
|
def imwrite(buf, verbose=False):
|
|
@@ -815,7 +817,7 @@ class Clipboard:
|
|
|
815
817
|
img = wx.Image(w, h, buf.tobytes())
|
|
816
818
|
bmp = img.ConvertToBitmap()
|
|
817
819
|
except Exception:
|
|
818
|
-
print("-
|
|
820
|
+
print("- Argument 'buf' is not a 2d array.")
|
|
819
821
|
return
|
|
820
822
|
do = wx.BitmapDataObject(bmp)
|
|
821
823
|
if wx.TheClipboard.Open():
|
mwx/framework.py
CHANGED
mwx/matplot2g.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#! python3
|
|
2
2
|
"""mwxlib graph plot for images.
|
|
3
3
|
"""
|
|
4
|
-
import traceback
|
|
5
4
|
import wx
|
|
6
5
|
|
|
7
6
|
from matplotlib import cm
|
|
@@ -49,6 +48,11 @@ def _to_buffer(img):
|
|
|
49
48
|
w, h = img.GetSize()
|
|
50
49
|
img = np.frombuffer(img.GetDataBuffer(), dtype='uint8').reshape(h, w, 3)
|
|
51
50
|
|
|
51
|
+
if not isinstance(img, np.ndarray):
|
|
52
|
+
raise ValueError("targets must be arrays or images.")
|
|
53
|
+
|
|
54
|
+
assert img.ndim > 1, "targets must be 2d arrays."
|
|
55
|
+
|
|
52
56
|
if img.ndim > 2:
|
|
53
57
|
return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
|
|
54
58
|
return img
|
|
@@ -630,10 +634,6 @@ class GraphPlot(MatplotPanel):
|
|
|
630
634
|
if isinstance(buf, str):
|
|
631
635
|
buf = Image.open(buf)
|
|
632
636
|
|
|
633
|
-
if not isinstance(buf, (np.ndarray, Image.Image, wx.Bitmap, wx.Image)):
|
|
634
|
-
warn("Load targets must be either arrays or images.")
|
|
635
|
-
return None
|
|
636
|
-
|
|
637
637
|
pathname = kwargs.get('pathname')
|
|
638
638
|
paths = [art.pathname for art in self.__Arts]
|
|
639
639
|
names = [art.name for art in self.__Arts]
|
|
@@ -700,22 +700,19 @@ class GraphPlot(MatplotPanel):
|
|
|
700
700
|
return buffers[j] # j can also be slicing
|
|
701
701
|
|
|
702
702
|
def __setitem__(self, j, v):
|
|
703
|
+
if v is None:
|
|
704
|
+
raise ValueError("values must be buffers, not NoneType.")
|
|
705
|
+
|
|
703
706
|
if isinstance(j, str):
|
|
704
|
-
|
|
705
|
-
j = self.index(j) # overwrite buffer
|
|
706
|
-
except ValueError:
|
|
707
|
-
return self.load(v, name=j) # new buffer
|
|
707
|
+
return self.load(v, name=j) # update buffer or new buffer
|
|
708
708
|
|
|
709
709
|
if isinstance(j, slice):
|
|
710
710
|
raise ValueError("attempt to assign buffers via slicing")
|
|
711
711
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
art.update_buffer(v) # update buffer
|
|
717
|
-
art.update_extent()
|
|
718
|
-
self.select(j)
|
|
712
|
+
art = self.__Arts[j]
|
|
713
|
+
art.update_buffer(v) # update buffer
|
|
714
|
+
art.update_extent()
|
|
715
|
+
self.select(j)
|
|
719
716
|
|
|
720
717
|
def __delitem__(self, j):
|
|
721
718
|
if isinstance(j, str):
|
|
@@ -962,34 +959,28 @@ class GraphPlot(MatplotPanel):
|
|
|
962
959
|
if not frame:
|
|
963
960
|
self.message("No frame")
|
|
964
961
|
return
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
except Exception as e:
|
|
974
|
-
traceback.print_exc()
|
|
975
|
-
self.message("- Failed to write to clipboard.", e)
|
|
962
|
+
|
|
963
|
+
name = frame.name
|
|
964
|
+
data = frame.roi
|
|
965
|
+
GraphPlot.clipboard_name = name
|
|
966
|
+
GraphPlot.clipboard_data = data
|
|
967
|
+
bins, vlim, img = _to_image(data, frame.cuts)
|
|
968
|
+
Clipboard.imwrite(img)
|
|
969
|
+
self.message("Write buffer to clipboard.")
|
|
976
970
|
|
|
977
971
|
def read_buffer_from_clipboard(self):
|
|
978
972
|
"""Read buffer data from clipboard."""
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
973
|
+
name = GraphPlot.clipboard_name
|
|
974
|
+
data = GraphPlot.clipboard_data
|
|
975
|
+
if name:
|
|
976
|
+
self.message("Read buffer from clipboard.")
|
|
977
|
+
GraphPlot.clipboard_name = None
|
|
978
|
+
GraphPlot.clipboard_data = None
|
|
979
|
+
else:
|
|
980
|
+
self.message("Read image from clipboard.")
|
|
981
|
+
data = Clipboard.imread()
|
|
982
|
+
if data is not None:
|
|
989
983
|
self.load(data)
|
|
990
|
-
except Exception as e:
|
|
991
|
-
traceback.print_exc()
|
|
992
|
-
self.message("- No data in clipboard.", e)
|
|
993
984
|
|
|
994
985
|
def destroy_colorbar(self):
|
|
995
986
|
if self.cbar:
|
mwx/utilus.py
CHANGED
|
@@ -37,15 +37,16 @@ def ignore(*category):
|
|
|
37
37
|
yield
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
def warn(message, category=None):
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
frame
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
def warn(message, category=None, stacklevel=None):
|
|
41
|
+
if stacklevel is None:
|
|
42
|
+
frame = inspect.currentframe().f_back # previous call stack frame
|
|
43
|
+
skip = [frame.f_code.co_filename]
|
|
44
|
+
stacklevel = 1
|
|
45
|
+
while frame.f_code.co_filename in skip:
|
|
46
|
+
frame = frame.f_back
|
|
47
|
+
if not frame:
|
|
48
|
+
break
|
|
49
|
+
stacklevel += 1
|
|
49
50
|
return warnings.warn(message, category, stacklevel+1)
|
|
50
51
|
|
|
51
52
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
mwx/__init__.py,sha256=pS7ZG8QKRypiFFiaWAq_opBB6I_1viZ0zUMk2TbjzE0,667
|
|
2
2
|
mwx/bookshelf.py,sha256=b_TMDaNIzLHoL0xbbqb3tt0BnRvhLAqaCn_pBdrigZw,7523
|
|
3
|
-
mwx/controls.py,sha256=
|
|
4
|
-
mwx/framework.py,sha256=
|
|
3
|
+
mwx/controls.py,sha256=5PCy3zguDRuwYl89P9tOCUU7xAGUETs944qZBy5MS9g,48146
|
|
4
|
+
mwx/framework.py,sha256=c0o6IXrdgvfpnPXHPNYU7isqzOydXwtiMY7-qRXMFyQ,76125
|
|
5
5
|
mwx/graphman.py,sha256=RqD0W9I2BvJ3Q2kyMiyyg4n-T4-_x7PDuCI5bGAg5k4,70110
|
|
6
6
|
mwx/images.py,sha256=oxCn0P-emiWujSS2gUgU5TUnr5cPjix2jBcjOBDr24I,48701
|
|
7
7
|
mwx/matplot2.py,sha256=Zwte-wwzCg_OHzsBniVgKdaNLzsvJaa1gc0n7VdAqxw,33150
|
|
8
|
-
mwx/matplot2g.py,sha256=
|
|
8
|
+
mwx/matplot2g.py,sha256=ywvu5-QAIgv4jc1kalNYgVGcl4RoY9Y1Dx1qtteaqXk,64195
|
|
9
9
|
mwx/matplot2lg.py,sha256=JRWjWnLJUytbSq6wxs4P0gbVUr3xoLSF6Wwqd5V_pJI,27404
|
|
10
10
|
mwx/mgplt.py,sha256=8mXbHpCmm7lz3XbAxOg7IVC7DaSGBEby1UfTlMl9kjk,5604
|
|
11
11
|
mwx/nutshell.py,sha256=7nQ7UUFM9kvjDjHNUEdOkkeqZPiU6zOERwamqBdJpQs,140856
|
|
12
12
|
mwx/testsuite.py,sha256=kiM3-BVhr42LRRN7xG7pYl3at8o2vnypWSxD8KRvA7c,1228
|
|
13
|
-
mwx/utilus.py,sha256=
|
|
13
|
+
mwx/utilus.py,sha256=bDeooo2bOcZwvkIdi0ElkT-qoblqzHNFsIveb72NFOo,37528
|
|
14
14
|
mwx/wxmon.py,sha256=yzWqrbY6LzpfRwQeytYUeqFhFuLVm_XEvrVAL_k0HBQ,12756
|
|
15
15
|
mwx/wxpdb.py,sha256=ge4hNfeigHGcpnioU1B_BJX_QZjNdtnokUrcZOxcEcI,18814
|
|
16
16
|
mwx/wxwil.py,sha256=hhyB1lPrF9ixeObxCOKQv0Theu-B-kpJg_yVU3EGSNg,5406
|
|
@@ -22,8 +22,8 @@ mwx/plugins/frame_listview.py,sha256=gowjQ-ARNonMkDSXkQgPKq4U9YBJ-vQ0jK2krBVOdCs
|
|
|
22
22
|
mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
|
|
23
23
|
mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
|
|
24
24
|
mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
|
|
25
|
-
mwxlib-1.2.
|
|
26
|
-
mwxlib-1.2.
|
|
27
|
-
mwxlib-1.2.
|
|
28
|
-
mwxlib-1.2.
|
|
29
|
-
mwxlib-1.2.
|
|
25
|
+
mwxlib-1.2.5.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
26
|
+
mwxlib-1.2.5.dist-info/METADATA,sha256=HZpDkw3rpf_1eFrLWB4UFT2sGfuJQ0nDV7cUyWuot-w,7258
|
|
27
|
+
mwxlib-1.2.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
28
|
+
mwxlib-1.2.5.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
29
|
+
mwxlib-1.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|