mwxlib 1.0.4__py3-none-any.whl → 1.0.6__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/framework.py +4 -4
- mwx/matplot2g.py +2 -0
- mwx/nutshell.py +8 -7
- mwx/plugins/ffmpeg_view.py +34 -28
- {mwxlib-1.0.4.dist-info → mwxlib-1.0.6.dist-info}/METADATA +1 -1
- {mwxlib-1.0.4.dist-info → mwxlib-1.0.6.dist-info}/RECORD +9 -9
- {mwxlib-1.0.4.dist-info → mwxlib-1.0.6.dist-info}/LICENSE +0 -0
- {mwxlib-1.0.4.dist-info → mwxlib-1.0.6.dist-info}/WHEEL +0 -0
- {mwxlib-1.0.4.dist-info → mwxlib-1.0.6.dist-info}/top_level.txt +0 -0
mwx/framework.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#! python3
|
|
2
2
|
"""mwxlib framework.
|
|
3
3
|
"""
|
|
4
|
-
__version__ = "1.0.
|
|
4
|
+
__version__ = "1.0.6"
|
|
5
5
|
__author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
|
|
6
6
|
|
|
7
7
|
from contextlib import contextmanager
|
|
@@ -395,9 +395,9 @@ class CtrlInterface(KeyCtrlInterfaceMixin):
|
|
|
395
395
|
|
|
396
396
|
def on_hotkey_press(self, evt): #<wx._core.KeyEvent>
|
|
397
397
|
"""Called when a key is pressed."""
|
|
398
|
-
if evt.EventObject is not self:
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
## if evt.EventObject is not self:
|
|
399
|
+
## evt.Skip()
|
|
400
|
+
## return
|
|
401
401
|
key = hotkey(evt)
|
|
402
402
|
self.__key = regulate_key(key + '-')
|
|
403
403
|
if self.handler('{} pressed'.format(key), evt) is None:
|
mwx/matplot2g.py
CHANGED
|
@@ -48,6 +48,8 @@ def _to_buffer(img):
|
|
|
48
48
|
if isinstance(img, wx.Image): # image to RGB array; RGB to grayscale
|
|
49
49
|
w, h = img.GetSize()
|
|
50
50
|
img = np.frombuffer(img.GetDataBuffer(), dtype='uint8').reshape(h, w, 3)
|
|
51
|
+
|
|
52
|
+
if img.ndim > 2:
|
|
51
53
|
return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
|
|
52
54
|
return img
|
|
53
55
|
|
mwx/nutshell.py
CHANGED
|
@@ -1847,7 +1847,7 @@ class Buffer(EditorInterface, EditWindow):
|
|
|
1847
1847
|
"""Fork events to the parent."""
|
|
1848
1848
|
self.parent.handler(self.handler.current_event, evt)
|
|
1849
1849
|
|
|
1850
|
-
## Note:
|
|
1850
|
+
## Note: Mouse events are not propagated from Buffer to EditorBook.
|
|
1851
1851
|
## They are explicitly dispatched from buffer.handler to editor.handler.
|
|
1852
1852
|
|
|
1853
1853
|
self.handler.update({ # DNA<Buffer>
|
|
@@ -1867,8 +1867,9 @@ class Buffer(EditorInterface, EditWindow):
|
|
|
1867
1867
|
'*[LR]win pressed' : (-1, ),
|
|
1868
1868
|
},
|
|
1869
1869
|
0 : { # Normal mode
|
|
1870
|
-
'* pressed' : (0, skip
|
|
1870
|
+
'* pressed' : (0, skip),
|
|
1871
1871
|
'* released' : (0, skip, dispatch),
|
|
1872
|
+
'*button* pressed' : (0, skip, dispatch),
|
|
1872
1873
|
'escape pressed' : (-1, self.on_enter_escmap),
|
|
1873
1874
|
'C-h pressed' : (0, self.call_helpTip),
|
|
1874
1875
|
'. pressed' : (2, self.OnEnterDot),
|
|
@@ -2209,10 +2210,11 @@ class EditorBook(AuiNotebook, CtrlInterface):
|
|
|
2209
2210
|
'buffer_activated' : [ None, dispatch, self.on_activated ],
|
|
2210
2211
|
'buffer_inactivated' : [ None, dispatch, self.on_inactivated ],
|
|
2211
2212
|
'buffer_caption_updated' : [ None, dispatch ],
|
|
2212
|
-
'*button* pressed' : [ None, dispatch, skip ],
|
|
2213
|
-
'*button* released' : [ None, dispatch, skip ],
|
|
2214
2213
|
},
|
|
2215
2214
|
0 : { # Normal mode
|
|
2215
|
+
'* pressed' : (0, skip),
|
|
2216
|
+
'* released' : (0, skip, dispatch),
|
|
2217
|
+
'*button* pressed' : (0, skip, dispatch),
|
|
2216
2218
|
'M-up pressed' : (0, _F(self.previous_buffer)),
|
|
2217
2219
|
'M-down pressed' : (0, _F(self.next_buffer)),
|
|
2218
2220
|
},
|
|
@@ -2817,8 +2819,6 @@ class Nautilus(EditorInterface, Shell):
|
|
|
2817
2819
|
'shell_modified' : [ None, dispatch ],
|
|
2818
2820
|
'shell_activated' : [ None, dispatch, self.on_activated ],
|
|
2819
2821
|
'shell_inactivated' : [ None, dispatch, self.on_inactivated ],
|
|
2820
|
-
'*button* pressed' : [ None, dispatch, skip ],
|
|
2821
|
-
'*button* released' : [ None, dispatch, skip ],
|
|
2822
2822
|
},
|
|
2823
2823
|
-1 : { # original action of the wx.py.shell
|
|
2824
2824
|
'* pressed' : (0, skip, self.on_exit_escmap),
|
|
@@ -2835,7 +2835,8 @@ class Nautilus(EditorInterface, Shell):
|
|
|
2835
2835
|
},
|
|
2836
2836
|
0 : { # Normal mode
|
|
2837
2837
|
'* pressed' : (0, skip),
|
|
2838
|
-
'* released' : (0, skip),
|
|
2838
|
+
'* released' : (0, skip, dispatch),
|
|
2839
|
+
'*button* pressed' : (0, skip, dispatch),
|
|
2839
2840
|
'escape pressed' : (-1, self.on_enter_escmap),
|
|
2840
2841
|
'space pressed' : (0, self.OnSpace),
|
|
2841
2842
|
'*backspace pressed' : (0, self.OnBackspace),
|
mwx/plugins/ffmpeg_view.py
CHANGED
|
@@ -109,8 +109,8 @@ class Plugin(Layer):
|
|
|
109
109
|
self.snp = Button(self, handler=self.snapshot, icon='clip')
|
|
110
110
|
self.exp = Button(self, handler=self.export, icon='save')
|
|
111
111
|
|
|
112
|
-
self.rw = Button(self, handler=lambda v: self.
|
|
113
|
-
self.fw = Button(self, handler=lambda v: self.
|
|
112
|
+
self.rw = Button(self, handler=lambda v: self.seekto(-100), icon='|<-')
|
|
113
|
+
self.fw = Button(self, handler=lambda v: self.seekto(+100), icon='->|')
|
|
114
114
|
|
|
115
115
|
self.layout((self.mc,), expand=2)
|
|
116
116
|
self.layout((self.ss, self.to, self.rw, self.fw,
|
|
@@ -130,14 +130,24 @@ class Plugin(Layer):
|
|
|
130
130
|
self.parent.handler.bind("unknown_format", self.load_media)
|
|
131
131
|
|
|
132
132
|
self.handler.update({ # DNA<ffmpeg_viewer>
|
|
133
|
-
0 : {
|
|
134
|
-
'play' : (
|
|
135
|
-
'space pressed' : (
|
|
133
|
+
0 : { # MEDIASTATE_STOPPED
|
|
134
|
+
'play' : (2, ),
|
|
135
|
+
'space pressed' : (2, _F(self.mc.Play)),
|
|
136
|
+
'left pressed' : (0, _F(self.seekd, -1000)),
|
|
137
|
+
'right pressed' : (0, _F(self.seekd, 1000)),
|
|
136
138
|
},
|
|
137
|
-
1 : {
|
|
139
|
+
1 : { # MEDIASTATE_PAUSED
|
|
138
140
|
'stop' : (0, ),
|
|
139
|
-
|
|
141
|
+
'space pressed' : (2, _F(self.mc.Play)),
|
|
142
|
+
'left pressed' : (1, _F(self.seekd, -1000)),
|
|
143
|
+
'right pressed' : (1, _F(self.seekd, 1000)),
|
|
144
|
+
},
|
|
145
|
+
2 : { # MEDIASTATE_PLAYING
|
|
146
|
+
'stop' : (0, ),
|
|
147
|
+
'pause' : (1, ),
|
|
140
148
|
'space pressed' : (1, _F(self.mc.Pause)),
|
|
149
|
+
'left pressed' : (2, _F(self.seekd, -1000)),
|
|
150
|
+
'right pressed' : (2, _F(self.seekd, 1000)),
|
|
141
151
|
},
|
|
142
152
|
})
|
|
143
153
|
|
|
@@ -145,10 +155,8 @@ class Plugin(Layer):
|
|
|
145
155
|
self.mc.Bind(wx.media.EVT_MEDIA_PLAY, partial(self.handler, 'play'))
|
|
146
156
|
self.mc.Bind(wx.media.EVT_MEDIA_STOP, partial(self.handler, 'stop'))
|
|
147
157
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
self.mc.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
|
|
151
|
-
self.mc.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
|
|
158
|
+
self.mc.Bind(wx.EVT_KEY_DOWN, self.on_hotkey_down)
|
|
159
|
+
self.mc.Bind(wx.EVT_KEY_UP, self.on_hotkey_up)
|
|
152
160
|
|
|
153
161
|
self.Bind(wx.EVT_SHOW, self.OnShow)
|
|
154
162
|
|
|
@@ -158,14 +166,6 @@ class Plugin(Layer):
|
|
|
158
166
|
finally:
|
|
159
167
|
return Layer.Destroy(self)
|
|
160
168
|
|
|
161
|
-
def OnKeyDown(self, evt):
|
|
162
|
-
if self.handler('{} pressed'.format(hotkey(evt)), evt) is None:
|
|
163
|
-
evt.Skip()
|
|
164
|
-
|
|
165
|
-
def OnKeyUp(self, evt):
|
|
166
|
-
if self.handler('{} released'.format(hotkey(evt)), evt) is None:
|
|
167
|
-
evt.Skip()
|
|
168
|
-
|
|
169
169
|
def OnShow(self, evt):
|
|
170
170
|
if not evt.IsShown():
|
|
171
171
|
if self.mc:
|
|
@@ -250,18 +250,24 @@ class Plugin(Layer):
|
|
|
250
250
|
crop = "{}:{}:0:0".format(*self.video_size)
|
|
251
251
|
self.crop.Value = crop
|
|
252
252
|
|
|
253
|
-
def
|
|
254
|
-
"""Seek
|
|
255
|
-
if wx.GetKeyState(wx.WXK_SHIFT):
|
|
256
|
-
offset /= 10
|
|
253
|
+
def seekto(self, offset):
|
|
254
|
+
"""Seek position with offset [ms] from the `to` position."""
|
|
257
255
|
try:
|
|
258
256
|
t = self.to.value + offset/1000
|
|
259
|
-
|
|
260
|
-
print(e)
|
|
261
|
-
else:
|
|
262
|
-
if self._path and 0 <= t < self.video_dur:
|
|
257
|
+
if 0 <= t < self.video_dur:
|
|
263
258
|
self.to.value = round(t, 3)
|
|
264
|
-
self.set_offset(self.to)
|
|
259
|
+
self.set_offset(self.to)
|
|
260
|
+
except AttributeError:
|
|
261
|
+
pass
|
|
262
|
+
|
|
263
|
+
def seekd(self, offset):
|
|
264
|
+
"""Seek position with offset [ms] from the current position."""
|
|
265
|
+
try:
|
|
266
|
+
t = self.mc.Tell() + offset
|
|
267
|
+
if 0 <= t < self.video_dur * 1000:
|
|
268
|
+
self.mc.Seek(self.DELTA + t)
|
|
269
|
+
except AttributeError:
|
|
270
|
+
pass
|
|
265
271
|
|
|
266
272
|
def snapshot(self):
|
|
267
273
|
"""Create a snapshot of the current frame.
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
mwx/__init__.py,sha256=psabnAMei5VzB2TsB2qBNLrIZMX0LiqjlXCpNGmDejk,668
|
|
2
2
|
mwx/bookshelf.py,sha256=so-xSLq08sMlJBErTxOaDoKUAMa_g1CkIP2pNnff68c,5607
|
|
3
3
|
mwx/controls.py,sha256=iXNTk4ge6sHStenjxC7bFKgQHvqxMwfb82IbgiDmtEk,47944
|
|
4
|
-
mwx/framework.py,sha256=
|
|
4
|
+
mwx/framework.py,sha256=Y0YBqjcbfPMTqal_-vN9LPAXaHVNTYbxQ1UpMbVAb_8,75818
|
|
5
5
|
mwx/graphman.py,sha256=mDnhy3jAzZCo8_p6ZcA-NDPMuOyW_R2r_fuxUIAM7D8,69669
|
|
6
6
|
mwx/images.py,sha256=oxCn0P-emiWujSS2gUgU5TUnr5cPjix2jBcjOBDr24I,48701
|
|
7
7
|
mwx/matplot2.py,sha256=zA56jIdRUdzu-wrmPai1PSOjzqV2Erqw2yFKW-jwdA8,32901
|
|
8
|
-
mwx/matplot2g.py,sha256=
|
|
8
|
+
mwx/matplot2g.py,sha256=4G5uZJZzATEC3QEVZ4pGHetEDfu5NJNUFyeAaQScK5s,64495
|
|
9
9
|
mwx/matplot2lg.py,sha256=JRWjWnLJUytbSq6wxs4P0gbVUr3xoLSF6Wwqd5V_pJI,27404
|
|
10
10
|
mwx/mgplt.py,sha256=M5rt-H7Uq1OHnlFvMA4a3945UBvppbR9L_mw8NL_YZ0,5602
|
|
11
|
-
mwx/nutshell.py,sha256=
|
|
11
|
+
mwx/nutshell.py,sha256=9QeJXQluEmZSB0B8rGSH9SU_WvjCymmDdU0DKd3fkko,142076
|
|
12
12
|
mwx/utilus.py,sha256=Yyw8L1f-ikhyd7wtFXYtsOswofWxmB4GAmLOZnhUXeU,37388
|
|
13
13
|
mwx/wxmon.py,sha256=yzWqrbY6LzpfRwQeytYUeqFhFuLVm_XEvrVAL_k0HBQ,12756
|
|
14
14
|
mwx/wxpdb.py,sha256=--TQr-_zs9dWPYV2V4s3Zr4abvN14o5wD8anT9frHUg,18875
|
|
15
15
|
mwx/wxwil.py,sha256=hhyB1lPrF9ixeObxCOKQv0Theu-B-kpJg_yVU3EGSNg,5406
|
|
16
16
|
mwx/wxwit.py,sha256=1hHtMi2YEy2T_LnUpwdmrIdtCuvxMOFyykqnbq6jLP0,7294
|
|
17
17
|
mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
|
|
18
|
-
mwx/plugins/ffmpeg_view.py,sha256=
|
|
18
|
+
mwx/plugins/ffmpeg_view.py,sha256=Yp1BMeNfkTTPwykvWW1_h4wrvhBSeBUdAvKhnMQIa6g,11102
|
|
19
19
|
mwx/plugins/fft_view.py,sha256=08A_Y73XirV7kXpwf-v0mUA0Hr0MOfdMXv3tvL1hvWA,2789
|
|
20
20
|
mwx/plugins/frame_listview.py,sha256=gowjQ-ARNonMkDSXkQgPKq4U9YBJ-vQ0jK2krBVOdCs,10420
|
|
21
21
|
mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
|
|
22
22
|
mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
|
|
23
23
|
mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
|
|
24
|
-
mwxlib-1.0.
|
|
25
|
-
mwxlib-1.0.
|
|
26
|
-
mwxlib-1.0.
|
|
27
|
-
mwxlib-1.0.
|
|
28
|
-
mwxlib-1.0.
|
|
24
|
+
mwxlib-1.0.6.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
|
|
25
|
+
mwxlib-1.0.6.dist-info/METADATA,sha256=p5q3rC09GOoq4pW_UWNKP7Z1SvrX24kKCy-I19tKmts,7259
|
|
26
|
+
mwxlib-1.0.6.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
27
|
+
mwxlib-1.0.6.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
|
|
28
|
+
mwxlib-1.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|