Skip to content

Commit 2ed898a

Browse files
author
Matias Särs
committed
- New themes, popup styles and dock themes are added. Old ones are removed.
- The appearence tab of dockbarx preferences is changed visually to be easier to use. - A small bug making preferences crash when a theme can't be found is fixed. - Two bugs in appindictaor applet are fixed.
1 parent 7216496 commit 2ed898a

33 files changed

+58
-35
lines changed

dbx_preference

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

dockbarx/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ def __init__(self):
706706
self.dragging = False
707707
self.theme_name = None
708708
self.popup_style_file = None
709+
self.default_popup_style = None
709710
self.dock_colors = {}
710711
self.__compiz_version = None
711712

dockbarx/theme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def on_style_changed(self, arg=None):
405405
if self.globals.popup_style_file in styles:
406406
self.style_path = styles[self.globals.popup_style_file]
407407
elif self.globals.default_popup_style in styles:
408-
self.style_path = styles[self.globals.popup_style_file]
408+
self.style_path = styles[self.globals.default_popup_style]
409409
else:
410410
self.style_path = styles.get("dbx.tar.gz", "dbx.tar.gz")
411411
self.reload()

dockbarx/unity.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ def __on_properties_updated(self, changed_props, removed_props):
247247
changed_items = []
248248
for props in changed_props:
249249
item = self.__recursive_match(self.layout, props[0])
250+
if item is None:
251+
continue
250252
for key, value in props[1].items():
251253
item[1][key] = value
252254
changed_items.append(item)
@@ -255,6 +257,8 @@ def __on_properties_updated(self, changed_props, removed_props):
255257
group.menu.set_properties(identifier, props[1])
256258
for props in removed_props:
257259
item = self.__recursive_match(self.layout, props[0])
260+
if item is None:
261+
continue
258262
for prop in props[1]:
259263
if prop in item[1]:
260264
del item[1][prop]

dockx_applets/appindicator.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self, applet, icon_name, position, address, obj,
4343
self.repack()
4444
self.icon_themepath = icon_path
4545
self.on_icon_changed(icon_name, None)
46+
self.on_label_changed(label, labelguide)
4647
self.title = title
4748

4849
self.dbusmenu = DBusMenu(self, address, obj)
@@ -102,11 +103,15 @@ def on_menuitem_activated(self, menu_item, identifier):
102103
def on_icon_changed(self, icon_name=None, icon_desc=None):
103104
if icon_name is not None:
104105
self.icon_name = icon_name
105-
icon_theme = gtk.icon_theme_get_default()
106-
#~ icon_theme.set_screen(gtk.gdk.screen_get_default())
107-
if self.icon_themepath != "" and os.path.exists(self.icon_themepath):
108-
icon_theme.prepend_search_path(self.icon_themepath)
109-
pixbuf = icon_theme.load_icon(self.icon_name, 16, 0)
106+
if self.icon_name.startswith("/") and os.path.exists(self.icon_name):
107+
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(self.icon_name,
108+
16, 16)
109+
else:
110+
icon_theme = gtk.icon_theme_get_default()
111+
if self.icon_themepath != "" and \
112+
os.path.exists(self.icon_themepath):
113+
icon_theme.prepend_search_path(self.icon_themepath)
114+
pixbuf = icon_theme.load_icon(self.icon_name, 16, 0)
110115
self.icon.set_from_pixbuf(pixbuf)
111116

112117
def on_icon_themepath_changed(self, path):

themes/Colors.tar.gz

5.55 KB
Binary file not shown.

themes/Deep.tar.gz

40.8 KB
Binary file not shown.

themes/Gaia.tar.gz

-15.9 KB
Binary file not shown.

themes/Glass_DMD.tar.gz

7.81 KB
Binary file not shown.

themes/Magic_trans.tar.gz

8.47 KB
Binary file not shown.

0 commit comments

Comments
 (0)