From ab5229314b642d3ec45237ae84f9c5798352f180 Mon Sep 17 00:00:00 2001 From: "Jaap A. Haitsma" Date: Mon, 13 Jul 2009 08:50:27 +0200 Subject: Use gtkbuilder instead of glade Fixes bug 580186 Patch by Pedro Fragoso --- colorblind/data/Makefile.am | 2 +- colorblind/data/colorblind-prefs.glade | 658 ------------------------------- colorblind/data/colorblind-prefs.ui | 624 +++++++++++++++++++++++++++++ colorblind/ui/ColorblindPreferencesUI.py | 35 +- configure.in | 2 +- po/POTFILES.in | 2 +- 6 files changed, 645 insertions(+), 678 deletions(-) delete mode 100644 colorblind/data/colorblind-prefs.glade create mode 100644 colorblind/data/colorblind-prefs.ui diff --git a/colorblind/data/Makefile.am b/colorblind/data/Makefile.am index 0cd8971..da531f1 100644 --- a/colorblind/data/Makefile.am +++ b/colorblind/data/Makefile.am @@ -3,7 +3,7 @@ SUBDIRS = art uidir = $(datadir)/colorblind ui_DATA = \ Colorblind_Applet.xml \ - colorblind-prefs.glade + colorblind-prefs.ui # ***************************************************************************** # GConf Schemas diff --git a/colorblind/data/colorblind-prefs.glade b/colorblind/data/colorblind-prefs.glade deleted file mode 100644 index 4f68933..0000000 --- a/colorblind/data/colorblind-prefs.glade +++ /dev/null @@ -1,658 +0,0 @@ - - - - - - - True - Colorblind Filters Preferences - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER - True - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_CENTER - True - False - - Colorblind Filters Preferences - - - - - 5 - True - False - 5 - - - - True - False - 5 - - - - True - False - 0 - - - - True - <b>Filters</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 10 - 0 - - - - True - False - 0 - - - - True - This filter completely saturates the red color when this is the predominant pixel color in the image. - True - Selective Red Saturation - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - 0 - False - False - - - - - - True - This filter completely saturates the green color when this is the predominant pixel color in the image. - True - Selective Green Saturation - True - GTK_RELIEF_NORMAL - True - False - False - True - radio_filter_red_saturate - - - - 0 - False - False - - - - - - True - This filter completely saturates the blue color when this is the predominant pixel color in the image. - True - Selective Blue Saturation - True - GTK_RELIEF_NORMAL - True - False - False - True - radio_filter_red_saturate - - - - 0 - False - False - - - - - - - 0 - False - True - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 10 - 0 - - - - True - False - 0 - - - - True - This filter completely desaturates the red color when this is the predominant pixel color in the image. - True - Selective Red Desaturation - True - GTK_RELIEF_NORMAL - True - False - False - True - radio_filter_red_saturate - - - - 0 - False - False - - - - - - True - This filter completely desaturates the green color when this is the predominant pixel color in the image. - True - Selective Green Desaturation - True - GTK_RELIEF_NORMAL - True - False - False - True - radio_filter_red_saturate - - - - 0 - False - False - - - - - - True - This filter completely desaturates the blue color when this is the predominant pixel color in the image. - True - Selective Blue Desaturation - True - GTK_RELIEF_NORMAL - True - False - False - True - radio_filter_red_saturate - - - - 0 - False - False - - - - - - - 0 - True - True - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 10 - 0 - - - - True - False - 0 - - - - True - Transforms the colors Red to Green, Green to Blue and Blue to Red, carrying a potentially ambiguous set of colors to a different band of the spectrum. - True - Positive Hue Shift - True - GTK_RELIEF_NORMAL - True - True - False - True - radio_filter_red_saturate - - - - 0 - False - False - - - - - - True - Transforms the colors Red to Blue, Green to Red and Blue to Green, carrying a potentially ambiguous set of colors to a different band of the spectrum. - True - Negative Hue Shift - True - GTK_RELIEF_NORMAL - True - False - False - True - radio_filter_red_saturate - - - - 0 - False - False - - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - <b>Default Filter</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 10 - 0 - - - - True - False - 5 - - - - True - Filter: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 0 - True - True - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 40 - 0 - - - - True - <i>This is the filter that will be used when enabling/disabling the filters.</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - 0 - True - True - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 10 - 0 - - - - True - True - Configure the filter being used as default when the filters are disabled. - True - GTK_RELIEF_NORMAL - True - False - False - True - - - - - - 0 - False - False - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - <b>Shortcut</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 10 - 0 - - - - True - 2 - 2 - False - 0 - 5 - - - - True - Enable/Disable Filters: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - Select Next Filter: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_END - 0 - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - - - - - 0 - True - True - - - - - - - diff --git a/colorblind/data/colorblind-prefs.ui b/colorblind/data/colorblind-prefs.ui new file mode 100644 index 0000000..00d073b --- /dev/null +++ b/colorblind/data/colorblind-prefs.ui @@ -0,0 +1,624 @@ + + + + + True + Colorblind Filters Preferences + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + True + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_CENTER + True + False + + + + + + 5 + True + False + 5 + + + True + False + 5 + + + True + False + 0 + + + True + <b>Filters</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 10 + 0 + + + True + False + 0 + + + True + This filter completely saturates the red color when this is the predominant pixel color in the image. + True + Selective Red Saturation + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + True + This filter completely saturates the green color when this is the predominant pixel color in the image. + True + Selective Green Saturation + True + GTK_RELIEF_NORMAL + True + False + False + True + radio_filter_red_saturate + + + + 0 + False + False + + + + + True + This filter completely saturates the blue color when this is the predominant pixel color in the image. + True + Selective Blue Saturation + True + GTK_RELIEF_NORMAL + True + False + False + True + radio_filter_red_saturate + + + + 0 + False + False + + + + + + + 0 + False + True + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 10 + 0 + + + True + False + 0 + + + True + This filter completely desaturates the red color when this is the predominant pixel color in the image. + True + Selective Red Desaturation + True + GTK_RELIEF_NORMAL + True + False + False + True + radio_filter_red_saturate + + + + 0 + False + False + + + + + True + This filter completely desaturates the green color when this is the predominant pixel color in the image. + True + Selective Green Desaturation + True + GTK_RELIEF_NORMAL + True + False + False + True + radio_filter_red_saturate + + + + 0 + False + False + + + + + True + This filter completely desaturates the blue color when this is the predominant pixel color in the image. + True + Selective Blue Desaturation + True + GTK_RELIEF_NORMAL + True + False + False + True + radio_filter_red_saturate + + + + 0 + False + False + + + + + + + 0 + True + True + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 10 + 0 + + + True + False + 0 + + + True + Transforms the colors Red to Green, Green to Blue and Blue to Red, carrying a potentially ambiguous set of colors to a different band of the spectrum. + True + Positive Hue Shift + True + GTK_RELIEF_NORMAL + True + True + False + True + radio_filter_red_saturate + + + + 0 + False + False + + + + + True + Transforms the colors Red to Blue, Green to Red and Blue to Green, carrying a potentially ambiguous set of colors to a different band of the spectrum. + True + Negative Hue Shift + True + GTK_RELIEF_NORMAL + True + False + False + True + radio_filter_red_saturate + + + + 0 + False + False + + + + + + + 0 + True + True + + + + + 0 + True + True + + + + + True + False + 0 + + + True + <b>Default Filter</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 10 + 0 + + + True + False + 5 + + + True + Filter: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + + 0 + True + True + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 40 + 0 + + + True + <i>This is the filter that will be used when enabling/disabling the filters.</i> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + 0 + True + True + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 10 + 0 + + + True + True + Configure the filter being used as default when the filters are disabled. + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + + 0 + False + False + + + + + 0 + True + True + + + + + True + False + 0 + + + True + <b>Shortcut</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 10 + 0 + + + True + 2 + 2 + False + 0 + 5 + + + True + Enable/Disable Filters: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + True + Select Next Filter: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + + 0 + True + True + + + + + 0 + True + True + + + + + 0 + True + True + + + + + True + GTK_BUTTONBOX_END + 0 + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + + + + + 0 + True + True + + + + + + + Colorblind Filters Preferences + + + + diff --git a/colorblind/ui/ColorblindPreferencesUI.py b/colorblind/ui/ColorblindPreferencesUI.py index 4235182..43f0da2 100644 --- a/colorblind/ui/ColorblindPreferencesUI.py +++ b/colorblind/ui/ColorblindPreferencesUI.py @@ -2,7 +2,7 @@ from gettext import gettext as _ from os.path import join, isdir import os import struct -import gtk, gtk.gdk, gtk.glade, gobject, gconf +import gtk, gtk.gdk, gobject, gconf import colorblind, colorblind.Utils, colorblind.ColorblindApplet MAXINT = 2 ** ((8 * struct.calcsize('i')) - 1) - 1 @@ -195,18 +195,19 @@ class ColorblindPreferencesUI: CB_FILTER_NO_FILTER, CB_FILTER_SELECTIVE_SATURATE_RED, CB_FILTER_SELECTIVE_SATURATE_GREEN, CB_FILTER_SELECTIVE_SATURATE_BLUE, CB_FILTER_SELECTIVE_DESATURATE_RED, CB_FILTER_SELECTIVE_DESATURATE_GREEN, CB_FILTER_SELECTIVE_DESATURATE_BLUE, CB_FILTER_POSITIVE_HUE_SHIFT, CB_FILTER_NEGATIVE_HUE_SHIFT = range (9) def __init__(self, applet): - self.glade = gtk.glade.XML(join(colorblind.SHARED_DATA_DIR, "colorblind-prefs.glade")) - - self.dialog = self.glade.get_widget("window_preferences") - self.radio1 = self.glade.get_widget("radio_filter_red_saturate") - self.radio2 = self.glade.get_widget("radio_filter_green_saturate") - self.radio3 = self.glade.get_widget("radio_filter_blue_saturate") - self.radio4 = self.glade.get_widget("radio_filter_red_desaturate") - self.radio5 = self.glade.get_widget("radio_filter_green_desaturate") - self.radio6 = self.glade.get_widget("radio_filter_blue_desaturate") - self.radio7 = self.glade.get_widget("radio_filter_positive_hue_shift") - self.radio8 = self.glade.get_widget("radio_filter_negative_hue_shift") - self.hbox_default = self.glade.get_widget("hbox_default") + self.ui = gtk.Builder() + self.ui.add_from_file(join(colorblind.SHARED_DATA_DIR, "colorblind-prefs.ui")) + + self.dialog = self.ui.get_object("window_preferences") + self.radio1 = self.ui.get_object("radio_filter_red_saturate") + self.radio2 = self.ui.get_object("radio_filter_green_saturate") + self.radio3 = self.ui.get_object("radio_filter_blue_saturate") + self.radio4 = self.ui.get_object("radio_filter_red_desaturate") + self.radio5 = self.ui.get_object("radio_filter_green_desaturate") + self.radio6 = self.ui.get_object("radio_filter_blue_desaturate") + self.radio7 = self.ui.get_object("radio_filter_positive_hue_shift") + self.radio8 = self.ui.get_object("radio_filter_negative_hue_shift") + self.hbox_default = self.ui.get_object("hbox_default") self.combofilters = gtk.combo_box_new_text () self.hbox_default.add (self.combofilters) self.combofilters.append_text (_("Selective Red Saturation")) @@ -217,19 +218,19 @@ class ColorblindPreferencesUI: self.combofilters.append_text (_("Selective Blue Desaturation")) self.combofilters.append_text (_("Positive Hue Shift")) self.combofilters.append_text (_("Negative Hue Shift")) - self.check_default_filter = self.glade.get_widget("check_default_filter") - self.button_close = self.glade.get_widget("button_close") + self.check_default_filter = self.ui.get_object("check_default_filter") + self.button_close = self.ui.get_object("button_close") # Retreive current values self.keybinding_on_off = colorblind.GCONF_CLIENT.get_string(applet.prefs.GCONF_KEYBINDING_ONOFF) self.keyboard_shortcut_entry_on_off = AccelEntry("c", self) self.keyboard_shortcut_entry_on_off.connect('accel-edited', self.on_keyboard_shortcut_entry_changed, colorblind.GCONF_KEYBINDING_ONOFF) - self.glade.get_widget("table_shortcut").attach(self.keyboard_shortcut_entry_on_off.get_widget(), 1, 2, 0, 1) + self.ui.get_object("table_shortcut").attach(self.keyboard_shortcut_entry_on_off.get_widget(), 1, 2, 0, 1) self.keybinding_switch = colorblind.GCONF_CLIENT.get_string(applet.prefs.GCONF_KEYBINDING_SWITCH) self.keyboard_shortcut_entry_switch = AccelEntry("n", self) self.keyboard_shortcut_entry_switch.connect('accel-edited', self.on_keyboard_shortcut_entry_changed, colorblind.GCONF_KEYBINDING_SWITCH) - self.glade.get_widget("table_shortcut").attach(self.keyboard_shortcut_entry_switch.get_widget(), 1, 2, 1, 2) + self.ui.get_object("table_shortcut").attach(self.keyboard_shortcut_entry_switch.get_widget(), 1, 2, 1, 2) colorblind.GCONF_CLIENT.notify_add (colorblind.GCONF_COLORBLIND_FILTER, self.sync_ui) self.colorblind_filter = colorblind.GCONF_CLIENT.get_int(colorblind.GCONF_COLORBLIND_FILTER) diff --git a/configure.in b/configure.in index e568b0e..fe5d54e 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. dnl required versions of other tools. m4_define([req_ver_glib], [1.3.11]) -m4_define([req_ver_gtk], [2.1.0]) +m4_define([req_ver_gtk], [2.12.0]) m4_define([req_ver_libbonobo], [1.107.0]) m4_define([req_ver_libspi], [0.12.1]) m4_define([req_ver_orbit], [2.3.100]) diff --git a/po/POTFILES.in b/po/POTFILES.in index 57931ae..f46a33a 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -3,7 +3,7 @@ colorblind/GNOME_Magnifier_ColorblindApplet.server.in.in colorblind/Keybinder.py colorblind/data/colorblind-applet.schemas.in colorblind/data/Colorblind_Applet.xml -colorblind/data/colorblind-prefs.glade +[type: gettext/glade]colorblind/data/colorblind-prefs.ui colorblind/ui/WindowUI.py colorblind/ui/About.py colorblind/ui/ColorblindPreferencesUI.py -- cgit v1.2.3