Skip to content

Commit 0aefdb0

Browse files
committed
Fixed: Now automatic insertion of bars (|) only when no text is selected
1 parent 4294b2c commit 0aefdb0

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGES

+2
Original file line numberDiff line numberDiff line change
@@ -627,3 +627,5 @@ different panes. Tie/untie option added for notes. Broken rhythm
627627
- Added 'Insert musical symbol' again to the menu again which was removed in 1.3.8.4. Although ABC Assist can insert musical with less hassle, some users really like the old
628628
menu version. For Linux (Gnome) users these menus are still empty but that is caused by Gnome, not EasyABC.
629629
- Fixed: Playing selection gave an error: AttributeError: 'bytes' object has no attribute 'encode' (https://github.com/jwdj/EasyABC/issues/69)
630+
- Fixed: Now automatic insertion of bars (|) only when no text is selected
631+

easy_abc.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
unichr = chr
4949
xrange = range
5050
def unicode(s):
51+
if isinstance(s, bytes):
52+
return s.decode() # assumes utf-8
5153
return s
5254
max_int = sys.maxsize
5355
basestring = str
@@ -6803,18 +6805,19 @@ def OnCharEvent(self, evt):
68036805
if use_typing_assist and in_music_code:
68046806
if c == '-' and no_selection:
68056807
self.AddTextWithUndo('- ')
6808+
return
68066809

68076810
if c == ' ':
68086811
try:
68096812
self.FixNoteDurations()
6810-
if self.add_bar_if_needed():
6813+
if no_selection and self.add_bar_if_needed():
68116814
return
68126815
else:
68136816
evt.Skip()
68146817
except Exception:
68156818
evt.Skip()
68166819
raise
6817-
elif self.mni_TA_add_bar_auto.IsChecked() and c not in "-/<,'1234567890\"!":
6820+
elif self.mni_TA_add_bar_auto.IsChecked() and no_selection and c not in "-/<,'1234567890\"!":
68186821
if c in '|]&':
68196822
if c == ']':
68206823
bar_text = '|]'

wxhelper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def append_submenu(menu, label, submenu):
2929

3030

3131
def append_menu_item(menu, label, description, handler, kind=wx.ITEM_NORMAL, id=-1, bitmap=None):
32-
menu_item = wx.MenuItem(menu, -1, label, description, kind)
32+
menu_item = wx.MenuItem(menu, id=wx.ID_ANY, text=label, helpString=description, kind=kind)
3333
if bitmap is not None:
3434
menu_item.SetBitmap(bitmap)
3535
if WX4:

0 commit comments

Comments
 (0)