From 4d69982b873e4697fbe42b9638f0fa538a69c7a0 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 5 Feb 2003 13:53:00 +0000 Subject: [PATCH] Image fixes svn: r1286 --- example/gramps/data.gramps | Bin 3779 -> 3552 bytes src/GrampsCfg.py | 5 +- src/ImageSelect.py | 12 ++- src/MediaView.py | 3 +- src/ansel_utf8.py | 16 ++- src/const.py | 4 +- src/const.py.in | 2 +- src/docgen/PSDrawDoc.py | 35 ++++++- src/edit_person.glade | 190 ++++++++++++++++++++++++----------- src/plugins/DescendReport.py | 2 +- src/plugins/ReadNative.py | 5 +- 11 files changed, 200 insertions(+), 74 deletions(-) diff --git a/example/gramps/data.gramps b/example/gramps/data.gramps index 8a29c2c7140a45af5cf1c54b8029c3f858aeb998..d70cc9cda82fb416380a8d197d89c7104ef3ffb8 100644 GIT binary patch literal 3552 zcmV<64IlC!iwFqZGr~Lq|1W57ZDlWHZ*E~PP;zf-Wn*-6FK2RLZE$lhWq4t2aBO8S zXL4a}aC0wYVRT_GXL4a}aB~3FTw8P7xD|fSuR!(CX=f~nSCO3B-r9;2$BAQ)wcDLc zrw_0QSx87g15)FRoGVLEv!AhViv)Uj&~S!RnoyF#g#8}M_)<*ejck=*b?JD$VL6~68Np&YU(cX;#BfSZ&-p!? zq%@x&57&<>O>i8GQ`@r8WPq+QWoVKQR73Tm(r`-i)#+p*0J9k-Nvs;Fhm}TI4hug0 zN}kX+E`F#c#iJ@AzGS&ro&GjCD`=GWl_m=gy^>SgaXnwPDIZju%sC^cuIu)F-|t6( z;}ilalX!0n8REI&PC3?C1R>+QP)!|f$zS6Ur^r3jWb()VIREZEJCH^tkZ*@6e`bcT?rlbWW3)mv26VCU{wG0h2O` zZi$k~1K?$OefVn!TD;tD_c5nQ4&u3g=x$SZCOTk=*>Q{noDsrGB?H`Fu}lUi@`M(-?^X!eIeu^D$@mh37gQfAN3|)T5Ns13+%esybL9-7r|^?;h#p-yY>KfNacfsH^9V;n@G@~8BBJv7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#9z4B7{dXXSrSIEz7Bk^e@m%=QNOpaCC@7Rl@-@bdKr>}g4a zLKR;paV*Pz5w73B^+(?p_X^xJhb=e$wjlSraR>;P>yplvPC$IX{%WB~mVK&t_0X#s3~ t528KG!*Od@9NsbZU2MK)k2JrVFwtoSwK^V-*Z)1l{{ZT?c4=#3005BlN?HH_ diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 3c7214249..b9fa2940e 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -211,7 +211,8 @@ def loadConfig(call): global mediaref global globalprop global localprop - + global capitalize + _callback = call lastfile = get_string("/apps/gramps/last-file") uselds = get_bool("/apps/gramps/use-lds") @@ -459,7 +460,7 @@ class ConfigCheckbox(ConfigWidget): class ConfigFile(ConfigWidget): def get_widgets(self): - self.w = gnome.ui.GnomeFileEntry(self.tag) + self.w = gnome.ui.FileEntry(self.tag) lbl = gtk.Label(self.l) self.w.show() lbl.show() diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 3bd39db47..5cb49b3e6 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -328,12 +328,22 @@ class Gallery(ImageSelect): if x != self.cx or y != self.cy: grp.move(self.cx-x,self.cy-y) else: + import gobject + name = Utils.thumb_path(self.db.getSavePath(),object) description = object.getDescription() if len(description) > 20: description = "%s..." % description[0:20] - image = gtk.gdk.pixbuf_new_from_file(name) + try: + image = gtk.gdk.pixbuf_new_from_file(name) + except gobject.GError,msg: + ErrorDialog(str(msg)) + image = gtk.gdk.pixbuf_new_from_file(const.icon) + except: + ErrorDialog(_("Thumbnail %s could not be found") % name) + image = gtk.gdk.pixbuf_new_from_file(const.icon) + x = image.get_width() y = image.get_height() diff --git a/src/MediaView.py b/src/MediaView.py index 36428e7f5..50e42f420 100644 --- a/src/MediaView.py +++ b/src/MediaView.py @@ -136,7 +136,8 @@ class MediaView: if pexists and os.path.exists(thumb_path): self.preview.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(thumb_path)) else: - self.preview.set_from_pixbuf(Utils.find_icon(type)) + icon_image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(type)) + self.preview.set_from_pixbuf(icon_image) if not pexists: fexists = 0 diff --git a/src/ansel_utf8.py b/src/ansel_utf8.py index 051b20476..9b6b9b717 100644 --- a/src/ansel_utf8.py +++ b/src/ansel_utf8.py @@ -278,6 +278,7 @@ _utoa = { def ansel_to_utf8(s): """Converts an ANSEL encoded string to UTF8""" + print s buff = cStringIO.StringIO() while s: c0 = ord(s[0]) @@ -285,18 +286,25 @@ def ansel_to_utf8(s): head = u' ' s = s[1:] elif c0 > 127: - if _twobyte.has_key(s[0:2]): - head = _twobyte[s[0:2]] + l2 = s[0:2] + l1 = s[0] + print "----------------------" + if _twobyte.has_key(l2): + head = _twobyte[l2] s = s[2:] - elif _onebyte.has_key(s[0]): - head = _onebyte[s[0]] + 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/const.py b/src/const.py index 53f3bf159..67099d4a8 100644 --- a/src/const.py +++ b/src/const.py @@ -100,7 +100,7 @@ startup = 1 #------------------------------------------------------------------------- progName = "GRAMPS" version = "0.9.0-rc5" -copyright = "© 2001-2003 Donald N. Allingham" +copyright = unicode("© 2001-2003 Donald N. Allingham","iso-8859-1") authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"] comments = _("GRAMPS (Genealogical Research and Analysis " "Management Programming System) is a personal " @@ -130,8 +130,8 @@ childRelations = { _("Birth") : "Birth", _("Adopted") : "Adopted", _("Stepchild") : "Stepchild", - _("Foster") : "Foster", _("Sponsored") : "Sponsored", + _("Foster") : "Foster", _("None") : "None", _("Unknown") : "Unknown", _("Other") : "Other", diff --git a/src/const.py.in b/src/const.py.in index 4fba743dc..83be277d6 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -100,7 +100,7 @@ startup = 1 #------------------------------------------------------------------------- progName = "GRAMPS" version = "@VERSIONSTRING@" -copyright = "© 2001-2003 Donald N. Allingham" +copyright = unicode("© 2001-2003 Donald N. Allingham","iso-8859-1") authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"] comments = _("GRAMPS (Genealogical Research and Analysis " "Management Programming System) is a personal " diff --git a/src/docgen/PSDrawDoc.py b/src/docgen/PSDrawDoc.py index c84c9b091..4c37427fc 100644 --- a/src/docgen/PSDrawDoc.py +++ b/src/docgen/PSDrawDoc.py @@ -26,6 +26,8 @@ from intl import gettext as _ import TextDoc import DrawDoc +def pt2cm(val): + return (float(val)/72.0)*2.54 class PSDrawDoc(DrawDoc.DrawDoc): @@ -111,18 +113,45 @@ class PSDrawDoc(DrawDoc.DrawDoc): self.f.write('%%PageTrailer\n') def draw_text(self,style,text,x1,y1): - x1 = x1 + self.lmargin - y1 = y1 + self.tmargin - stype = self.draw_styles[style] para_name = stype.get_paragraph_style() p = self.style_list[para_name] + + x1 = x1 + self.lmargin + y1 = y1 + self.tmargin + pt2cm(p.get_font().get_size()) + self.f.write('gsave\n') self.f.write('%f cm %f cm moveto\n' % self.translate(x1,y1)) self.f.write(self.fontdef(p)) self.f.write('(%s) show\n' % text) self.f.write('grestore\n') + def draw_path(self,style,path,fill): + stype = self.draw_styles[style] + self.f.write('gsave\n') + self.f.write('newpath\n') + self.f.write('%d setlinewidth\n' % stype.get_line_width()) + if stype.get_line_style() == DrawDoc.SOLID: + self.f.write('[] 0 setdash\n') + else: + self.f.write('[2 4] 0 setdash\n') + + point = path[0] + x1 = point[0]+self.lmargin + y1 = point[1]+self.tmargin + self.f.write('%f cm %f cm moveto\n' % self.translate(x1,y1)) + + for point in path[1:]: + x1 = point[0]+self.lmargin + y1 = point[1]+self.tmargin + self.f.write('%f cm %f cm lineto\n' % self.translate(x1,y1)) + self.f.write('closepath\n') + if fill: + self.f.write('fill\n') + else: + self.f.write('stroke\n') + self.f.write('grestore\n') + def draw_line(self,style,x1,y1,x2,y2): x1 = x1 + self.lmargin x2 = x2 + self.lmargin diff --git a/src/edit_person.glade b/src/edit_person.glade index d56921e86..e270c291f 100644 --- a/src/edit_person.glade +++ b/src/edit_person.glade @@ -1461,7 +1461,7 @@ True - 6 + 7 6 False 0 @@ -1532,8 +1532,8 @@ 0 1 - 2 - 3 + 3 + 4 fill @@ -1604,8 +1604,8 @@ 1 2 - 2 - 3 + 3 + 4 fill @@ -1628,8 +1628,8 @@ 1 2 - 5 - 6 + 6 + 7 fill @@ -1652,8 +1652,8 @@ 1 2 - 3 - 4 + 4 + 5 fill @@ -1676,8 +1676,8 @@ 0 1 - 3 - 4 + 4 + 5 fill @@ -1700,8 +1700,8 @@ 0 1 - 4 - 5 + 5 + 6 fill @@ -1724,8 +1724,8 @@ 1 2 - 4 - 5 + 5 + 6 fill @@ -1748,8 +1748,8 @@ 0 1 - 5 - 6 + 6 + 7 fill @@ -1761,7 +1761,7 @@ False False - GTK_JUSTIFY_CENTER + GTK_JUSTIFY_LEFT False False 0 @@ -1786,7 +1786,7 @@ False False - GTK_JUSTIFY_CENTER + GTK_JUSTIFY_LEFT False False 0 @@ -1812,33 +1812,7 @@ False False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 2 - 6 - 2 - 3 - 3 - 3 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_CENTER + GTK_JUSTIFY_LEFT False False 0 @@ -1859,12 +1833,12 @@ - + True False False - GTK_JUSTIFY_CENTER + GTK_JUSTIFY_LEFT False False 0 @@ -1884,6 +1858,32 @@ + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 2 + 6 + 5 + 6 + 3 + 3 + fill + + + + True @@ -1901,8 +1901,8 @@ 3 4 - 5 - 6 + 6 + 7 fill @@ -1925,8 +1925,8 @@ 4 5 - 5 - 6 + 6 + 7 @@ -1938,7 +1938,7 @@ False False - GTK_JUSTIFY_CENTER + GTK_JUSTIFY_LEFT False False 0 @@ -1949,8 +1949,8 @@ 2 3 - 5 - 6 + 6 + 7 3 3 @@ -1963,7 +1963,7 @@ False False - GTK_JUSTIFY_CENTER + GTK_JUSTIFY_LEFT False False 0 @@ -1974,8 +1974,82 @@ 5 6 - 5 - 6 + 6 + 7 + + + + + + + True + Surname Prefix + False + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 5 + 3 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + : + False + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 3 + + + 1 + 2 + 2 + 3 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 2 + 6 + 2 + 3 + 3 + 3 + fill diff --git a/src/plugins/DescendReport.py b/src/plugins/DescendReport.py index 86f9cbe35..eb6ce81ea 100644 --- a/src/plugins/DescendReport.py +++ b/src/plugins/DescendReport.py @@ -176,7 +176,7 @@ class DescendantReportDialog(Report.TextReportDialog): # #------------------------------------------------------------------------ def report(database,person): - DescendantReportDialog(person,database) + DescendantReportDialog(database,person) #------------------------------------------------------------------------ # diff --git a/src/plugins/ReadNative.py b/src/plugins/ReadNative.py index b09917d03..88db60f12 100644 --- a/src/plugins/ReadNative.py +++ b/src/plugins/ReadNative.py @@ -47,9 +47,12 @@ class ReadNative: self.top = gtk.FileSelection("%s - GRAMPS" % _("Import from GRAMPS")) self.top.hide_fileop_buttons() self.top.ok_button.connect('clicked', self.on_ok_clicked) - self.top.cancel_button.connect_object('clicked', Utils.destroy_passed_object,self.top) + self.top.cancel_button.connect('clicked', self.close_window) self.top.show() + def close_window(self,obj): + self.top.destroy() + def show_display(self): self.window = gtk.Window() self.window.set_title(_("Import from GRAMPS"))