@@ -576,8 +576,16 @@ class PrefDialog():
576576 hbox .pack_start (button , False )
577577 appearance_box .pack_start (hbox , False , padding = 5 )
578578
579+ # Settings and Colors frame
580+ frame = gtk .Frame ()
581+ self .theme_settings_frame = frame
582+ frame .set_border_width (5 )
583+ table = gtk .Table (True )
579584
585+ align = gtk .Alignment (0.5 , 0.5 , 0 , 0 )
580586 hbox = gtk .HBox ()
587+ hbox .set_border_width (10 )
588+ align .add (hbox )
581589 label = gtk .Label (_ ("Window list style:" ))
582590 label .set_alignment (1 ,0.5 )
583591 self .popup_style_combo = gtk .combo_box_new_text ()
@@ -594,13 +602,8 @@ class PrefDialog():
594602 hbox .pack_start (label , False , padding = 5 )
595603 hbox .pack_start (self .popup_style_combo , False )
596604 hbox .pack_start (button , False )
597- appearance_box .pack_start (hbox , False , padding = 5 )
598-
599- # Colors frame
600- frame = gtk .Frame (_ ("Colors" ))
601- frame .set_border_width (5 )
602- table = gtk .Table (True )
603-
605+ table .attach (align , 0 ,6 , 0 ,1 )
606+
604607 self .default_color_names = {
605608 "color1" : "Window list background" ,
606609 "color2" : "Normal text" ,
@@ -621,24 +624,23 @@ class PrefDialog():
621624 self .clear_buttons = {}
622625 for i in range (0 , 8 ):
623626 c = "color%s" % (i + 1 )
624- if color_names .has_key (c ):
625- text = color_names [c ].capitalize ()
626- else :
627- text = self .default_color_names [c ]
628- # Translate color name
629- text = dockbarx .i18n .theme .gettext (text )
630- self .color_labels [c ] = gtk .Label (text )
627+ self .color_labels [c ] = gtk .Label ()
628+ self .color_labels [c ].set_no_show_all (True )
629+ self .color_labels [c ].show ()
631630 self .color_labels [c ].set_alignment (1 ,0.5 )
632631 self .color_buttons [c ] = gtk .ColorButton ()
633- self .color_buttons [c ].set_title (text )
632+ self .color_buttons [c ].set_no_show_all (True )
633+ self .color_buttons [c ].show ()
634634 self .color_buttons [c ].connect ("color-set" , self .__color_set , c )
635635 self .clear_buttons [c ] = gtk .Button ()
636636 image = gtk .image_new_from_stock (gtk .STOCK_CLEAR ,
637637 gtk .ICON_SIZE_SMALL_TOOLBAR )
638638 self .clear_buttons [c ].add (image )
639+ self .clear_buttons [c ].show_all ()
640+ self .clear_buttons [c ].set_no_show_all (True )
639641 self .clear_buttons [c ].connect ("clicked" , self .__color_reset , c )
640642 # Every second label + combobox on a new row
641- row = i // 2
643+ row = ( i // 2 ) + 1
642644 # Pack odd numbered comboboxes from 3rd column
643645 column = (i % 2 )* 3
644646 table .attach (self .color_labels [c ], column , column + 1 , row ,
@@ -650,6 +652,7 @@ class PrefDialog():
650652 table .set_border_width (5 )
651653 frame .add (table )
652654 appearance_box .pack_start (frame , False , padding = 5 )
655+ self .__update_color_labels ()
653656
654657
655658 # Needs attention effect frame
@@ -1389,7 +1392,7 @@ class PrefDialog():
13891392 if theme .lower () == self .globals .settings ["theme" ].lower ():
13901393 self .theme = Theme (path )
13911394 break
1392- if theme .lower == self .globals .DEFAULT_SETTINGS ["theme" ].lower ():
1395+ if theme .lower () == self .globals .DEFAULT_SETTINGS ["theme" ].lower ():
13931396 default_theme_path = path
13941397 else :
13951398 if default_theme_path :
@@ -1571,7 +1574,9 @@ class PrefDialog():
15711574 dockmanager = self .globals .settings ["dockmanager" ]
15721575 self .dockmanager_cb .set_active (dockmanager )
15731576
1574- # Colors
1577+ # Colors and settings
1578+ self .theme_settings_frame .set_label (_ ("Settings and colors for %s" ) % \
1579+ self .globals .theme_name )
15751580 if self .theme :
15761581 self .theme_colors = self .theme .get_default_colors ()
15771582 self .theme_alphas = self .theme .get_default_alphas ()
@@ -2029,16 +2034,7 @@ class PrefDialog():
20292034 theme_names .sort ()
20302035 for theme in theme_names :
20312036 self .theme_combo .append_text (theme )
2032- # Color labels
2033- color_names = self .theme .get_color_names ()
2034- for i in range (1 , 9 ):
2035- c = "color%s" % i
2036- if color_names .has_key (c ):
2037- text = color_names [c ].capitalize ()
2038- else :
2039- text = self .default_color_names [c ]
2040- self .color_labels [c ].set_text (text )
2041- self .color_buttons [c ].set_title (text )
2037+ self .__update_color_labels ()
20422038 self .__update ()
20432039
20442040 def __on_theme_changed (self , arg ):
@@ -2055,14 +2051,31 @@ class PrefDialog():
20552051 style_names .sort ()
20562052 for style in style_names :
20572053 self .popup_style_combo .append_text (style )
2054+ self .__update_color_labels ()
2055+
2056+ def __update_color_labels (self ):
20582057 # Color labels
2059- color_names = self .theme .get_color_names ()
2058+ if self .theme :
2059+ color_names = self .theme .get_color_names ()
2060+ else :
2061+ color_names = {}
2062+ for i in range (1 ,9 ):
2063+ color_names ["color%s" % i ]= "Not used"
20602064 for i in range (1 , 9 ):
20612065 c = "color%s" % i
20622066 if color_names .has_key (c ):
20632067 text = color_names [c ].capitalize ()
20642068 else :
20652069 text = self .default_color_names [c ]
2070+ # Hide not used colors
2071+ if text == "Not used" :
2072+ self .color_labels [c ].hide ()
2073+ self .color_buttons [c ].hide ()
2074+ self .clear_buttons [c ].hide ()
2075+ else :
2076+ self .color_labels [c ].show ()
2077+ self .color_buttons [c ].show ()
2078+ self .clear_buttons [c ].show ()
20662079 # Translate
20672080 text = dockbarx .i18n .theme .gettext (text )
20682081 self .color_labels [c ].set_text (text )
0 commit comments