From 2c5b7b691deaeb98801c1684ff1a817a41a574bf Mon Sep 17 00:00:00 2001 From: Don Allingham <don@gramps-project.org> Date: Mon, 31 Mar 2003 01:33:40 +0000 Subject: [PATCH] Example database menu item svn: r1413 --- src/Makefile.in | 1 + src/ansel_utf8.py | 6 - src/calendars/Makefile.in | 1 + src/const.py | 3 + src/const.py.in | 2 + src/data/Makefile.in | 1 + src/data/templates/Makefile.in | 1 + src/docgen/Makefile.in | 1 + src/filters/Makefile.in | 1 + src/gramps.glade | 62 ++--- src/gramps_main.py | 169 +++++++------- src/plugins/Makefile.in | 1 + src/plugins/ReadGedcom.py | 94 +++++--- src/plugins/gedcomimport.glade | 410 ++++++++++++++++----------------- src/po/Makefile.in | 1 + 15 files changed, 395 insertions(+), 359 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index fece68251..317ec03d3 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -73,6 +73,7 @@ GNOMEHELP = @GNOMEHELP@ GNOMEINC = @GNOMEINC@ GNOMELIB = @GNOMELIB@ GPREF = @GPREF@ +GPREFIX = @GPREFIX@ HAVE_JW = @HAVE_JW@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ diff --git a/src/ansel_utf8.py b/src/ansel_utf8.py index 9b6b9b717..1de8a10d1 100644 --- a/src/ansel_utf8.py +++ b/src/ansel_utf8.py @@ -278,7 +278,6 @@ _utoa = { def ansel_to_utf8(s): """Converts an ANSEL encoded string to UTF8""" - print s buff = cStringIO.StringIO() while s: c0 = ord(s[0]) @@ -288,23 +287,18 @@ def ansel_to_utf8(s): elif c0 > 127: l2 = s[0:2] l1 = s[0] - print "----------------------" if _twobyte.has_key(l2): head = _twobyte[l2] s = s[2:] - print "two" elif _onebyte.has_key(l1): head = _onebyte[l1] s = s[1:] - print "**8 one",l1,ord(l1),"*",_onebyte[l1], else: head = u'\xff\xfd' s = s[1:] - print "barf" else: head = s[0] s = s[1:] - print head,c0 buff.write(head) ans = buff.getvalue() buff.close() diff --git a/src/calendars/Makefile.in b/src/calendars/Makefile.in index 05b227c31..54ffc5af9 100644 --- a/src/calendars/Makefile.in +++ b/src/calendars/Makefile.in @@ -78,6 +78,7 @@ GNOMEHELP = @GNOMEHELP@ GNOMEINC = @GNOMEINC@ GNOMELIB = @GNOMELIB@ GPREF = @GPREF@ +GPREFIX = @GPREFIX@ HAVE_JW = @HAVE_JW@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ diff --git a/src/const.py b/src/const.py index fcb9929e1..59d5a6c88 100644 --- a/src/const.py +++ b/src/const.py @@ -44,6 +44,9 @@ convert = "convert" pixdir = "/usr/share/pixmaps" nautdir = "/usr/share/pixmaps/nautilus" +prefixdir = "/usr/local" + + #------------------------------------------------------------------------- # # Paths to files - assumes that files reside in the same directory as diff --git a/src/const.py.in b/src/const.py.in index fe35bd6a2..89bc56ad6 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -44,6 +44,8 @@ convert = "convert" pixdir = "/usr/share/pixmaps" nautdir = "/usr/share/pixmaps/nautilus" +prefixdir = "@GPREFIX@" + #------------------------------------------------------------------------- # # Paths to files - assumes that files reside in the same directory as diff --git a/src/data/Makefile.in b/src/data/Makefile.in index ea0ac70fc..be82afc61 100644 --- a/src/data/Makefile.in +++ b/src/data/Makefile.in @@ -73,6 +73,7 @@ GNOMEHELP = @GNOMEHELP@ GNOMEINC = @GNOMEINC@ GNOMELIB = @GNOMELIB@ GPREF = @GPREF@ +GPREFIX = @GPREFIX@ HAVE_JW = @HAVE_JW@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ diff --git a/src/data/templates/Makefile.in b/src/data/templates/Makefile.in index 0b89716b8..f447fdfb5 100644 --- a/src/data/templates/Makefile.in +++ b/src/data/templates/Makefile.in @@ -74,6 +74,7 @@ GNOMEHELP = @GNOMEHELP@ GNOMEINC = @GNOMEINC@ GNOMELIB = @GNOMELIB@ GPREF = @GPREF@ +GPREFIX = @GPREFIX@ HAVE_JW = @HAVE_JW@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ diff --git a/src/docgen/Makefile.in b/src/docgen/Makefile.in index de365f608..29f73f4ac 100644 --- a/src/docgen/Makefile.in +++ b/src/docgen/Makefile.in @@ -77,6 +77,7 @@ GNOMEHELP = @GNOMEHELP@ GNOMEINC = @GNOMEINC@ GNOMELIB = @GNOMELIB@ GPREF = @GPREF@ +GPREFIX = @GPREFIX@ HAVE_JW = @HAVE_JW@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ diff --git a/src/filters/Makefile.in b/src/filters/Makefile.in index 87645b93b..753b0b9f2 100644 --- a/src/filters/Makefile.in +++ b/src/filters/Makefile.in @@ -73,6 +73,7 @@ GNOMEHELP = @GNOMEHELP@ GNOMEINC = @GNOMEINC@ GNOMELIB = @GNOMELIB@ GPREF = @GPREF@ +GPREFIX = @GPREFIX@ HAVE_JW = @HAVE_JW@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ diff --git a/src/gramps.glade b/src/gramps.glade index 874a9a8eb..55ffc0bab 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -76,7 +76,7 @@ <signal name="activate" handler="on_revert_activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image118"> + <widget class="GtkImage" id="image159"> <property name="visible">True</property> <property name="stock">gtk-revert-to-saved</property> <property name="icon_size">1</property> @@ -112,7 +112,7 @@ <property name="use_underline">True</property> <child internal-child="image"> - <widget class="GtkImage" id="image119"> + <widget class="GtkImage" id="image160"> <property name="visible">True</property> <property name="stock">gtk-convert</property> <property name="icon_size">1</property> @@ -128,12 +128,12 @@ <child> <widget class="GtkImageMenuItem" id="reload_plugins"> <property name="visible">True</property> - <property name="label" translatable="yes">Reload plugins</property> + <property name="label" translatable="yes">Re_load plugins</property> <property name="use_underline">True</property> <signal name="activate" handler="on_reload_plugins_activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image120"> + <widget class="GtkImage" id="image161"> <property name="visible">True</property> <property name="stock">gtk-refresh</property> <property name="icon_size">1</property> @@ -176,12 +176,12 @@ <child> <widget class="GtkImageMenuItem" id="find"> <property name="visible">True</property> - <property name="label" translatable="yes">Find...</property> + <property name="label" translatable="yes">_Find...</property> <property name="use_underline">True</property> <signal name="activate" handler="on_find_activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image121"> + <widget class="GtkImage" id="image162"> <property name="visible">True</property> <property name="stock">gtk-find</property> <property name="icon_size">1</property> @@ -202,7 +202,7 @@ <signal name="activate" handler="on_merge_activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image122"> + <widget class="GtkImage" id="image163"> <property name="visible">True</property> <property name="stock">gtk-convert</property> <property name="icon_size">1</property> @@ -231,7 +231,7 @@ <child> <widget class="GtkCheckMenuItem" id="sidebar1"> <property name="visible">True</property> - <property name="label" translatable="yes">Sidebar</property> + <property name="label" translatable="yes">_Sidebar</property> <property name="use_underline">True</property> <property name="active">True</property> <signal name="activate" handler="on_sidebar1_activate" last_modification_time="Thu, 05 Sep 2002 00:58:01 GMT"/> @@ -241,7 +241,7 @@ <child> <widget class="GtkCheckMenuItem" id="filter1"> <property name="visible">True</property> - <property name="label" translatable="yes">Filter</property> + <property name="label" translatable="yes">_Filter</property> <property name="use_underline">True</property> <property name="active">True</property> <signal name="activate" handler="on_filter1_activate" last_modification_time="Thu, 05 Sep 2002 01:38:10 GMT"/> @@ -270,7 +270,7 @@ <accelerator key="D" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image123"> + <widget class="GtkImage" id="image164"> <property name="visible">True</property> <property name="stock">gtk-index</property> <property name="icon_size">1</property> @@ -292,7 +292,7 @@ <accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image124"> + <widget class="GtkImage" id="image165"> <property name="visible">True</property> <property name="stock">gnome-stock-book-open</property> <property name="icon_size">1</property> @@ -314,7 +314,7 @@ <child> <widget class="GtkMenuItem" id="jump_to"> <property name="visible">True</property> - <property name="label" translatable="yes">Go to bookmark</property> + <property name="label" translatable="yes">_Go to bookmark</property> <property name="use_underline">True</property> </widget> </child> @@ -364,7 +364,7 @@ <signal name="activate" handler="on_default_person_activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image125"> + <widget class="GtkImage" id="image166"> <property name="visible">True</property> <property name="stock">gtk-home</property> <property name="icon_size">1</property> @@ -398,7 +398,7 @@ <signal name="activate" handler="on_contents_activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image126"> + <widget class="GtkImage" id="image167"> <property name="visible">True</property> <property name="stock">gnome-stock-book-red</property> <property name="icon_size">1</property> @@ -411,27 +411,6 @@ </widget> </child> - <child> - <widget class="GtkImageMenuItem" id="writing_extensions"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Writing extensions</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_writing_extensions_activate"/> - - <child internal-child="image"> - <widget class="GtkImage" id="image127"> - <property name="visible">True</property> - <property name="stock">gnome-stock-book-blue</property> - <property name="icon_size">1</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> - </widget> - </child> - <child> <widget class="GtkImageMenuItem" id="gramps_home_page"> <property name="visible">True</property> @@ -440,7 +419,7 @@ <signal name="activate" handler="on_gramps_home_page_activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image128"> + <widget class="GtkImage" id="image168"> <property name="visible">True</property> <property name="stock">gtk-jump-to</property> <property name="icon_size">1</property> @@ -461,7 +440,7 @@ <signal name="activate" handler="on_gramps_mailing_lists_activate"/> <child internal-child="image"> - <widget class="GtkImage" id="image129"> + <widget class="GtkImage" id="image169"> <property name="visible">True</property> <property name="stock">gnome-stock-mail</property> <property name="icon_size">1</property> @@ -492,6 +471,15 @@ </widget> </child> + <child> + <widget class="GtkMenuItem" id="open_example_database1"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Open example database</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_open_example" last_modification_time="Sun, 30 Mar 2003 04:49:11 GMT"/> + </widget> + </child> + <child> <widget class="GtkImageMenuItem" id="about1"> <property name="visible">True</property> diff --git a/src/gramps_main.py b/src/gramps_main.py index 327b92585..5c31ce711 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -105,8 +105,12 @@ class Gramps: (_('Birth date'),6,150),(_('Death date'),7,150), ('',5,0), ('',6,0), ('',7,0) ] - self.program = gnome.program_init("gramps",const.version) - + self.program = gnome.program_init('gramps',const.version) + self.program.set_property('app-libdir','%s/lib' % const.prefixdir) + self.program.set_property('app-datadir','%s/share/gramps' % const.prefixdir) + self.program.set_property('app-sysconfdir','%s/etc' % const.prefixdir) + self.program.set_property('app-prefix', const.prefixdir) + self.DataFilter = Filter.Filter("") self.parents_index = 0 self.active_person = None @@ -263,58 +267,58 @@ class Gramps: "on_removebtn_clicked" : self.remove_button_clicked, "on_alpha_switch_page" : self.change_alpha_page, "delete_event" : self.delete_event, - "destroy_passed_object" : Utils.destroy_passed_object, - "on_about_activate" : self.on_about_activate, - "on_add_bookmark_activate" : self.on_add_bookmark_activate, - "on_add_place_clicked" : self.place_view.on_add_place_clicked, - "on_add_source_clicked" : self.source_view.on_add_clicked, - "on_addperson_clicked" : self.load_new_person, - "on_apply_filter_clicked" : self.on_apply_filter_clicked, - "on_arrow_left_clicked" : self.pedigree_view.on_show_child_menu, - "on_canvas1_event" : self.pedigree_view.on_canvas1_event, - "on_contents_activate" : self.on_contents_activate, - "on_default_person_activate" : self.on_default_person_activate, - "on_delete_person_clicked" : self.delete_person_clicked, - "on_delete_place_clicked" : self.place_view.on_delete_clicked, - "on_delete_source_clicked" : self.source_view.on_delete_clicked, - "on_delete_media_clicked" : self.media_view.on_delete_clicked, - "on_edit_active_person" : self.load_active_person, - "on_edit_selected_people" : self.load_selected_people, - "on_edit_bookmarks_activate" : self.on_edit_bookmarks_activate, - "on_exit_activate" : self.on_exit_activate, - "on_family1_activate" : self.on_family1_activate, - "on_find_activate" : self.on_find_activate, - "on_findname_activate" : self.on_findname_activate, - "on_home_clicked" : self.on_home_clicked, - "on_new_clicked" : self.on_new_clicked, - "on_notebook1_switch_page" : self.on_views_switch_page, - "on_ok_button1_clicked" : self.on_ok_button1_clicked, - "on_open_activate" : self.on_open_activate, - "on_pedigree1_activate" : self.on_pedigree1_activate, - "on_person_list1_activate" : self.on_person_list1_activate, - "on_main_key_release_event" : self.on_main_key_release_event, - "on_media_activate" : self.on_media_activate, - "on_media_list_select_row" : self.media_view.on_select_row, - "on_media_list_drag_data_get" : self.media_view.on_drag_data_get, - "on_media_list_drag_data_received" : self.media_view.on_drag_data_received, - "on_merge_activate" : self.on_merge_activate, - "on_sidebar1_activate" : self.on_sidebar_activate, - "on_filter1_activate" : self.on_filter_activate, - "on_places_activate" : self.on_places_activate, - "on_preferences1_activate" : self.on_preferences_activate, - "on_reload_plugins_activate" : Plugins.reload_plugins, - "on_reports_clicked" : self.on_reports_clicked, - "on_revert_activate" : self.on_revert_activate, - "on_save_activate" : self.on_save_activate, - "on_save_as_activate" : self.on_save_as_activate, - "on_show_plugin_status" : self.on_show_plugin_status, - "on_source_list_button_press" : self.source_view.button_press, - "on_sources_activate" : self.on_sources_activate, - "on_tools_clicked" : self.on_tools_clicked, - "on_gramps_home_page_activate" : self.home_page_activate, - "on_gramps_report_bug_activate" : self.report_bug_activate, - "on_gramps_mailing_lists_activate" : self.mailing_lists_activate, - "on_writing_extensions_activate" : self.on_writing_extensions_activate, + "destroy_passed_object" : Utils.destroy_passed_object, + "on_about_activate" : self.on_about_activate, + "on_add_bookmark_activate" : self.on_add_bookmark_activate, + "on_add_place_clicked" : self.place_view.on_add_place_clicked, + "on_add_source_clicked" : self.source_view.on_add_clicked, + "on_addperson_clicked" : self.load_new_person, + "on_apply_filter_clicked" : self.on_apply_filter_clicked, + "on_arrow_left_clicked" : self.pedigree_view.on_show_child_menu, + "on_canvas1_event" : self.pedigree_view.on_canvas1_event, + "on_contents_activate" : self.on_contents_activate, + "on_default_person_activate" : self.on_default_person_activate, + "on_delete_person_clicked" : self.delete_person_clicked, + "on_delete_place_clicked" : self.place_view.on_delete_clicked, + "on_delete_source_clicked" : self.source_view.on_delete_clicked, + "on_delete_media_clicked" : self.media_view.on_delete_clicked, + "on_edit_active_person" : self.load_active_person, + "on_edit_selected_people" : self.load_selected_people, + "on_edit_bookmarks_activate" : self.on_edit_bookmarks_activate, + "on_exit_activate" : self.on_exit_activate, + "on_family1_activate" : self.on_family1_activate, + "on_find_activate" : self.on_find_activate, + "on_findname_activate" : self.on_findname_activate, + "on_home_clicked" : self.on_home_clicked, + "on_new_clicked" : self.on_new_clicked, + "on_notebook1_switch_page" : self.on_views_switch_page, + "on_ok_button1_clicked" : self.on_ok_button1_clicked, + "on_open_activate" : self.on_open_activate, + "on_pedigree1_activate" : self.on_pedigree1_activate, + "on_person_list1_activate" : self.on_person_list1_activate, + "on_main_key_release_event" : self.on_main_key_release_event, + "on_media_activate" : self.on_media_activate, + "on_media_list_select_row" : self.media_view.on_select_row, + "on_media_list_drag_data_get" : self.media_view.on_drag_data_get, + "on_media_list_drag_data_received" : self.media_view.on_drag_data_received, + "on_merge_activate" : self.on_merge_activate, + "on_sidebar1_activate" : self.on_sidebar_activate, + "on_filter1_activate" : self.on_filter_activate, + "on_places_activate" : self.on_places_activate, + "on_preferences1_activate" : self.on_preferences_activate, + "on_reload_plugins_activate" : Plugins.reload_plugins, + "on_reports_clicked" : self.on_reports_clicked, + "on_revert_activate" : self.on_revert_activate, + "on_save_activate" : self.on_save_activate, + "on_save_as_activate" : self.on_save_as_activate, + "on_show_plugin_status" : self.on_show_plugin_status, + "on_source_list_button_press" : self.source_view.button_press, + "on_sources_activate" : self.on_sources_activate, + "on_tools_clicked" : self.on_tools_clicked, + "on_gramps_home_page_activate" : self.home_page_activate, + "on_gramps_report_bug_activate" : self.report_bug_activate, + "on_gramps_mailing_lists_activate" : self.mailing_lists_activate, + "on_open_example" : self.open_example, }) self.enable_filter(self.use_filter) @@ -538,31 +542,7 @@ class Gramps: def on_contents_activate(self,obj): """Display the GRAMPS manual""" - - WarningDialog(_('HELP is currently not available'), - _('Documentation for GRAMPS is currently being ' - 'developed, but is not yet available for this ' - 'version.')) - -# url = gnome.help_display_with_doc_id(self.program, -# "", -# "gramps-manual.sgml", -# "") -# if url: -# url = "gnome-help:"+url -# gnome.help.goto(url) - - def on_writing_extensions_activate(self,obj): - """Display the Extending GRAMPS manual""" - WarningDialog(_('HELP is currently not available'), - _('Documentation for GRAMPS is currently being ' - 'developed, but is not yet available for this ' - 'version.')) -# import gnome.help -# url = gnome.help.file_find_file("extending-gramps","extending-gramps.sgml") -# if url: -# url = "gnome-help:"+url -# gnome.help.goto(url) + gnome.help_display('gramps-manual','index') def on_new_clicked(self,obj): """Prompt for permission to close the current database""" @@ -1539,11 +1519,42 @@ class Gramps: def on_main_key_release_event(self,obj,event): """Respond to the insert and delete buttons in the person list""" + pass #if event.keyval == GDK.Delete: # self.on_delete_person_clicked(obj) #elif event.keyval == GDK.Insert: # self.load_new_person(obj) + def open_example(self,obj): + import shutil + dest = os.path.expanduser("~/.gramps/example") + if not os.path.isdir(dest): + try: + os.mkdir(dest) + except IOError,msg: + ErrorDialog(_('Could not create database'), + _('The directgory ~/.gramps/example could not ' + 'be created.' + '\n' + str(msg) )) + except OSError,msg: + ErrorDialog(_('Could not create database'), + _('The directgory ~/.gramps/example could not ' + 'be created.' + '\n' + str(msg) )) + except: + ErrorDialog(_('Could not create database'), + _('The directgory ~/.gramps/example could not ' + 'be created.')) + + try: + dir = "%s/share/gramps/example" % const.prefixdir + for file in os.listdir(dir): + shutil.copy("%s/%s" % (dir,file), dest) + except IOError,msg: + ErrorDialog(_('Example database not created'),str(msg)) + except OSError,msg: + ErrorDialog(_('Example database not created'),str(msg)) + + self.read_file(dir) + DARKEN = 1.4 def ms_shift_color_component (component, shift_by): diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in index ce68504bd..5e0ad42ac 100644 --- a/src/plugins/Makefile.in +++ b/src/plugins/Makefile.in @@ -78,6 +78,7 @@ GNOMEHELP = @GNOMEHELP@ GNOMEINC = @GNOMEINC@ GNOMELIB = @GNOMELIB@ GPREF = @GPREF@ +GPREFIX = @GPREFIX@ HAVE_JW = @HAVE_JW@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index 8e29755b5..f32bb20f5 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -75,6 +75,14 @@ def nocnv(s): photo_types = [ "jpeg", "bmp", "pict", "pntg", "tpic", "png", "gif", "jpg", "tiff", "pcx" ] +file_systems = { + 'VFAT' : _('Windows 9x file system'), + 'FAT' : _('Windows 9x file system'), + "NTFS" : _('Windows NT file system'), + "ISO9660" : _('CD ROM'), + "SMBFS" : _('Networked Windows file system') + } + #------------------------------------------------------------------------- # # GEDCOM events to GRAMPS events conversion @@ -215,6 +223,8 @@ class GedcomParser: self.backoff = 0 self.cnv = nocnv + self.geddir = os.path.dirname(os.path.normpath(os.path.abspath(file))) + self.trans = string.maketrans('','') self.delc = self.trans[0:31] @@ -231,6 +241,7 @@ class GedcomParser: self.errors_obj = window.get_widget("errors") self.close_done = window.get_widget('close_done') self.error_text_obj = window.get_widget("error_text") + self.info_text_obj = window.get_widget("info_text") self.error_count = 0 @@ -241,24 +252,34 @@ class GedcomParser: self.gedattr[map[val]] = val if self.window: - self.update(self.file_obj,file) + self.update(self.file_obj,os.path.basename(file)) self.code = 0 self.search_paths = [] try: - f = open("/etc/fstab","r") + mypaths = [] + f = open("/proc/mounts","r") for line in f.readlines(): paths = string.split(line) - if len(paths) < 3: - continue - first = string.strip(paths[0]) - if first[0] == '#': - continue - if paths[2].upper() in ["VFAT","FAT","NTFS"]: + ftype = paths[2].upper() + if ftype in file_systems.keys(): + mypaths.append((paths[1],file_systems[ftype])) self.search_paths.append(paths[1]) f.close() + + if len(mypaths): + self.infomsg(_("Windows style path names for images will use the following mount " + "points to try to find the images. These paths are based on Windows " + "compatible file systems available on this system:\n\n")) + for p in mypaths: + self.infomsg("\t%s : %s\n" % p) + + self.infomsg('\n') + self.infomsg(_("Images that cannot be found in the specfied path in the GEDCOM file " + "will be searched for in the same directory in which the GEDCOM file " + "exists (%s).\n") % self.geddir) except: pass @@ -268,23 +289,34 @@ class GedcomParser: except TypeError: self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + def infomsg(self,msg): + try: + self.info_text_obj.get_buffer().insert_at_cursor(msg) + except TypeError: + self.info_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + def find_file(self,fullname,altpath): + tries = [] fullname = string.replace(fullname,'\\','/') + tries.append(fullname) + if os.path.isfile(fullname): - return fullname + return (1,fullname) other = os.path.join(altpath,os.path.basename(fullname)) + tries.append(other) if os.path.isfile(other): - return other + return (1,other) if len(fullname) > 3: if fullname[1] == ':': fullname = fullname[2:] for path in self.search_paths: - other = os.path.join(path,os.path.basename(fullname)) + other = os.path.normpath("%s/%s" % (path,fullname)) + tries.append(other) if os.path.isfile(other): - return other - return "" + return (1,other) + return (0,tries) else: - return "" + return (0,tries) def update(self,field,text): field.set_text(text) @@ -317,8 +349,6 @@ class GedcomParser: msg = "%s\n\t%s\n" % (msg,self.text) self.errmsg(msg) self.error_count = self.error_count + 1 - if self.window: - self.update(self.errors_obj,str(self.error_count)) self.groups = (999, "XXX", "XXX") self.backoff = 0 return self.groups @@ -334,7 +364,6 @@ class GedcomParser: if self.window: self.errmsg(msg) self.error_count = self.error_count + 1 - self.update(self.errors_obj,str(self.error_count)) else: print msg self.ignore_sub_junk(level) @@ -343,7 +372,6 @@ class GedcomParser: if self.window: self.errmsg(msg) self.error_count = self.error_count + 1 - self.update(self.errors_obj,str(self.error_count)) else: print msg @@ -371,8 +399,7 @@ class GedcomParser: t = time.time() - t msg = _('Import Complete: %d seconds') % t if self.window: - self.errmsg(msg) - return self.close_done.get_active() + self.infomsg("\n%s" % msg) else: print msg return None @@ -901,9 +928,12 @@ class GedcomParser: url.set_description(title) self.person.addUrl(url) else: - path = self.find_file(file,self.dir_path) - if path == "": - self.warn(_("Could not import %s") % file + "\n") + (ok,path) = self.find_file(file,self.dir_path) + if not ok: + self.warn(_("Warning: could not import %s") % file + "\n") + self.warn(_("\tThe following paths were tried:\n\t\t")) + self.warn(string.join(path,"\n\t\t")) + self.warn('\n') else: photo = RelLib.Photo() photo.setPath(path) @@ -936,9 +966,12 @@ class GedcomParser: self.barf(level+1) if form: - path = self.find_file(file,self.dir_path) - if path == "": - self.warn(_("Could not import %s") % file + "\n") + (ok,path) = self.find_file(file,self.dir_path) + if not ok: + self.warn(_("Warning: could not import %s") % file + "\n") + self.warn(_("\tThe following paths were tried:\n\t\t")) + self.warn(string.join(path,"\n\t\t")) + self.warn('\n') else: photo = RelLib.Photo() photo.setPath(path) @@ -971,9 +1004,12 @@ class GedcomParser: self.barf(level+1) if form: - path = self.find_file(file,self.dir_path) - if path == "": - self.warn(_("Could not import %s") % file) + (ok,path) = self.find_file(file,self.dir_path) + if not ok: + self.warn(_("Warning: could not import %s") % file + "\n") + self.warn(_("\tThe following paths were tried:\n\t\t")) + self.warn(string.join(path,"\n\t\t")) + self.warn('\n') else: photo = RelLib.Photo() photo.setPath(path) diff --git a/src/plugins/gedcomimport.glade b/src/plugins/gedcomimport.glade index a61575b40..90befce33 100644 --- a/src/plugins/gedcomimport.glade +++ b/src/plugins/gedcomimport.glade @@ -9,8 +9,8 @@ <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">True</property> - <property name="default_width">500</property> - <property name="default_height">450</property> + <property name="default_width">600</property> + <property name="default_height">500</property> <property name="resizable">True</property> <property name="destroy_with_parent">False</property> @@ -45,8 +45,8 @@ <widget class="GtkTable" id="table1"> <property name="border_width">12</property> <property name="visible">True</property> - <property name="n_rows">11</property> - <property name="n_columns">3</property> + <property name="n_rows">10</property> + <property name="n_columns">5</property> <property name="homogeneous">False</property> <property name="row_spacing">6</property> <property name="column_spacing">12</property> @@ -100,12 +100,12 @@ </child> <child> - <widget class="GtkLabel" id="label8"> + <widget class="GtkLabel" id="label13"> <property name="visible">True</property> - <property name="label" translatable="yes">Version:</property> + <property name="label" translatable="yes"><b>Status</b></property> <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0</property> @@ -114,34 +114,10 @@ <property name="ypad">0</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label9"> - <property name="visible">True</property> - <property name="label" translatable="yes">Families:</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="left_attach">0</property> + <property name="right_attach">5</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> @@ -164,20 +140,76 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="label11"> + <widget class="GtkEntry" id="people"> <property name="visible">True</property> - <property name="label" translatable="yes">Errors:</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char" translatable="yes">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTextView" id="info_text"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="justification">GTK_JUSTIFY_LEFT</property> + <property name="wrap_mode">GTK_WRAP_WORD</property> + <property name="cursor_visible">True</property> + <property name="pixels_above_lines">0</property> + <property name="pixels_below_lines">0</property> + <property name="pixels_inside_wrap">0</property> + <property name="left_margin">0</property> + <property name="right_margin">0</property> + <property name="indent">0</property> + <property name="text" translatable="yes"></property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">5</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> + <property name="x_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label14"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Information</b></property> <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0</property> @@ -186,15 +218,96 @@ <property name="ypad">0</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> + <property name="left_attach">0</property> + <property name="right_attach">5</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> + <child> + <widget class="GtkLabel" id="label16"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Warning messages</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">5</property> + <property name="top_attach">8</property> + <property name="bottom_attach">9</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTextView" id="error_text"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="justification">GTK_JUSTIFY_LEFT</property> + <property name="wrap_mode">GTK_WRAP_NONE</property> + <property name="cursor_visible">True</property> + <property name="pixels_above_lines">0</property> + <property name="pixels_below_lines">0</property> + <property name="pixels_inside_wrap">0</property> + <property name="left_margin">0</property> + <property name="right_margin">0</property> + <property name="indent">0</property> + <property name="text" translatable="yes"></property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">5</property> + <property name="top_attach">9</property> + <property name="bottom_attach">10</property> + <property name="x_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="file"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">False</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char" translatable="yes">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="left_attach">2</property> + <property name="right_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options"></property> + </packing> + </child> + <child> <widget class="GtkLabel" id="label12"> <property name="visible">True</property> @@ -210,30 +323,30 @@ <property name="ypad">0</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkEntry" id="file"> + <widget class="GtkEntry" id="encoding"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">False</property> <property name="visibility">True</property> - <property name="max_length">0</property> + <property name="max_length">10</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> <property name="invisible_char" translatable="yes">*</property> <property name="activates_default">False</property> </widget> <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> + <property name="left_attach">4</property> + <property name="right_attach">5</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> <property name="y_options"></property> @@ -267,38 +380,41 @@ <property name="can_focus">True</property> <property name="editable">False</property> <property name="visibility">True</property> - <property name="max_length">0</property> + <property name="max_length">10</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> <property name="invisible_char" translatable="yes">*</property> <property name="activates_default">False</property> </widget> <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="left_attach">4</property> + <property name="right_attach">5</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkEntry" id="encoding"> + <widget class="GtkLabel" id="label8"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> + <property name="label" translatable="yes">Version:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> </widget> <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> @@ -316,84 +432,21 @@ <property name="activates_default">False</property> </widget> <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="left_attach">4</property> + <property name="right_attach">5</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkEntry" id="people"> + <widget class="GtkLabel" id="label9"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="errors"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">7</property> - <property name="bottom_attach">8</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="close_done"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Close window when complete</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">8</property> - <property name="bottom_attach">9</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Status</b></property> + <property name="label" translatable="yes">Families:</property> <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0</property> @@ -402,73 +455,14 @@ <property name="ypad">0</property> </widget> <packing> - <property name="left_attach">0</property> - <property name="right_attach">3</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> + <property name="left_attach">3</property> + <property name="right_attach">4</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> - - <child> - <widget class="GtkLabel" id="label14"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Messages</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">3</property> - <property name="top_attach">9</property> - <property name="bottom_attach">10</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTextView" id="error_text"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">False</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_WORD</property> - <property name="cursor_visible">True</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">10</property> - <property name="bottom_attach">11</property> - <property name="x_options">fill</property> - </packing> - </child> </widget> <packing> <property name="padding">0</property> @@ -482,7 +476,7 @@ <property name="border_width">12</property> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">30</property> + <property name="spacing">12</property> <child> <widget class="GtkButton" id="close"> @@ -498,7 +492,7 @@ </widget> <packing> <property name="padding">0</property> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> </packing> </child> diff --git a/src/po/Makefile.in b/src/po/Makefile.in index f28c546b9..c6234ef97 100644 --- a/src/po/Makefile.in +++ b/src/po/Makefile.in @@ -73,6 +73,7 @@ GNOMEHELP = @GNOMEHELP@ GNOMEINC = @GNOMEINC@ GNOMELIB = @GNOMELIB@ GPREF = @GPREF@ +GPREFIX = @GPREFIX@ HAVE_JW = @HAVE_JW@ HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@