45
45
tooltip_overview = """<b>Overview</b>"""
46
46
47
47
48
+ def build_caption (i : int ):
49
+ """Build the label for a given workspace number"""
50
+ label = data .BAR_WORKSPACE_ICONS .get (str (i ))
51
+ if label is None :
52
+ return (
53
+ CHINESE_NUMERALS [i - 1 ]
54
+ if data .BAR_WORKSPACE_USE_CHINESE_NUMERALS
55
+ and 1 <= i <= len (CHINESE_NUMERALS )
56
+ else str (i )
57
+ )
58
+ else :
59
+ return label
60
+
61
+
48
62
class Bar (Window ):
49
63
def __init__ (self , ** kwargs ):
50
64
super ().__init__ (
@@ -135,12 +149,7 @@ def __init__(self, **kwargs):
135
149
h_align = "center" ,
136
150
v_align = "center" ,
137
151
id = i ,
138
- label = (
139
- CHINESE_NUMERALS [i - 1 ]
140
- if data .BAR_WORKSPACE_USE_CHINESE_NUMERALS
141
- and 1 <= i <= len (CHINESE_NUMERALS )
142
- else str (i )
143
- ),
152
+ label = build_caption (i ),
144
153
)
145
154
for i in range (1 , 11 )
146
155
],
@@ -155,7 +164,7 @@ def __init__(self, **kwargs):
155
164
name = "workspaces-container" ,
156
165
children = (
157
166
self .workspaces
158
- if not data .BAR_WORKSPACE_SHOW_NUMBER
167
+ if not ( data .BAR_WORKSPACE_SHOW_NUMBER or data . BAR_WORKSPACE_ICONS )
159
168
else self .workspaces_num
160
169
),
161
170
)
@@ -603,7 +612,7 @@ def toggle_hidden(self):
603
612
self .bar_inner .remove_style_class ("hidden" )
604
613
605
614
def chinese_numbers (self ):
606
- if data .BAR_WORKSPACE_USE_CHINESE_NUMERALS :
615
+ if data .BAR_WORKSPACE_USE_CHINESE_NUMERALS or data . BAR_WORKSPACE_ICONS :
607
616
self .workspaces_num .add_style_class ("chinese" )
608
617
else :
609
618
self .workspaces_num .remove_style_class ("chinese" )
0 commit comments