mwxlib 1.3.11__py3-none-any.whl → 1.4.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/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "1.3.11"
4
+ __version__ = "1.4.0"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from contextlib import contextmanager
@@ -1420,7 +1420,7 @@ class ShellFrame(MiniFrame):
1420
1420
 
1421
1421
  def OnClose(self, evt):
1422
1422
  if self.debugger.busy:
1423
- if wx.MessageBox( # Confirm debugger close.
1423
+ if wx.MessageBox( # Confirm closing the debugger.
1424
1424
  "The debugger is running.\n\n"
1425
1425
  "Enter [q]uit to exit before closing.\n"
1426
1426
  "Continue closing?",
@@ -1441,7 +1441,7 @@ class ShellFrame(MiniFrame):
1441
1441
  if buf.need_buffer_save:
1442
1442
  self.popup_window(book)
1443
1443
  buf.SetFocus()
1444
- if wx.MessageBox( # Confirm close.
1444
+ if wx.MessageBox( # Confirm closing the buffer.
1445
1445
  "You are closing unsaved content.\n\n"
1446
1446
  "Changes to the content will be discarded.\n"
1447
1447
  "Continue closing?",
mwx/graphman.py CHANGED
@@ -152,32 +152,38 @@ class Thread:
152
152
  raise KeyboardInterrupt("terminated by user")
153
153
  return True
154
154
 
155
- def pause(self, msg="Pausing..."):
155
+ def pause(self, msg=None, caption=wx.MessageBoxCaptionStr):
156
156
  """Pause the thread.
157
+ Confirm whether to terminate the thread.
157
158
 
158
- Use ``check`` method where you want to pause.
159
+ Returns:
160
+ True : [OK] if terminating.
161
+ False : [CANCEL] otherwise.
159
162
 
160
163
  Note:
164
+ Use ``check`` method where you want to pause.
161
165
  Even after the message dialog is displayed, the thread
162
166
  does not suspend until check (or event.wait) is called.
163
167
  """
164
168
  if not self.running:
165
169
  return None
166
- if '\n\n' not in msg:
167
- msg += '\n\n'
170
+ if not msg:
171
+ msg = ("The thread is running.\n\n"
172
+ "Do you want to terminate the thread?")
168
173
  try:
169
174
  self.event.clear() # suspend
170
- if wx.MessageBox( # Confirm terminatation.
171
- msg + "Do you want to terminate the process?",
175
+ if wx.MessageBox( # Confirm closing the thread.
176
+ msg, caption,
172
177
  style=wx.OK|wx.CANCEL|wx.ICON_WARNING) == wx.OK:
173
178
  self.Stop()
174
- return False
175
- return True
179
+ return True
180
+ return False
176
181
  finally:
177
182
  self.event.set() # resume
178
183
 
179
184
  def Start(self, f, *args, **kwargs):
180
- """Start the thread to run the specified function."""
185
+ """Start the thread to run the specified function.
186
+ """
181
187
  @wraps(f)
182
188
  def _f(*v, **kw):
183
189
  try:
@@ -213,7 +219,10 @@ class Thread:
213
219
  def Stop(self):
214
220
  """Stop the thread.
215
221
 
216
- Use ``check`` method where you want to quit.
222
+ Note:
223
+ Use ``check`` method where you want to stop.
224
+ Even after the message dialog is displayed, the thread
225
+ does not suspend until check (or event.wait) is called.
217
226
  """
218
227
  def _stop():
219
228
  with wx.BusyInfo("One moment please, "
@@ -876,20 +885,17 @@ class Frame(mwx.Frame):
876
885
  for name in self.plugins:
877
886
  plug = self.get_plug(name)
878
887
  if plug.thread and plug.thread.active:
879
- if wx.MessageBox( # Confirm thread close.
888
+ if not plug.thread.pause( # Confirm closing the thread.
880
889
  "The thread is running.\n\n"
881
- "Enter [q]uit to exit before closing.\n"
882
890
  "Continue closing?",
883
- "Close {!r}".format(plug.Name),
884
- style=wx.YES_NO|wx.ICON_INFORMATION) != wx.YES:
891
+ "Close {!r}".format(plug.Name)):
885
892
  self.message("The close has been canceled.")
886
893
  evt.Veto()
887
894
  return
888
- self.Quit()
889
- break
895
+ ## self.Quit()
890
896
  for frame in self.graph.get_all_frames():
891
897
  if frame.pathname is None:
892
- if wx.MessageBox( # Confirm close.
898
+ if wx.MessageBox( # Confirm closing the frame.
893
899
  "You are closing unsaved frame.\n\n"
894
900
  "Continue closing?",
895
901
  "Close {!r}".format(frame.name),
mwx/nutshell.py CHANGED
@@ -2216,7 +2216,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2216
2216
  def OnPageClose(self, evt): #<wx._aui.AuiNotebookEvent>
2217
2217
  buf = self.GetPage(evt.Selection)
2218
2218
  if buf.need_buffer_save:
2219
- if wx.MessageBox( # Confirm close.
2219
+ if wx.MessageBox( # Confirm closing the buffer.
2220
2220
  "You are closing unsaved content.\n\n"
2221
2221
  "The changes will be discarded.\n"
2222
2222
  "Continue closing?",
@@ -2414,7 +2414,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2414
2414
  if not buf:
2415
2415
  buf = self.create_buffer("*temp file*")
2416
2416
  elif buf.need_buffer_save and verbose:
2417
- if wx.MessageBox( # Confirm load.
2417
+ if wx.MessageBox( # Confirm loading the buffer.
2418
2418
  "You are leaving unsaved content.\n\n"
2419
2419
  "The changes will be discarded.\n"
2420
2420
  "Continue loading?",
@@ -2468,7 +2468,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2468
2468
  buf = buf or self.buffer
2469
2469
  if buf.need_buffer_load and verbose:
2470
2470
  self.swap_buffer(buf)
2471
- if wx.MessageBox( # Confirm save.
2471
+ if wx.MessageBox( # Confirm saving the buffer.
2472
2472
  "The file has been modified externally.\n\n"
2473
2473
  "The contents of the file will be overwritten.\n"
2474
2474
  "Continue saving?",
@@ -2532,7 +2532,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2532
2532
  """Confirm the close with the dialog."""
2533
2533
  buf = buf or self.buffer
2534
2534
  if buf.need_buffer_save:
2535
- if wx.MessageBox( # Confirm close.
2535
+ if wx.MessageBox( # Confirm closing the buffer.
2536
2536
  "You are closing unsaved content.\n\n"
2537
2537
  "The changes will be discarded.\n"
2538
2538
  "Continue closing?",
@@ -2545,7 +2545,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2545
2545
  def kill_all_buffers(self):
2546
2546
  for buf in self.get_all_buffers():
2547
2547
  if buf.need_buffer_save:
2548
- if wx.MessageBox( # Confirm close.
2548
+ if wx.MessageBox( # Confirm closing the buffer.
2549
2549
  "You are closing unsaved content.\n\n"
2550
2550
  "The changes will be discarded.\n"
2551
2551
  "Continue closing?",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mwxlib
3
- Version: 1.3.11
3
+ Version: 1.4.0
4
4
  Summary: A wrapper of matplotlib and wxPython (phoenix)
5
5
  Home-page: https://github.com/komoto48g/mwxlib
6
6
  Author: Kazuya O'moto
@@ -1,14 +1,14 @@
1
1
  mwx/__init__.py,sha256=pS7ZG8QKRypiFFiaWAq_opBB6I_1viZ0zUMk2TbjzE0,667
2
2
  mwx/bookshelf.py,sha256=MXjrm_ryRGHvOFKu8wb10qz_oka70xW2yFbYjBMYfns,8140
3
3
  mwx/controls.py,sha256=RssTROprNfgnRMiWVOoSSd8Fy0qwZ8DCrYM2f5Wgr4E,48610
4
- mwx/framework.py,sha256=9H26L5rF3rxpBm0wInvt3oNhB9si6xNR-K5PbIoVx5c,76778
5
- mwx/graphman.py,sha256=qA_tNq_9A5eNuujzmxha8ponAIQxZmMtJQkRkojuVYo,70398
4
+ mwx/framework.py,sha256=X7zjAxKXIYMbaXU7g1q2rfRFsnCh2bNiA8sMzEJN_8M,76796
5
+ mwx/graphman.py,sha256=ICZ-3jtGEGcPR0zoHYgIVW3FM3UgIVHJslGjvlhAlqI,70648
6
6
  mwx/images.py,sha256=oxCn0P-emiWujSS2gUgU5TUnr5cPjix2jBcjOBDr24I,48701
7
7
  mwx/matplot2.py,sha256=Htwegq6N5G7oKSRCuajik5Dixd93i8PKVbkL7Azy99M,33150
8
8
  mwx/matplot2g.py,sha256=H1PeLJk5P0KKMT6tmocpli5RSPNjnteA5GhbJTKEqIg,64869
9
9
  mwx/matplot2lg.py,sha256=cb0EZXivccDQu4oFj5ddSUF9pEE4f5UuFJJK2ELItww,27404
10
10
  mwx/mgplt.py,sha256=8mXbHpCmm7lz3XbAxOg7IVC7DaSGBEby1UfTlMl9kjk,5604
11
- mwx/nutshell.py,sha256=XrPBcOCeUbnKi5-JjlpmZinkIJINimNsS82SXRxfv_s,142391
11
+ mwx/nutshell.py,sha256=OWCSRtghve7-95HmITPqVQSIhZ8ynn-ogT3x1ArF4-M,142457
12
12
  mwx/testsuite.py,sha256=Zk75onPSEn2tf0swS3l-vIn6yTXGB7allIyvJsPHj20,1229
13
13
  mwx/utilus.py,sha256=bDeooo2bOcZwvkIdi0ElkT-qoblqzHNFsIveb72NFOo,37528
14
14
  mwx/wxmon.py,sha256=yzWqrbY6LzpfRwQeytYUeqFhFuLVm_XEvrVAL_k0HBQ,12756
@@ -22,7 +22,7 @@ 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.3.11.dist-info/METADATA,sha256=q5aFmjTSmVGQcb9lCf1xvhagruldOzi0LgMAJi3yClI,7434
26
- mwxlib-1.3.11.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
27
- mwxlib-1.3.11.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-1.3.11.dist-info/RECORD,,
25
+ mwxlib-1.4.0.dist-info/METADATA,sha256=F1uYpz9nBr7BREiBeITTadez9ugPpmwrw9L1S6Cdz_c,7433
26
+ mwxlib-1.4.0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
27
+ mwxlib-1.4.0.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
+ mwxlib-1.4.0.dist-info/RECORD,,