File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 7
7
bl_info = {
8
8
"name" : "Is key Free" ,
9
9
"author" : "Antonio Vazquez (antonioya)" ,
10
- "version" : (1 , 1 , 2 ),
10
+ "version" : (1 , 1 , 3 ),
11
11
"blender" : (2 , 80 , 0 ),
12
12
"location" : "Text Editor > Sidebar > Dev Tab" ,
13
13
"description" : "Find free shortcuts, inform about used and print a key list" ,
16
16
}
17
17
18
18
import bpy
19
+
19
20
from bpy .props import (
20
21
BoolProperty ,
21
22
EnumProperty ,
28
29
PropertyGroup ,
29
30
)
30
31
32
+ import unicodedata
31
33
32
34
# ------------------------------------------------------
33
35
# Class to find keymaps
@@ -498,6 +500,15 @@ def all_shortcuts_name(self, context):
498
500
except :
499
501
return None
500
502
503
+ def unicodelen (self , string ):
504
+ n = 0
505
+ for c in string :
506
+ if unicodedata .east_asian_width (c ) in 'FWA' :
507
+ n += 2
508
+ else :
509
+ n += 1
510
+ return n
511
+
501
512
def execute (self , context ):
502
513
wm = bpy .context .window_manager
503
514
from collections import defaultdict
@@ -536,7 +547,7 @@ def execute(self, context):
536
547
textblock .write ("\n [%s]\n Entries: %s\n \n " % (ctx , len (mykeys [ctx ])))
537
548
line_k = sorted (mykeys [ctx ])
538
549
for keys in line_k :
539
- add_ticks = "-" * (max_line - (len (keys [0 ]) + len (keys [1 ])))
550
+ add_ticks = "-" * (max_line - (self . unicodelen (keys [0 ]) + len (keys [1 ])))
540
551
entries = "{ticks} {entry}" .format (ticks = add_ticks , entry = keys [1 ])
541
552
textblock .write ("{name} {entry}\n " .format (name = keys [0 ], entry = entries ))
542
553
You can’t perform that action at this time.
0 commit comments