Updates to allow for user names with non latin characters in Windows.

svn: r15939
This commit is contained in:
Peter Landgren
2010-09-30 10:02:41 +00:00
parent 8b7e7aed4e
commit c0f2ed96b2
26 changed files with 133 additions and 57 deletions

View File

@@ -30,6 +30,7 @@
#
#------------------------------------------------------------------------
from gen.ggettext import gettext as _
import sys
#------------------------------------------------------------------------
#
@@ -85,7 +86,8 @@ class PdfDoc(libcairodoc.CairoDoc):
top_margin = self.paper.get_top_margin() * DPI / 2.54
# create cairo context and pango layout
surface = cairo.PDFSurface(self._backend.filename, paper_width, paper_height)
filename = self._backend.filename.encode(sys.getfilesystemencoding())
surface = cairo.PDFSurface(filename, paper_width, paper_height)
surface.set_fallback_resolution(300, 300)
cr = pangocairo.CairoContext(cairo.Context(surface))

View File

@@ -177,8 +177,7 @@ class PackageWriter(object):
pass
def fs_ok_clicked(obj):
name = unicode(fs_top.get_filename(),
sys.getfilesystemencoding())
name = Utils.get_unicode_path_from_file_chooser(fs_top.get_filename())
if os.path.isfile(name):
archive.add(name)

View File

@@ -525,7 +525,7 @@ class CheckIntegrity(object):
self.bad_photo.append(ObjectId)
def fs_ok_clicked(obj):
name = Utils.get_unicode_path(fs_top.get_filename())
name = Utils.get_unicode_path_from_file_chooser(fs_top.get_filename())
if os.path.isfile(name):
obj = self.db.get_object_from_handle(ObjectId)
obj.set_path(name)

View File

@@ -395,7 +395,7 @@ class DisplayChart(ManagedWindow.ManagedWindow):
f.hide()
if status == gtk.RESPONSE_OK:
name = Utils.get_unicode_path(f.get_filename())
name = Utils.get_unicode_path_from_file_chooser(f.get_filename())
doc = ODSTab(len(self.row_data))
doc.creator(self.db.get_researcher().get_name())

View File

@@ -106,7 +106,7 @@ from htmlrenderer import HtmlView
#
#-------------------------------------------------------------------------
#covert to unicode for better hadnling of path in Windows
GEOVIEW_SUBPATH = Utils.get_unicode_path(Utils.get_empty_tempdir('geoview'))
GEOVIEW_SUBPATH = Utils.get_empty_tempdir('geoview')
NB_MARKERS_PER_PAGE = 200
#-------------------------------------------------------------------------

View File

@@ -31,6 +31,7 @@ from gen.ggettext import sgettext as _
from gen.ggettext import ngettext
from cgi import escape
import math
import sys
#-------------------------------------------------------------------------
#
@@ -169,8 +170,11 @@ class PersonBoxWidget_cairo( gtk.DrawingArea, _PersonWidget_base):
self.bgcolor = (211/256.0, 215/256.0, 207/256.0)
self.bordercolor = (0,0,0)
self.image = image
image1 = image
if isinstance(image1, unicode):
image1 = image.encode(sys.getfilesystemencoding())
try:
self.img_surf = cairo.ImageSurface.create_from_png(image)
self.img_surf = cairo.ImageSurface.create_from_png(image1)
except:
self.image = False
self.connect("enter-notify-event", self.on_enter_cb) # enable mouse-over