From a0a0e6f20a9b5f7c8aee9dcb0e99bb014ebc239f Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Sat, 18 Apr 2009 18:36:18 +0000 Subject: [PATCH] Bug 2888: rule.glade: convert from libglade to gtkbuilder svn: r12476 --- src/ManagedWindow.py | 36 +- src/glade/rule.glade | 2198 ++++++++++++++++++------------------------ 2 files changed, 966 insertions(+), 1268 deletions(-) diff --git a/src/ManagedWindow.py b/src/ManagedWindow.py index 7bb5e0dd9..daad24a4f 100644 --- a/src/ManagedWindow.py +++ b/src/ManagedWindow.py @@ -39,7 +39,6 @@ from cStringIO import StringIO # #------------------------------------------------------------------------- import gtk -from gtk import glade #------------------------------------------------------------------------- # @@ -60,6 +59,22 @@ _win_top = '' _win_btm = '' DISABLED = -1 +#----------------------------------------------------------------------- +# +# Helper function +# +#----------------------------------------------------------------------- + +def get_object(self,value): + if self.get_name() == value: + return self + elif hasattr(self,'get_children'): + for child in self.get_children(): + object = get_object(child, value) + if object is not None: + return object + return None + class GrampsWindowManager: """ Manage hierarchy of open GRAMPS windows. @@ -257,7 +272,8 @@ class GrampsWindowManager: idval = self.generate_id(i) data.write('' % self.generate_id(i)) - action_data.append((idval, None, i.menu_label, None, None, + action_data.append((idval, None, i.menu_label, + None, None, self.call_back_factory(i))) if isinstance(mlist, (list, tuple)): data.write('') @@ -404,16 +420,26 @@ class ManagedWindow: def build_window_key(self, obj): return id(obj) - + def define_glade(self, top_module, glade_file=None): if glade_file is None: glade_file = const.GLADE_FILE - self._gladeobj = glade.XML(glade_file, top_module, "gramps") + builder = gtk.Builder() + builder.add_from_file(glade_file) + self._gladeobj = builder.get_object(top_module) + self._gladeobj.get_object = get_object return self._gladeobj def get_widget(self, name): assert(self._gladeobj) - return self._gladeobj.get_widget(name) + object = get_object(self._gladeobj,name) + if object is not None: + return object + raise ValueError, ( + 'ManagedWindow.get_widget: "%s" widget not found in "%s"' % + (name, self._gladeobj.get_name()) + ) + return object def connect_button(self, button_name, function): assert(self._gladeobj) diff --git a/src/glade/rule.glade b/src/glade/rule.glade index bcc6faa1c..4646b9537 100644 --- a/src/glade/rule.glade +++ b/src/glade/rule.glade @@ -1,1263 +1,935 @@ - - - - - - - True - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 500 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_CENTER - True - False - False - - - - - True - False - 8 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - - True - False - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - False - 0 - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 6 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - 12 - True - 8 - 4 - False - 6 - 12 - - - - True - False - 6 - - - - True - Add another rule to the filter - True - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - False - Edit the selected rule - True - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-edit - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - False - Delete the selected rule - True - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - - - - 3 - 4 - 4 - 5 - shrink - fill - - - - - - True - <b>Options</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 4 - 5 - 6 - fill - - - - - - - True - <b>Rule list</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 4 - 3 - 4 - fill - - - - - - - True - <b>Definition</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 4 - 0 - 1 - fill - - - - - - - True - Co_mment: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - comment - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 2 - 3 - fill - - - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 1 - 3 - 4 - 5 - - - - - - True - _Name: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - filter_name - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 1 - 2 - fill - - - - - - - True - True - Return values that do no_t match the filter rules - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 4 - 7 - 8 - fill - - - - - - - True - All rules must apply -At least one rule must apply -Exactly one rule must apply - False - True - - - 1 - 3 - 6 - 7 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - - 2 - 3 - 1 - 2 - expand|shrink|fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 2 - 3 - 2 - 3 - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 400 - 350 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_CENTER - True - False - False - - - - - True - False - 8 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - False - 0 - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 5 - False - False - - - - - - 6 - True - False - 6 - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - Add a new filter - True - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - False - Edit the selected filter - True - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-edit - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - False - Clone the selected filter - True - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-copy - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - Test the selected filter - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-execute - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - False - Delete the selected filter - True - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - - - - 0 - False - True - - - - - 5 - True - True - - - - - - True - <i>Note: changes take effect only after this window is closed</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 6 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - 0 - True - True - - - - - - - - True - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 450 - 400 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_CENTER - True - False - False - - - - - True - False - 8 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 6 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - - - True - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_CENTER - True - False - False - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - False - 0 - - - - True - - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 6 - False - False - - - - - - 6 - True - True - 0 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - 250 - True - True - True - False - False - False - False - False - False - - - - - False - False - - - - - - True - False - 6 - - - - True - <b>Selected Rule</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - No rule selected - False - False - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 12 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 6 - False - False - - - - - - True - <b>Description</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - No description - False - False - GTK_JUSTIFY_LEFT - True - False - 0 - 0 - 12 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 6 - False - False - - - - - - True - <b>Values</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - + + + + + + + + + + + + All rules must apply + + + At least one rule must apply + + + Exactly one rule must apply + + + + + 500 + dialog + center + False + + + + True + 8 + + + True + + + True + 6 + center + + + False + False + 0 + + + + + True + 12 + 8 + 4 + 12 + 6 + + + True + 6 + + + True + True + True + False + Add another rule to the filter + + + + True + gtk-add + 4 + + + + + False + False + 0 + + + + + True + False + True + True + False + Edit the selected rule + + + + True + gtk-edit + 4 + + + + + False + False + 1 + + + + + True + False + True + True + False + Delete the selected rule + + + + True + gtk-remove + 4 + + + + + False + False + 2 + + + + + + + + 3 + 4 + 4 + 5 + GTK_SHRINK + GTK_FILL + + + + + True + 0 + <b>Options</b> + True + + + 4 + 5 + 6 + GTK_FILL + + + + + + True + 0 + <b>Rule list</b> + True + + + 4 + 3 + 4 + GTK_FILL + + + + + + True + 0 + <b>Definition</b> + True + + + 4 + GTK_FILL + + + + + + True + 0 + Co_mment: + True + comment + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + + True + False + automatic + automatic + in + + + True + True + + + + + 1 + 3 + 4 + 5 + + + + + True + 0 + _Name: + True + filter_name + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + + Return values that do no_t match the filter rules + True + True + False + True + True + + + 1 + 4 + 7 + 8 + GTK_FILL + + + + + + True + model1 + + + + 0 + + + + + 1 + 3 + 6 + 7 + GTK_FILL + + + + + + True + True + + + + 2 + 3 + 1 + 2 + GTK_EXPAND | GTK_SHRINK | GTK_FILL + + + + + + True + True + + + 2 + 3 + 2 + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + 1 + + + + + True + end + + + gtk-cancel + True + True + True + False + True + + + + False + False + 0 + + + + + gtk-ok + True + False + True + True + False + True + + + + False + False + 1 + + + + + gtk-help + True + True + True + False + True + + + + False + False + 2 + + + + + False + end + 0 + + + + + + cancel + ok + help + + + + 400 + 350 + dialog + center + False + + + + True + 8 + + + True + + + True + center + + + False + False + 5 + 0 + + + + + True + 6 + 6 + + + True + False + automatic + automatic + in + + + True + True + + + + + 0 + + + + + True + 6 + + + True + True + True + False + Add a new filter + + + + True + gtk-add + 4 + + + + + False + False + 0 + + + + + True + False + True + True + False + Edit the selected filter + + + + True + gtk-edit + 4 + + + + + False + False + 1 + + + + + True + False + True + True + False + Clone the selected filter + + + + True + gtk-copy + 4 + + + + + False + False + 2 + + + + + True + True + False + Test the selected filter + + + + True + gtk-execute + 4 + + + + + False + False + 3 + + + + + True + False + True + True + False + Delete the selected filter + + + + True + gtk-remove + 4 + + + + + False + False + 4 + + + + + + + + False + 1 + + + + + 5 + 1 + + + + + True + 6 + <i>Note: changes take effect only after this window is closed</i> + True + + + False + False + 2 + + + + + 1 + + + + + True + end + + + gtk-close + True + True + True + False + True + + + + False + False + 0 + + + + + gtk-help + True + True + True + False + True + + + + False + False + 1 + + + + + False + end + 0 + + + + + + close + help + + + + 450 + 400 + dialog + center + False + + + + True + 8 + + + True + 6 + + + False + False + 1 + + + + + True + True + never + automatic + in + + + True + True + + + + + 2 + + + + + True + end + + + gtk-close + True + True + True + False + True + + + + False + False + 0 + + + + + False + end + 0 + + + + + + close + + + + center-on-parent + dialog + center + False + + + + True + + + True + 6 + + + True + True + + + False + False + 6 + 0 + + + + + True + True + 6 + + + True + True + automatic + automatic + in + + + 250 + True + True + False + + + + + False + False + + + + + True + 6 + + + True + 0 + <b>Selected Rule</b> + True + + + False + False + 0 + + + + + True + 0 + 12 + No rule selected + True + + + False + False + 6 + 1 + + + + + True + 0 + <b>Description</b> + True + + + False + False + 2 + + + + + True + 0 + 0 + 12 + No description + True + + + False + False + 6 + 3 + + + + + True + 0 + <b>Values</b> + True + + + False + False + 4 + + + + + True + True + + + + + 1 + + + + + 1 + + + + + True + end + + + gtk-cancel + True + True + True + False + True + + + + False + False + 0 + + + + + gtk-ok + True + True + True + False + True + + + + False + False + 1 + + + + + gtk-help + True + True + True + False + True + + + + False + False + 2 + + + + + False + end + 0 + + + + + + cancel + ok + help + + +