diff --git a/src/ManagedWindow.py b/src/ManagedWindow.py index abed94b00..a90e99278 100644 --- a/src/ManagedWindow.py +++ b/src/ManagedWindow.py @@ -32,6 +32,7 @@ the create/deletion of dialog windows. # #------------------------------------------------------------------------- from cStringIO import StringIO +import os #------------------------------------------------------------------------- # @@ -67,6 +68,7 @@ DISABLED = -1 #----------------------------------------------------------------------- def get_object(self,value): + raise DeprecationWarning, "ManagedWindow.get_object: shouldn't get here" if self.get_name() == value: return self elif hasattr(self,'get_children'): @@ -424,16 +426,14 @@ class ManagedWindow: def define_glade(self, top_module, glade_file=None): if glade_file is None: + raise TypeError, "ManagedWindow.define_glade: no glade file" glade_file = const.GLADE_FILE - builder = gtk.Builder() - builder.add_from_file(glade_file) - self._gladeobj = builder.get_object(top_module) - self._gladeobj.get_object = get_object + self._gladeobj = Glade(glade_file, "", top_module) return self._gladeobj def get_widget(self, name): assert(self._gladeobj) - object = get_object(self._gladeobj,name) + object = self._gladeobj.get_child_object(name) if object is not None: return object raise ValueError, ( diff --git a/src/ReportBase/_PaperMenu.py b/src/ReportBase/_PaperMenu.py index 9d7fb7086..cde7419ca 100644 --- a/src/ReportBase/_PaperMenu.py +++ b/src/ReportBase/_PaperMenu.py @@ -61,7 +61,6 @@ except: # #------------------------------------------------------------------------- paper_sizes = [] -_GLADE_FILE = "papermenu.glade" #------------------------------------------------------------------------- # diff --git a/src/ReportBase/_StyleEditor.py b/src/ReportBase/_StyleEditor.py index cdefdaab3..db722138f 100644 --- a/src/ReportBase/_StyleEditor.py +++ b/src/ReportBase/_StyleEditor.py @@ -55,13 +55,6 @@ import ListModel import ManagedWindow from glade import Glade -#------------------------------------------------------------------------ -# -# Constants -# -#------------------------------------------------------------------------ -_GLADE_FILE = "styleeditor.glade" - #------------------------------------------------------------------------ # # StyleList class diff --git a/src/glade.py b/src/glade.py index 011353e37..2fac1295e 100644 --- a/src/glade.py +++ b/src/glade.py @@ -80,16 +80,12 @@ class Glade(gtk.Builder): """ gtk.Builder.__init__(self) - if isinstance(toplevel, gtk.Container): # if we have a Gtk object - self.__toplevel = toplevel # just remember it - return # and we're done - filename_given = filename is not None dirname_given = dirname is not None # if filename not given, use module name to derive it - if not filename: + if not filename_given: filename = sys._getframe(1).f_code.co_filename filename = os.path.basename(filename) filename = filename.rpartition('.')[0] + '.glade' @@ -97,7 +93,7 @@ class Glade(gtk.Builder): # if dirname not given, use current directory - if not dirname: + if not dirname_given: dirname = sys._getframe(1).f_code.co_filename dirname = os.path.dirname(dirname) @@ -210,6 +206,8 @@ class Glade(gtk.Builder): if isinstance(toplevel, basestring): toplevel = self.get_object(toplevel) + # Simple Breadth-First Search + queue = [toplevel] while queue: obj = queue.pop(0) diff --git a/src/glade/editperson.glade b/src/glade/editperson.glade index 833db7688..e86b2a081 100644 --- a/src/glade/editperson.glade +++ b/src/glade/editperson.glade @@ -534,7 +534,7 @@ Title: A title used to refer to the person, such as 'Dr.' or 'Rev.' False Abandon changes and close window True - + False @@ -552,7 +552,7 @@ Title: A title used to refer to the person, such as 'Dr.' or 'Rev.' False Accept changes and close window True - + False diff --git a/src/glade/mergedata.glade b/src/glade/mergedata.glade index 2196da00a..ebb715795 100644 --- a/src/glade/mergedata.glade +++ b/src/glade/mergedata.glade @@ -178,7 +178,7 @@ True False True - + False @@ -194,7 +194,7 @@ True False True - + False @@ -367,7 +367,7 @@ True False True - + False @@ -384,7 +384,7 @@ True False True - + False @@ -400,7 +400,7 @@ True False True - + False diff --git a/src/plugins/export/ExportCd.py b/src/plugins/export/ExportCd.py index 94756c15f..247c511db 100644 --- a/src/plugins/export/ExportCd.py +++ b/src/plugins/export/ExportCd.py @@ -233,12 +233,18 @@ class PackageWriter: sys.getfilesystemencoding()) if os.path.isfile(newfile): self.copy_file(newfile, 'burn:///%s/%s' % (base, obase)) - - fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file")) - fs_top.hide_fileop_buttons() - fs_top.ok_button.connect('clicked', fs_ok_clicked) - fs_top.cancel_button.connect('clicked', fs_close_window) - fs_top.run() + + fs_top = gtk.FileChooserDialog("%s - GRAMPS" % _("Select file"), + buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + gtk.STOCK_OK, gtk.RESPONSE_OK) + ) + + response = fs_top.run() + if response == gtk.RESPONSE_OK: + fs_ok_clicked(fs_top) + elif response == gtk.RESPONSE_CANCEL: + fs_close_window(fs_top) + fs_top.destroy() #---------------------------------------------------------- diff --git a/src/plugins/export/ExportPkg.py b/src/plugins/export/ExportPkg.py index 053051db2..a9471a0a4 100644 --- a/src/plugins/export/ExportPkg.py +++ b/src/plugins/export/ExportPkg.py @@ -170,12 +170,18 @@ class PackageWriter: sys.getfilesystemencoding()) if os.path.isfile(name): archive.add(name) + + fs_top = gtk.FileChooserDialog("%s - GRAMPS" % _("Select file"), + buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + gtk.STOCK_OK, gtk.RESPONSE_OK) + ) + s + response = fs_top.run() + if response == gtk.RESPONSE_OK: + fs_ok_clicked(fs_top) + elif response == gtk.RESPONSE_CANCEL: + fs_close_window(fs_top) - fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file")) - fs_top.hide_fileop_buttons() - fs_top.ok_button.connect('clicked',fs_ok_clicked) - fs_top.cancel_button.connect('clicked',fs_close_window) - fs_top.run() fs_top.destroy() #--------------------------------------------------------------- @@ -242,4 +248,4 @@ plugin = ExportPlugin(name = _('GRAM_PS package (portable XML)'), export_function = writeData, extension = "gpkg", config = _config ) -pmgr.register_plugin(plugin) \ No newline at end of file +pmgr.register_plugin(plugin) diff --git a/src/plugins/export/exportcsv.glade b/src/plugins/export/exportcsv.glade index 5b220fdc8..e20d84157 100644 --- a/src/plugins/export/exportcsv.glade +++ b/src/plugins/export/exportcsv.glade @@ -238,7 +238,7 @@ True False True - + False @@ -254,7 +254,7 @@ True False True - + False diff --git a/src/plugins/export/exportftree.glade b/src/plugins/export/exportftree.glade index 690202b63..acbf81569 100644 --- a/src/plugins/export/exportftree.glade +++ b/src/plugins/export/exportftree.glade @@ -130,7 +130,7 @@ True False True - + False @@ -146,7 +146,7 @@ True False True - + False diff --git a/src/plugins/export/exportgeneweb.glade b/src/plugins/export/exportgeneweb.glade index cc2323f27..a8b37d324 100644 --- a/src/plugins/export/exportgeneweb.glade +++ b/src/plugins/export/exportgeneweb.glade @@ -260,7 +260,7 @@ True False True - + False diff --git a/src/plugins/export/exportvcalendar.glade b/src/plugins/export/exportvcalendar.glade index 1ca6e7172..17ac91191 100644 --- a/src/plugins/export/exportvcalendar.glade +++ b/src/plugins/export/exportvcalendar.glade @@ -98,7 +98,7 @@ True False True - + False @@ -114,7 +114,7 @@ True False True - + False diff --git a/src/plugins/export/exportvcard.glade b/src/plugins/export/exportvcard.glade index 330980f9e..5c5e6ad7f 100644 --- a/src/plugins/export/exportvcard.glade +++ b/src/plugins/export/exportvcard.glade @@ -96,7 +96,7 @@ True False True - + False diff --git a/src/plugins/tool/ChangeTypes.py b/src/plugins/tool/ChangeTypes.py index 65fd17e4b..80c59e9cb 100644 --- a/src/plugins/tool/ChangeTypes.py +++ b/src/plugins/tool/ChangeTypes.py @@ -48,14 +48,7 @@ from glade import Glade #------------------------------------------------------------------------- # -# Constants -# -#------------------------------------------------------------------------- -_GLADE_FILE = "changetype.glade" - -#------------------------------------------------------------------------- -# -# +# ChangeTypes class # #------------------------------------------------------------------------- class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow): diff --git a/src/plugins/tool/Check.py b/src/plugins/tool/Check.py index e640ab069..ed395b8c1 100644 --- a/src/plugins/tool/Check.py +++ b/src/plugins/tool/Check.py @@ -66,13 +66,6 @@ from QuestionDialog import OkDialog, MissingMediaDialog from BasicUtils import name_displayer as _nd from glade import Glade -#------------------------------------------------------------------------- -# -# Constants -# -#------------------------------------------------------------------------- -_GLADE_FILE = "summary.glade" - #------------------------------------------------------------------------- # # Low Level repair @@ -543,11 +536,15 @@ class CheckIntegrity: else: self.bad_photo.append(ObjectId) - fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file")) - fs_top.hide_fileop_buttons() - fs_top.ok_button.connect('clicked',fs_ok_clicked) - fs_top.cancel_button.connect('clicked',fs_close_window) - fs_top.run() + fs_top = gtk.FileChooserDialog("%s - GRAMPS" % _("Select file"), + buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + gtk.STOCK_OK, gtk.RESPONSE_OK) + ) + response = fs_top.run() + if response == gtk.RESPONSE_OK: + fs_ok_clicked(fs_top) + elif response == gtk.RESPONSE_CANCEL: + fs_close_window(fs_top) fs_top.destroy() #------------------------------------------------------------------------- diff --git a/src/plugins/tool/EventCmp.py b/src/plugins/tool/EventCmp.py index c74180e49..c735f62b6 100644 --- a/src/plugins/tool/EventCmp.py +++ b/src/plugins/tool/EventCmp.py @@ -66,7 +66,6 @@ from glade import Glade #------------------------------------------------------------------------- WIKI_HELP_PAGE = '%s_-_Tools' % const.URL_MANUAL_PAGE WIKI_HELP_SEC = _('manual|Compare_Individual_Events...') -_GLADE_FILE = "eventcmp.glade" #------------------------------------------------------------------------ # diff --git a/src/plugins/tool/FindDupes.py b/src/plugins/tool/FindDupes.py index de3c77f9f..deaaecbd1 100644 --- a/src/plugins/tool/FindDupes.py +++ b/src/plugins/tool/FindDupes.py @@ -65,7 +65,6 @@ _val2label = { WIKI_HELP_PAGE = '%s_-_Tools' % const.URL_MANUAL_PAGE WIKI_HELP_SEC = _('manual|Find_Possible_Duplicate_People...') -_GLADE_FILE = "merge.glade" #------------------------------------------------------------------------- # diff --git a/src/plugins/tool/changetypes.glade b/src/plugins/tool/changetypes.glade index ef83b88a2..eaff8c126 100644 --- a/src/plugins/tool/changetypes.glade +++ b/src/plugins/tool/changetypes.glade @@ -120,7 +120,7 @@ True False True - + False @@ -136,7 +136,7 @@ True False True - + False diff --git a/src/plugins/tool/check.glade b/src/plugins/tool/check.glade index 5138d0c3c..b80652bab 100644 --- a/src/plugins/tool/check.glade +++ b/src/plugins/tool/check.glade @@ -64,7 +64,7 @@ True False True - + False diff --git a/src/plugins/tool/eventcmp.glade b/src/plugins/tool/eventcmp.glade index 4d470c75b..e0e7e7f4f 100644 --- a/src/plugins/tool/eventcmp.glade +++ b/src/plugins/tool/eventcmp.glade @@ -86,7 +86,7 @@ True False True - + False diff --git a/src/widgets/__init__.py b/src/widgets/__init__.py index 8bc7369ef..528231369 100644 --- a/src/widgets/__init__.py +++ b/src/widgets/__init__.py @@ -1,3 +1,4 @@ + # # Gramps - a GTK+/GNOME based genealogy program # @@ -44,6 +45,7 @@ from gtk.glade import set_custom_handler def get_custom_handler(glade, function_name, widget_name, str1, str2, int1, int2): + raise DeprecationWarning, "get_custom_handler: shouldn't get here" if function_name == 'ValidatableMaskedEntry': return ValidatableMaskedEntry() if function_name == 'StyledTextEditor':