mwxlib 1.0.1__py3-none-any.whl → 1.0.4__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 CHANGED
@@ -465,7 +465,13 @@ class Knob(wx.Panel):
465
465
  self.text.BackgroundColour = c
466
466
  self.text.Refresh()
467
467
 
468
- def shift(self, evt, bit):
468
+ def shift_ctrl(self, evt, bit):
469
+ """Called when a key/mouse wheel is pressed/scrolled.
470
+
471
+ In addition to direct key input to the textctrl,
472
+ [up][down][wheelup][wheeldown] keys can be used,
473
+ with modifiers S- 2x, C- 16x, and M- 256x steps.
474
+ """
469
475
  if bit:
470
476
  if evt.ShiftDown(): bit *= 2
471
477
  if evt.ControlDown(): bit *= 16
@@ -485,13 +491,13 @@ class Knob(wx.Panel):
485
491
  evt.Skip()
486
492
 
487
493
  def OnMouseWheel(self, evt): #<wx._core.MouseEvent>
488
- self.shift(evt, 1 if evt.WheelRotation>0 else -1)
494
+ self.shift_ctrl(evt, 1 if evt.WheelRotation>0 else -1)
489
495
  evt.Skip(False)
490
496
 
491
497
  def OnCtrlKeyDown(self, evt): #<wx._core.KeyEvent>
492
498
  key = evt.GetKeyCode()
493
- if key == wx.WXK_LEFT: return self.shift(evt, -1)
494
- if key == wx.WXK_RIGHT: return self.shift(evt, 1)
499
+ if key == wx.WXK_LEFT: return self.shift_ctrl(evt, -1)
500
+ if key == wx.WXK_RIGHT: return self.shift_ctrl(evt, 1)
495
501
 
496
502
  def _focus(c):
497
503
  if isinstance(c, Knob) and c.ctrl.IsEnabled():
@@ -508,8 +514,8 @@ class Knob(wx.Panel):
508
514
 
509
515
  def OnTextKeyDown(self, evt): #<wx._core.KeyEvent>
510
516
  key = evt.GetKeyCode()
511
- if key == wx.WXK_DOWN: return self.shift(evt, -1)
512
- if key == wx.WXK_UP: return self.shift(evt, 1)
517
+ if key == wx.WXK_DOWN: return self.shift_ctrl(evt, -1)
518
+ if key == wx.WXK_UP: return self.shift_ctrl(evt, 1)
513
519
  if key == wx.WXK_ESCAPE:
514
520
  self.__par.reset(self.__par.value, internal_callback=None) # restore value
515
521
  evt.Skip()
@@ -957,7 +963,7 @@ class Icon(wx.Bitmap):
957
963
 
958
964
 
959
965
  class ClassicButton(wx.Button):
960
- """Flat button
966
+ """Classic button
961
967
 
962
968
  Args:
963
969
  label : button label
@@ -1035,7 +1041,7 @@ class ToggleButton(wx.ToggleButton):
1035
1041
 
1036
1042
 
1037
1043
  class TextCtrl(wx.Control):
1038
- """Text panel
1044
+ """Text control
1039
1045
 
1040
1046
  Args:
1041
1047
  label : button label
@@ -1089,7 +1095,7 @@ class TextCtrl(wx.Control):
1089
1095
 
1090
1096
 
1091
1097
  class Choice(wx.Control):
1092
- """Editable Choice (ComboBox) panel
1098
+ """Editable Choice (ComboBox) control
1093
1099
 
1094
1100
  Args:
1095
1101
  label : button label
mwx/framework.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #! python3
2
2
  """mwxlib framework.
3
3
  """
4
- __version__ = "1.0.1"
4
+ __version__ = "1.0.4"
5
5
  __author__ = "Kazuya O'moto <komoto@jeol.co.jp>"
6
6
 
7
7
  from contextlib import contextmanager
mwx/graphman.py CHANGED
@@ -964,11 +964,6 @@ class Frame(mwx.Frame):
964
964
  else:
965
965
  win.handler('page_closed', win)
966
966
 
967
- if pane.dock_direction:
968
- pane.Dock()
969
- else:
970
- pane.Float()
971
-
972
967
  ## Modify the floating position of the pane when displayed.
973
968
  ## Note: This is a known bug in wxWidgets 3.17 -- 3.20,
974
969
  ## and will be fixed in wxPython 4.2.1.
@@ -1000,6 +995,11 @@ class Frame(mwx.Frame):
1000
995
  pane.CaptionVisible(False) # no caption bar
1001
996
  pane.Gripper(dock not in (0, 5)) # show a grip when docked
1002
997
  pane.Dockable(dock)
998
+
999
+ if pane.dock_direction:
1000
+ pane.Dock()
1001
+ else:
1002
+ pane.Float()
1003
1003
 
1004
1004
  def OnPaneClose(self, evt): #<wx.aui.AuiManagerEvent>
1005
1005
  pane = evt.GetPane()
mwx/nutshell.py CHANGED
@@ -147,10 +147,14 @@ def can_edit(f):
147
147
  def ask(f, prompt="Enter value", type=str):
148
148
  """Get response from the user using a dialog box."""
149
149
  @wraps(f)
150
- def _f(*v):
151
- with wx.TextEntryDialog(None, prompt, f.__name__) as dlg:
150
+ def _f(evt, value=''):
151
+ with wx.TextEntryDialog(None, prompt, f.__name__, value) as dlg:
152
152
  if dlg.ShowModal() == wx.ID_OK:
153
- return f(type(dlg.Value))
153
+ value = dlg.Value
154
+ try:
155
+ return f(type(value))
156
+ except ValueError:
157
+ return _f(evt, value) # show the prompt again
154
158
  return _f
155
159
 
156
160
 
@@ -499,9 +503,7 @@ class EditorInterface(AutoCompInterfaceMixin, CtrlInterface):
499
503
  ## 'C-/ pressed' : (0, ), # cf. C-a home
500
504
  ## 'C-\ pressed' : (0, ), # cf. C-e end
501
505
  'C-; pressed' : (0, _F(self.comment_out_line)),
502
- 'C-S-; pressed' : (0, _F(self.comment_out_line)),
503
506
  'C-: pressed' : (0, _F(self.uncomment_line)),
504
- 'C-S-: pressed' : (0, _F(self.uncomment_line)),
505
507
  'select_line' : (11, self.on_linesel_begin),
506
508
  'select_lines' : (11, self.on_linesel_next),
507
509
  },
@@ -633,10 +635,10 @@ class EditorInterface(AutoCompInterfaceMixin, CtrlInterface):
633
635
  self.IndicatorSetForeground(10, "red")
634
636
 
635
637
  self.IndicatorSetStyle(11, stc.STC_INDIC_STRAIGHTBOX)
638
+ self.IndicatorSetForeground(11, "yellow")
636
639
  self.IndicatorSetUnder(11, True)
637
- self.IndicatorSetAlpha(11, 60)
638
- self.IndicatorSetOutlineAlpha(11, 60)
639
- self.IndicatorSetForeground(11, "light gray")
640
+ self.IndicatorSetAlpha(11, 0xe8)
641
+ self.IndicatorSetOutlineAlpha(11, 0)
640
642
 
641
643
  self.IndicatorSetStyle(2, stc.STC_INDIC_DOTS)
642
644
  self.IndicatorSetForeground(2, "light gray")
@@ -2433,10 +2435,14 @@ class EditorBook(AuiNotebook, CtrlInterface):
2433
2435
  self.swap_buffer(buf, lineno)
2434
2436
  return True
2435
2437
  return False
2438
+ except FileNotFoundError:
2439
+ self.post_message(f"New file: {filename!r}.")
2440
+ self.delete_buffer(buf)
2441
+ return False
2436
2442
  except Exception as e:
2437
2443
  self.post_message(f"Failed to load {filename!r}.", e)
2438
2444
  self.delete_buffer(buf)
2439
- return False
2445
+ raise
2440
2446
 
2441
2447
  def find_file(self, filename=None):
2442
2448
  """Open the specified file."""
@@ -2449,7 +2455,7 @@ class EditorBook(AuiNotebook, CtrlInterface):
2449
2455
  for fn in dlg.Paths:
2450
2456
  self.find_file(fn)
2451
2457
  return
2452
- if not self.load_file(filename):
2458
+ if self.load_file(filename) == False:
2453
2459
  buf = self.create_buffer(filename)
2454
2460
  buf._Buffer__mtime = 0 # => need_buffer_save
2455
2461
  self.swap_buffer(buf)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mwxlib
3
- Version: 1.0.1
3
+ Version: 1.0.4
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=psabnAMei5VzB2TsB2qBNLrIZMX0LiqjlXCpNGmDejk,668
2
2
  mwx/bookshelf.py,sha256=so-xSLq08sMlJBErTxOaDoKUAMa_g1CkIP2pNnff68c,5607
3
- mwx/controls.py,sha256=LZqee9K8uPxs-Iqcp1zMMNBjFpGPrHbcMaIBuBOL7oo,47647
4
- mwx/framework.py,sha256=arqDZTKqvvqydF1aNWER1QzJMs5VqHa4B5Bb8x-QPwk,75809
5
- mwx/graphman.py,sha256=1GGBk4kJYRQ7zkvO2rvHxHoINrIfHSB7cabQKWhTyaI,69669
3
+ mwx/controls.py,sha256=iXNTk4ge6sHStenjxC7bFKgQHvqxMwfb82IbgiDmtEk,47944
4
+ mwx/framework.py,sha256=PZwNHchv_Z1sDUaPTR1d90Bt0UV6mNx_X53Nnekd0tA,75809
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
8
  mwx/matplot2g.py,sha256=diwWNxzyy-c8KBDaolHaMqWdFXSYhEumgwXIZ9wAEYk,64467
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=pNGLBlVYz6D4LNjosCjXaopcITkQ2-qGVQ6zGmVJJYQ,141850
11
+ mwx/nutshell.py,sha256=blsRL7RDJ3C4Dkiq6Jg09INF1ROfEdWi274IohR2Lpk,142048
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
@@ -21,8 +21,8 @@ mwx/plugins/frame_listview.py,sha256=gowjQ-ARNonMkDSXkQgPKq4U9YBJ-vQ0jK2krBVOdCs
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.1.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
- mwxlib-1.0.1.dist-info/METADATA,sha256=wAEdiChVsOWS6L8ggO5JeupCCFlHu-AkEfpd1dPq4PU,7259
26
- mwxlib-1.0.1.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
27
- mwxlib-1.0.1.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-1.0.1.dist-info/RECORD,,
24
+ mwxlib-1.0.4.dist-info/LICENSE,sha256=PGtRKCaTkmUDlBQwpptJAxJtdqxIUtAmdBsaT9nUVkA,1091
25
+ mwxlib-1.0.4.dist-info/METADATA,sha256=xUi5IB8tDvqX39GOIY2xmz-W765moTc-xpV_9G9eGLs,7259
26
+ mwxlib-1.0.4.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
27
+ mwxlib-1.0.4.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
+ mwxlib-1.0.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5