From c06806427942d07f20120fd29144c9c951bc05a5 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 6 May 2004 04:26:47 +0000 Subject: [PATCH] * src/ImageSelect.py: handle new file chooser svn: r3133 --- ChangeLog | 2 +- src/ImageSelect.py | 31 ++----- src/PeopleModel.py | 1 - src/gramps.glade | 173 +++++++++----------------------------- src/plugins/ReadGedcom.py | 1 + 5 files changed, 48 insertions(+), 160 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8603d7e9d..cb815848b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ 2004-05-05 Don Allingham * src/plugins/ReadGedcom.py: commit after media object change * src/gramps.glade: file chooser for image selector - * src/ImageSelect.py: handle new file chooser + * src/ImageSelect.py: handle new file chooser 2004-05-05 Alex Roitman * src/plugins/RelGraph.py: Convert to db. Change coding style. diff --git a/src/ImageSelect.py b/src/ImageSelect.py index e3ff80346..35af57a6a 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -103,22 +103,18 @@ class ImageSelect: self.fname = self.glade.get_widget("fname") self.image = self.glade.get_widget("image") self.description = self.glade.get_widget("photoDescription") - self.external = self.glade.get_widget("private") - self.photosel = self.glade.get_widget("photosel") self.temp_name = "" Utils.set_titles(self.window,self.glade.get_widget('title'), _('Select a media object')) self.glade.signal_autoconnect({ - "on_name_changed" : self.on_name_changed, + "on_fname_update_preview" : self.on_name_changed, "on_help_imagesel_clicked" : self.on_help_imagesel_clicked, }) if os.path.isdir(_last_path): - self.photosel.set_default_path(_last_path) - self.photosel.set_filename(_last_path) - self.photosel.gtk_entry().set_position(len(_last_path)) + self.fname.set_current_folder(_last_path) if self.parent_window: self.window.set_transient_for(self.parent_window) @@ -135,7 +131,7 @@ class ImageSelect: def on_name_changed(self, obj): """The filename has changed. Verify it and load the picture.""" - filename = unicode(self.fname.get_text()) + filename = unicode(self.fname.get_filename()) basename = os.path.basename(filename) (root,ext) = os.path.splitext(basename) @@ -158,7 +154,7 @@ class ImageSelect: """Save the photo in the dataobj object. (Required function)""" global _last_path - filename = self.photosel.get_full_path(0) + filename = self.fname.get_filename() _last_path = os.path.dirname(filename) description = unicode(self.description.get_text()) @@ -189,22 +185,8 @@ class ImageSelect: mobj.set_description(description) mobj.set_mime_type(type) self.savephoto(mobj) - - if type[0:5] == "image": - if self.external.get_active() == 0: - name = RelImage.import_media_object(filename,self.path, - mobj.get_id()) - mobj.setLocal(1) - else: - name = filename - else: - if self.external.get_active() == 1: - name = filename - else: - name = RelImage.import_media_object(filename,self.path, - mobj.get_id()) - mobj.setLocal(1) - mobj.set_path(name) + mobj.set_path(filename) + self.db.commit_media_object(mobj) self.parent.lists_changed = 1 self.load_images() @@ -615,7 +597,6 @@ class Gallery(ImageSelect): menu.set_title(_("Media Object")) object = self.db.find_object_from_id(photo.get_reference_id()) mtype = object.get_mime_type() - print mtype progname = GrampsMime.get_application(mtype) Utils.add_menuitem(menu,_("Open in %s") % progname[1], diff --git a/src/PeopleModel.py b/src/PeopleModel.py index 98cc2f494..092a56194 100644 --- a/src/PeopleModel.py +++ b/src/PeopleModel.py @@ -256,7 +256,6 @@ class PeopleModel(gtk.GenericTreeModel): self.top_visible[col[0]] = val self.visible[iter] = val except: - print iter,val self.visible[iter] = val def on_iter_next(self, node): diff --git a/src/gramps.glade b/src/gramps.glade index 8c398c8b7..9eefacfcd 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -23716,7 +23716,8 @@ GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False - 500 + 650 + 450 True False gramps.png @@ -23798,8 +23799,8 @@ True False - True - GTK_JUSTIFY_CENTER + False + GTK_JUSTIFY_LEFT False False 0.5 @@ -23808,36 +23809,36 @@ 0 - 0 + 6 False False - + + 12 True + 1 + 2 False - 0 + 6 + 12 - + True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 + GTK_FILE_CHOOSER_ACTION_OPEN + True + False + False + - 0 - True - True + 0 + 1 + 0 + 1 @@ -23880,78 +23881,28 @@ - 0 - False - False - - - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - True - True + 1 + 2 + 0 + 1 + + 0 - False - False + True + True - - 12 + + 6 True - 2 - 2 False - 6 - 12 - - - - True - _File: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - fname - - - - - - 0 - 1 - 0 - 1 - 10 - fill - - - + 0 @@ -23967,18 +23918,11 @@ 0 0 photoDescription - - - - 0 - 1 - 1 - 2 - 5 - - + 6 + False + False @@ -23995,53 +23939,16 @@ False - 1 - 2 - 1 - 2 - - - - - - - True - photoselect - 10 - Select an image - False - True - False - - - - True - True - True - True - True - 0 - - True - * - False - - - - - - 1 - 2 - 0 - 1 - + 6 + True + True - 0 + 6 False - False + True diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index b35a3fc89..dd48c8813 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -977,6 +977,7 @@ class GedcomParser: oref = RelLib.MediaRef() oref.set_reference_id(photo.get_id()) self.person.add_media_reference(oref) + self.db.commit_person(self.person) def parse_family_object(self,level): form = ""