* 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()


svn: r7951
This commit is contained in:
Don Allingham 2007-01-22 03:56:23 +00:00
parent 9baee52474
commit 2406378435
16 changed files with 61 additions and 21 deletions

View File

@ -1,4 +1,19 @@
2007-01-21 Don Allingham <don@gramps-project.org> 2007-01-21 Don Allingham <don@gramps-project.org>
* 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/GrampsDb/_GrampsBSDDB.py: catch exceptions
* src/DisplayState.py: catch exceptions * src/DisplayState.py: catch exceptions
* src/DbLoader.py: catch exceptions (DbLoader.read_file): catch exception * src/DbLoader.py: catch exceptions (DbLoader.read_file): catch exception

View File

@ -30,6 +30,7 @@ Provides the interface to allow a person to add a media object to the database.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import sys
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -130,7 +131,8 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
mobj.set_handle(Utils.create_id()) mobj.set_handle(Utils.create_id())
mobj.set_mime_type(None) mobj.set_mime_type(None)
else: else:
filename = self.file_text.get_filename() filename = unicode(self.file_text.get_filename(),
sys.getfilesystemencoding())
full_file = filename full_file = filename
if self.relpath.get_active(): 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 see if the file exists. If it does, the imgae is loaded into
the preview window. the preview window.
""" """
filename = unicode(self.file_text.get_filename()) filename = unicode(self.file_text.get_filename(),
sys.getfilesystemencoding())
basename = os.path.basename(filename) basename = os.path.basename(filename)
(root,ext) = os.path.splitext(basename) (root,ext) = os.path.splitext(basename)
old_title = unicode(self.description.get_text()) old_title = unicode(self.description.get_text())

View File

@ -39,6 +39,7 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import sys
import getopt import getopt
from gettext import gettext as _ from gettext import gettext as _
@ -738,7 +739,8 @@ class NewNativeDbPrompter:
while (True): while (True):
response = choose.run() response = choose.run()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
filename = choose.get_filename() filename = unicode(choose.get_filename(),
sys.getfilesystemencoding())
if filename == None: if filename == None:
continue continue
if os.path.splitext(filename)[1] != ".grdb": if os.path.splitext(filename)[1] != ".grdb":

View File

@ -68,7 +68,7 @@ import DateHandler
import const import const
import GrampsDisplay import GrampsDisplay
import ManagedWindow import ManagedWindow
from Errors import MaskError, ValidationError from Errors import ValidationError
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -30,6 +30,7 @@ Handling of loading new/existing databases.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import sys
from bsddb.db import DBAccessError, DBRunRecoveryError, DBPageNotFoundError, DBInvalidArgError from bsddb.db import DBAccessError, DBRunRecoveryError, DBPageNotFoundError, DBInvalidArgError
from gettext import gettext as _ from gettext import gettext as _
import logging import logging
@ -98,7 +99,8 @@ class DbLoader:
choose.set_current_folder(get_default_dir()) choose.set_current_folder(get_default_dir())
response = choose.run() response = choose.run()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
filename = choose.get_filename() filename = unicode(choose.get_filename(),
sys.getfilesystemencoding())
if self.check_errors(filename): if self.check_errors(filename):
return ('','') return ('','')
@ -147,7 +149,8 @@ class DbLoader:
while (True): while (True):
response = choose.run() response = choose.run()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
filename = choose.get_filename() filename = unicode(choose.get_filename(),
sys.getfilesystemencoding())
if self.check_errors(filename): if self.check_errors(filename):
return ('','') return ('','')
@ -209,7 +212,8 @@ class DbLoader:
response = choose.run() response = choose.run()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
filename = choose.get_filename() filename = unicode(choose.get_filename(),
sys.getfilesystemencoding())
if self.check_errors(filename): if self.check_errors(filename):
return ('','') return ('','')
@ -300,7 +304,8 @@ class DbLoader:
choose.set_current_folder(default_dir) choose.set_current_folder(default_dir)
response = choose.run() response = choose.run()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
filename = choose.get_filename() filename = unicode(choose.get_filename(),
sys.getfilesystemencoding())
if self.check_errors(filename): if self.check_errors(filename):
return False return False

View File

@ -152,9 +152,10 @@ class BaseModel(gtk.GenericTreeModel):
def add_row_by_handle(self,handle): def add_row_by_handle(self,handle):
self.rebuild_data() self.rebuild_data()
index = self.indexlist[handle] index = self.indexlist.get(handle)
node = self.get_iter(index) if index:
self.row_inserted(index, node) node = self.get_iter(index)
self.row_inserted(index, node)
def delete_row_by_handle(self,handle): def delete_row_by_handle(self,handle):
index = self.indexlist[handle] index = self.indexlist[handle]

View File

@ -34,7 +34,6 @@ from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import RelLib import RelLib
import Errors import Errors
import Utils
from DdTargets import DdTargets from DdTargets import DdTargets
from _SourceRefModel import SourceRefModel from _SourceRefModel import SourceRefModel
from _EmbeddedList import EmbeddedList from _EmbeddedList import EmbeddedList

View File

@ -27,6 +27,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gettext import gettext as _ from gettext import gettext as _
import os import os
import sys
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -216,7 +217,8 @@ class EditMedia(EditPrimary):
status = f.run() status = f.run()
if status == gtk.RESPONSE_OK: 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() f.destroy()
def setup_filepath(self): def setup_filepath(self):

View File

@ -28,6 +28,7 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import sys
from gettext import gettext as _ from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -151,7 +152,8 @@ class Exporter:
the selected options (format, filename) and present the summary the selected options (format, filename) and present the summary
of the proposed action. of the proposed action.
""" """
filename = self.chooser.get_filename() filename = unicode(self.chooser.get_filename(),
sys.getfilesystemencoding())
name = os.path.split(filename)[1] name = os.path.split(filename)[1]
folder = os.path.split(filename)[0] folder = os.path.split(filename)[0]
ix = self.get_selected_format_index() ix = self.get_selected_format_index()
@ -172,7 +174,8 @@ class Exporter:
Perform the actual Save As/Export operation. Perform the actual Save As/Export operation.
Depending on the success status, set the text for the final page. 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]) Config.set(Config.RECENT_EXPORT_DIR,os.path.split(filename)[0])
ix = self.get_selected_format_index() ix = self.get_selected_format_index()
self.pre_save() self.pre_save()

View File

@ -34,7 +34,6 @@ import os
import shutil import shutil
import re import re
import time import time
import locale
from gettext import gettext as _ from gettext import gettext as _
from bsddb import dbshelve, db from bsddb import dbshelve, db
import logging import logging

View File

@ -40,6 +40,7 @@ import os
import types import types
import traceback import traceback
import inspect import inspect
from gettext import gettext as _
from bsddb import db from bsddb import db

View File

@ -21,6 +21,7 @@
# $Id$ # $Id$
import os import os
import sys
import gtk import gtk
class FileEntry(gtk.HBox): class FileEntry(gtk.HBox):
@ -67,7 +68,8 @@ class FileEntry(gtk.HBox):
f.present() f.present()
status = f.run() status = f.run()
if status == gtk.RESPONSE_OK: if status == gtk.RESPONSE_OK:
self.set_filename(f.get_filename()) self.set_filename(unicode(f.get_filename(),
sys.getfilesystemencoding()))
f.destroy() f.destroy()
def set_filename(self,path): def set_filename(self,path):

View File

@ -28,6 +28,7 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import sys
import cStringIO import cStringIO
try: try:
set() set()
@ -505,7 +506,8 @@ class CheckIntegrity:
self.bad_photo.append(ObjectId) self.bad_photo.append(ObjectId)
def fs_ok_clicked(obj): def fs_ok_clicked(obj):
name = fs_top.get_filename() name = unicode(fs_top.get_filename(),
sys.getfilesystemencoding())
if os.path.isfile(name): if os.path.isfile(name):
obj = self.db.get_object_from_handle(ObjectId) obj = self.db.get_object_from_handle(ObjectId)
obj.set_path(name) obj.set_path(name)

View File

@ -28,6 +28,7 @@
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import os import os
import sys
from gettext import gettext as _ from gettext import gettext as _
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -413,7 +414,8 @@ class DisplayChart(ManagedWindow.ManagedWindow):
f.set_current_folder(os.getcwd()) f.set_current_folder(os.getcwd())
status = f.run() status = f.run()
name = unicode(f.get_filename()) name = unicode(f.get_filename(),
sys.getfilesystemencoding())
f.destroy() f.destroy()
if status == gtk.RESPONSE_OK: if status == gtk.RESPONSE_OK:

View File

@ -28,6 +28,7 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import sys
from cStringIO import StringIO from cStringIO import StringIO
from gettext import gettext as _ from gettext import gettext as _
@ -234,7 +235,8 @@ class PackageWriter:
pass pass
def fs_ok_clicked(obj): def fs_ok_clicked(obj):
newfile = fs_top.get_filename() newfile = unicode(fs_top.get_filename(),
sys.getfilesystemencoding())
if os.path.isfile(newfile): if os.path.isfile(newfile):
self.copy_file(newfile,'burn:///%s/%s' % (base,obase)) self.copy_file(newfile,'burn:///%s/%s' % (base,obase))
ntype = Mime.get_type(newfile) ntype = Mime.get_type(newfile)

View File

@ -29,6 +29,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import time import time
import os import os
import sys
import tarfile import tarfile
from cStringIO import StringIO from cStringIO import StringIO
from gettext import gettext as _ from gettext import gettext as _
@ -139,7 +140,8 @@ class PackageWriter:
pass pass
def fs_ok_clicked(obj): def fs_ok_clicked(obj):
name = fs_top.get_filename() name = unicode(fs_top.get_filename(),
sys.getfilesystemencoding())
if os.path.isfile(name): if os.path.isfile(name):
archive.add(name) archive.add(name)