diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 0c5402373..35b03744f 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,19 @@ 2007-01-21 Don Allingham + * src/GrampsDb/_GrampsDBCallback.py: sys.getfilesystemencoding() + * src/GrampsDb/_GrampsBSDDB.py: sys.getfilesystemencoding() + * src/Exporter.py: sys.getfilesystemencoding() + * src/ReportBase/_FileEntry.py: sys.getfilesystemencoding() + * src/Editors/_EditMedia.py: sys.getfilesystemencoding() + * src/DisplayTabs/_SourceEmbedList.py: sys.getfilesystemencoding() + * src/plugins/WriteCD.py: sys.getfilesystemencoding() + * src/plugins/WritePkg.py: sys.getfilesystemencoding() + * src/plugins/Check.py: sys.getfilesystemencoding() + * src/plugins/EventCmp.py: sys.getfilesystemencoding() + * src/AddMedia.py: sys.getfilesystemencoding() + * src/DisplayModels/_BaseModel.py: sys.getfilesystemencoding() + * src/DateEdit.py: sys.getfilesystemencoding() + * src/ArgHandler.py: sys.getfilesystemencoding() + * src/DbLoader.py: sys.getfilesystemencoding() * src/GrampsDb/_GrampsBSDDB.py: catch exceptions * src/DisplayState.py: catch exceptions * src/DbLoader.py: catch exceptions (DbLoader.read_file): catch exception diff --git a/gramps2/src/AddMedia.py b/gramps2/src/AddMedia.py index f67d5c490..2178d4610 100644 --- a/gramps2/src/AddMedia.py +++ b/gramps2/src/AddMedia.py @@ -30,6 +30,7 @@ Provides the interface to allow a person to add a media object to the database. # #------------------------------------------------------------------------- import os +import sys #------------------------------------------------------------------------- # @@ -130,7 +131,8 @@ class AddMediaObject(ManagedWindow.ManagedWindow): mobj.set_handle(Utils.create_id()) mobj.set_mime_type(None) else: - filename = self.file_text.get_filename() + filename = unicode(self.file_text.get_filename(), + sys.getfilesystemencoding()) full_file = filename if self.relpath.get_active(): @@ -173,7 +175,8 @@ class AddMediaObject(ManagedWindow.ManagedWindow): see if the file exists. If it does, the imgae is loaded into the preview window. """ - filename = unicode(self.file_text.get_filename()) + filename = unicode(self.file_text.get_filename(), + sys.getfilesystemencoding()) basename = os.path.basename(filename) (root,ext) = os.path.splitext(basename) old_title = unicode(self.description.get_text()) diff --git a/gramps2/src/ArgHandler.py b/gramps2/src/ArgHandler.py index 7b094403f..100f0d708 100644 --- a/gramps2/src/ArgHandler.py +++ b/gramps2/src/ArgHandler.py @@ -39,6 +39,7 @@ import gtk # #------------------------------------------------------------------------- import os +import sys import getopt from gettext import gettext as _ @@ -738,7 +739,8 @@ class NewNativeDbPrompter: while (True): response = choose.run() if response == gtk.RESPONSE_OK: - filename = choose.get_filename() + filename = unicode(choose.get_filename(), + sys.getfilesystemencoding()) if filename == None: continue if os.path.splitext(filename)[1] != ".grdb": diff --git a/gramps2/src/DateEdit.py b/gramps2/src/DateEdit.py index 06ea20926..8d515f97c 100644 --- a/gramps2/src/DateEdit.py +++ b/gramps2/src/DateEdit.py @@ -68,7 +68,7 @@ import DateHandler import const import GrampsDisplay import ManagedWindow -from Errors import MaskError, ValidationError +from Errors import ValidationError #------------------------------------------------------------------------- # diff --git a/gramps2/src/DbLoader.py b/gramps2/src/DbLoader.py index e395eb382..1829bd0f6 100644 --- a/gramps2/src/DbLoader.py +++ b/gramps2/src/DbLoader.py @@ -30,6 +30,7 @@ Handling of loading new/existing databases. # #------------------------------------------------------------------------- import os +import sys from bsddb.db import DBAccessError, DBRunRecoveryError, DBPageNotFoundError, DBInvalidArgError from gettext import gettext as _ import logging @@ -98,7 +99,8 @@ class DbLoader: choose.set_current_folder(get_default_dir()) response = choose.run() if response == gtk.RESPONSE_OK: - filename = choose.get_filename() + filename = unicode(choose.get_filename(), + sys.getfilesystemencoding()) if self.check_errors(filename): return ('','') @@ -147,7 +149,8 @@ class DbLoader: while (True): response = choose.run() if response == gtk.RESPONSE_OK: - filename = choose.get_filename() + filename = unicode(choose.get_filename(), + sys.getfilesystemencoding()) if self.check_errors(filename): return ('','') @@ -209,7 +212,8 @@ class DbLoader: response = choose.run() if response == gtk.RESPONSE_OK: - filename = choose.get_filename() + filename = unicode(choose.get_filename(), + sys.getfilesystemencoding()) if self.check_errors(filename): return ('','') @@ -300,7 +304,8 @@ class DbLoader: choose.set_current_folder(default_dir) response = choose.run() if response == gtk.RESPONSE_OK: - filename = choose.get_filename() + filename = unicode(choose.get_filename(), + sys.getfilesystemencoding()) if self.check_errors(filename): return False diff --git a/gramps2/src/DisplayModels/_BaseModel.py b/gramps2/src/DisplayModels/_BaseModel.py index 099af81e7..64be96311 100644 --- a/gramps2/src/DisplayModels/_BaseModel.py +++ b/gramps2/src/DisplayModels/_BaseModel.py @@ -152,9 +152,10 @@ class BaseModel(gtk.GenericTreeModel): def add_row_by_handle(self,handle): self.rebuild_data() - index = self.indexlist[handle] - node = self.get_iter(index) - self.row_inserted(index, node) + index = self.indexlist.get(handle) + if index: + node = self.get_iter(index) + self.row_inserted(index, node) def delete_row_by_handle(self,handle): index = self.indexlist[handle] diff --git a/gramps2/src/DisplayTabs/_SourceEmbedList.py b/gramps2/src/DisplayTabs/_SourceEmbedList.py index 546dad476..5ec4ff4d2 100644 --- a/gramps2/src/DisplayTabs/_SourceEmbedList.py +++ b/gramps2/src/DisplayTabs/_SourceEmbedList.py @@ -34,7 +34,6 @@ from gettext import gettext as _ #------------------------------------------------------------------------- import RelLib import Errors -import Utils from DdTargets import DdTargets from _SourceRefModel import SourceRefModel from _EmbeddedList import EmbeddedList diff --git a/gramps2/src/Editors/_EditMedia.py b/gramps2/src/Editors/_EditMedia.py index 106a16de1..60edd48c7 100644 --- a/gramps2/src/Editors/_EditMedia.py +++ b/gramps2/src/Editors/_EditMedia.py @@ -27,6 +27,7 @@ #------------------------------------------------------------------------- from gettext import gettext as _ import os +import sys #------------------------------------------------------------------------- # @@ -216,7 +217,8 @@ class EditMedia(EditPrimary): status = f.run() if status == gtk.RESPONSE_OK: - self.file_path.set_text(f.get_filename()) + self.file_path.set_text(unicode(f.get_filename(), + sys.getfilesystemencoding())) f.destroy() def setup_filepath(self): diff --git a/gramps2/src/Exporter.py b/gramps2/src/Exporter.py index 9c349e934..a3f9b9cf6 100644 --- a/gramps2/src/Exporter.py +++ b/gramps2/src/Exporter.py @@ -28,6 +28,7 @@ # #------------------------------------------------------------------------- import os +import sys from gettext import gettext as _ #------------------------------------------------------------------------- @@ -151,7 +152,8 @@ class Exporter: the selected options (format, filename) and present the summary of the proposed action. """ - filename = self.chooser.get_filename() + filename = unicode(self.chooser.get_filename(), + sys.getfilesystemencoding()) name = os.path.split(filename)[1] folder = os.path.split(filename)[0] ix = self.get_selected_format_index() @@ -172,7 +174,8 @@ class Exporter: Perform the actual Save As/Export operation. Depending on the success status, set the text for the final page. """ - filename = self.chooser.get_filename() + filename = unicode(self.chooser.get_filename(), + sys.getfilesystemencoding()) Config.set(Config.RECENT_EXPORT_DIR,os.path.split(filename)[0]) ix = self.get_selected_format_index() self.pre_save() diff --git a/gramps2/src/GrampsDb/_GrampsBSDDB.py b/gramps2/src/GrampsDb/_GrampsBSDDB.py index dc1a947e9..27dcaf385 100644 --- a/gramps2/src/GrampsDb/_GrampsBSDDB.py +++ b/gramps2/src/GrampsDb/_GrampsBSDDB.py @@ -34,7 +34,6 @@ import os import shutil import re import time -import locale from gettext import gettext as _ from bsddb import dbshelve, db import logging diff --git a/gramps2/src/GrampsDb/_GrampsDBCallback.py b/gramps2/src/GrampsDb/_GrampsDBCallback.py index 654dc358a..4103a55a9 100644 --- a/gramps2/src/GrampsDb/_GrampsDBCallback.py +++ b/gramps2/src/GrampsDb/_GrampsDBCallback.py @@ -40,6 +40,7 @@ import os import types import traceback import inspect +from gettext import gettext as _ from bsddb import db diff --git a/gramps2/src/ReportBase/_FileEntry.py b/gramps2/src/ReportBase/_FileEntry.py index 08bcc5039..89df9e9d6 100644 --- a/gramps2/src/ReportBase/_FileEntry.py +++ b/gramps2/src/ReportBase/_FileEntry.py @@ -21,6 +21,7 @@ # $Id$ import os +import sys import gtk class FileEntry(gtk.HBox): @@ -67,7 +68,8 @@ class FileEntry(gtk.HBox): f.present() status = f.run() if status == gtk.RESPONSE_OK: - self.set_filename(f.get_filename()) + self.set_filename(unicode(f.get_filename(), + sys.getfilesystemencoding())) f.destroy() def set_filename(self,path): diff --git a/gramps2/src/plugins/Check.py b/gramps2/src/plugins/Check.py index e5e7843a1..afe26a37e 100644 --- a/gramps2/src/plugins/Check.py +++ b/gramps2/src/plugins/Check.py @@ -28,6 +28,7 @@ # #------------------------------------------------------------------------- import os +import sys import cStringIO try: set() @@ -505,7 +506,8 @@ class CheckIntegrity: self.bad_photo.append(ObjectId) def fs_ok_clicked(obj): - name = fs_top.get_filename() + name = unicode(fs_top.get_filename(), + sys.getfilesystemencoding()) if os.path.isfile(name): obj = self.db.get_object_from_handle(ObjectId) obj.set_path(name) diff --git a/gramps2/src/plugins/EventCmp.py b/gramps2/src/plugins/EventCmp.py index d624e6b0d..906b8e6e8 100644 --- a/gramps2/src/plugins/EventCmp.py +++ b/gramps2/src/plugins/EventCmp.py @@ -28,6 +28,7 @@ # #------------------------------------------------------------------------ import os +import sys from gettext import gettext as _ #------------------------------------------------------------------------ @@ -413,7 +414,8 @@ class DisplayChart(ManagedWindow.ManagedWindow): f.set_current_folder(os.getcwd()) status = f.run() - name = unicode(f.get_filename()) + name = unicode(f.get_filename(), + sys.getfilesystemencoding()) f.destroy() if status == gtk.RESPONSE_OK: diff --git a/gramps2/src/plugins/WriteCD.py b/gramps2/src/plugins/WriteCD.py index 40de9f596..19b5b9178 100644 --- a/gramps2/src/plugins/WriteCD.py +++ b/gramps2/src/plugins/WriteCD.py @@ -28,6 +28,7 @@ # #------------------------------------------------------------------------- import os +import sys from cStringIO import StringIO from gettext import gettext as _ @@ -234,7 +235,8 @@ class PackageWriter: pass def fs_ok_clicked(obj): - newfile = fs_top.get_filename() + newfile = unicode(fs_top.get_filename(), + sys.getfilesystemencoding()) if os.path.isfile(newfile): self.copy_file(newfile,'burn:///%s/%s' % (base,obase)) ntype = Mime.get_type(newfile) diff --git a/gramps2/src/plugins/WritePkg.py b/gramps2/src/plugins/WritePkg.py index 9e5469145..6970b646b 100644 --- a/gramps2/src/plugins/WritePkg.py +++ b/gramps2/src/plugins/WritePkg.py @@ -29,6 +29,7 @@ #------------------------------------------------------------------------- import time import os +import sys import tarfile from cStringIO import StringIO from gettext import gettext as _ @@ -139,7 +140,8 @@ class PackageWriter: pass def fs_ok_clicked(obj): - name = fs_top.get_filename() + name = unicode(fs_top.get_filename(), + sys.getfilesystemencoding()) if os.path.isfile(name): archive.add(name)