@@ -307,7 +307,7 @@ def get_columns_for_value(self, context, value, show_value_column, fixed_font=Tr
307
307
t = UrlTuple (self .get_action_url (params ), desc )
308
308
columns .append (t )
309
309
else :
310
- columns .append (desc ) # self.html_selected_item(context, value, desc)
310
+ columns .append (self .html_selected_item (context , value , desc ) )
311
311
312
312
return columns
313
313
@@ -340,10 +340,9 @@ def get_values_html(self, context):
340
340
result = ''
341
341
return result
342
342
343
- @staticmethod
344
- def html_selected_item (context , value , description ):
345
- # if self.is_current_value(context, value):
346
- # return html_enclose('b', description) # to make selected item bold
343
+ def html_selected_item (self , context , value , description ):
344
+ if self .is_current_value (context , value ):
345
+ return description + ' \u25C4 '
347
346
return description
348
347
349
348
@@ -651,7 +650,7 @@ def length_to_fraction(length):
651
650
652
651
@staticmethod
653
652
def is_power2 (num ):
654
- return ((num & (num - 1 )) == 0 ) and num != 0
653
+ return ((num & (num - 1 )) == 0 ) and num > 0
655
654
656
655
def can_execute (self , context , params = None ):
657
656
value = params .get ('value' )
@@ -883,6 +882,9 @@ def abc_mode_to_number(mode, default=None):
883
882
mode = mode [:3 ].lower ()
884
883
return KeyChangeAction ._mode_to_num .get (mode , default )
885
884
885
+ def is_current_value (self , context , value ):
886
+ return True
887
+
886
888
887
889
class KeySignatureChangeAction (KeyChangeAction ):
888
890
values = [
@@ -1029,8 +1031,7 @@ def can_execute(self, context, params=None):
1029
1031
value = params .get ('value' )
1030
1032
if value is None :
1031
1033
return True
1032
- match = self .get_match (context )
1033
- return match is None or value != match .group ('clefname' )
1034
+ return not self .is_current_value (context , value )
1034
1035
return False
1035
1036
1036
1037
def execute (self , context , params = None ):
@@ -1045,6 +1046,10 @@ def execute(self, context, params=None):
1045
1046
params ['value' ] = ' clef=' + value
1046
1047
super (ClefChangeAction , self ).execute (context , params )
1047
1048
1049
+ def is_current_value (self , context , value ):
1050
+ match = self .get_match (context )
1051
+ return match and value == match .group ('clefname' )
1052
+
1048
1053
1049
1054
class StaffTransposeChangeAction (ValueChangeAction ):
1050
1055
values = [
@@ -1290,24 +1295,28 @@ def __init__(self, keyword):
1290
1295
url = 'http://moinejf.free.fr/abcm2ps-doc/{0}.xhtml' .format (urllib .parse .quote (keyword ))
1291
1296
super (UrlAction , self ).__init__ ('lookup_abcm2ps' , url )
1292
1297
1293
-
1294
1298
class Abc2MidiUrlAction (UrlAction ):
1295
1299
def __init__ (self , keyword ):
1296
- url = 'http ://ifdo.pugmarks.com/~seymour/runabc/abcguide/abc2midi_body.html #{0}' .format (urllib .parse .quote (keyword ))
1300
+ url = 'https ://abcmidi.sourceforge.io/ #{0}' .format (urllib .parse .quote (keyword ))
1297
1301
super (UrlAction , self ).__init__ ('lookup_abc2midi' , url )
1298
1302
1303
+
1299
1304
class AbcStandardUrlAction (UrlAction ):
1300
1305
def __init__ (self ):
1301
1306
super (AbcStandardUrlAction , self ).__init__ ('lookup_abc_standard' )
1302
1307
1303
1308
def get_url (self , context ):
1304
- version = context . get_matchgroup ( 'version' , '2.1' )
1309
+ version = self . get_version_from_context ( context )
1305
1310
return 'http://abcnotation.com/wiki/abc:standard:v{0}' .format (version )
1306
1311
1307
1312
def can_execute (self , context , params = None ):
1308
- version = context . get_matchgroup ( 'version' , '2.1' )
1313
+ version = self . get_version_from_context ( context )
1309
1314
return version .startswith ('2.' )
1310
1315
1316
+ @staticmethod
1317
+ def get_version_from_context (context ):
1318
+ return context .get_matchgroup ('version' , '2.1' )
1319
+
1311
1320
def get_outer_text (self , context ):
1312
1321
return None
1313
1322
0 commit comments