@@ -28,9 +28,10 @@ def __init__(self, parent):
28
28
self .regions = (
29
29
'color_left' ,
30
30
'color_center' ,
31
- 'color_right' ,
32
- 'color_extra'
31
+ 'color_right'
33
32
)
33
+ if backlight .color_extra :
34
+ self .regions .append ('color_extra' )
34
35
35
36
self .bg_frame = ttk .Frame (self .parent )
36
37
self .bg_frame .grid (sticky = tk .NSEW , column = 0 , row = 0 )
@@ -65,8 +66,9 @@ def __init__(self, parent):
65
66
'color_left' : tk .StringVar (self , value = backlight .color_left .capitalize ()),
66
67
'color_center' : tk .StringVar (self , value = backlight .color_center .capitalize ()),
67
68
'color_right' : tk .StringVar (self , value = backlight .color_right .capitalize ()),
68
- 'color_extra' : tk .StringVar (self , value = backlight .color_extra .capitalize ())
69
69
}
70
+ if backlight .color_extra :
71
+ self .values .color_extra = tk .StringVar (self , value = backlight .color_extra .capitalize ())
70
72
71
73
def set_single_color (color ):
72
74
if not color == 'Select...' :
@@ -108,15 +110,16 @@ def set_single_color(color):
108
110
backlight .color_right .capitalize (),
109
111
* backlight .display_colors (),
110
112
command = self .color_setter ('right' )
111
- ),
112
- 'color_extra' : ttk .OptionMenu (
113
+ )
114
+ }
115
+ if backlight .color_extra :
116
+ self .widgets .color_extra : ttk .OptionMenu (
113
117
self .bg_frame ,
114
118
self .values ['color_extra' ],
115
119
backlight .color_extra .capitalize (),
116
120
* backlight .display_colors (),
117
121
command = self .color_setter ('extra' )
118
122
)
119
- }
120
123
121
124
def cmd ():
122
125
self .on_color_mode_switch (self .values ['color_mode' ].get ())
@@ -151,7 +154,9 @@ def cmd():
151
154
self .widgets ['color_left' ]['menu' ].config (** menuconfig )
152
155
self .widgets ['color_center' ]['menu' ].config (** menuconfig )
153
156
self .widgets ['color_right' ]['menu' ].config (** menuconfig )
154
- self .widgets ['color_extra' ]['menu' ].config (** menuconfig )
157
+
158
+ if backlight .color_extra :
159
+ self .widgets ['color_extra' ]['menu' ].config (** menuconfig )
155
160
156
161
self .labels ['mode' ].grid (column = 0 , row = 0 , sticky = 'EW' )
157
162
self .widgets ['mode' ].grid (column = 1 , row = 0 , sticky = 'EW' , padx = 10 )
0 commit comments