From 4fb394530e99819c6463e5d2080b114d5d252332 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Tue, 27 Nov 2007 19:51:45 +0000 Subject: [PATCH] 2007-11-27 Benny Malengier * src/glade/gramps.glade: remove internal from addmedia * src/AddMedia.py: remove internal * src/Editors/_EditMedia.py: remove internal note code Note: no upgrade code for this. Old internal notes will be connected to a media object with type 'Note' and have as type 'Media Note', up to the case a user deletes these media and changes note type to eg report or changes the path to a real media object. svn: r9418 --- ChangeLog | 9 +++++ src/AddMedia.py | 70 ++++++++++++++++----------------------- src/Editors/_EditMedia.py | 63 ++++++++++++----------------------- src/glade/gramps.glade | 46 +++++++------------------ 4 files changed, 70 insertions(+), 118 deletions(-) diff --git a/ChangeLog b/ChangeLog index d22a192cc..107fcf64b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-11-27 Benny Malengier + * src/glade/gramps.glade: remove internal from addmedia + * src/AddMedia.py: remove internal + * src/Editors/_EditMedia.py: remove internal note code + Note: no upgrade code for this. Old internal notes will be connected to + a media object with type 'Note' and have as type 'Media Note', + up to the case a user deletes these media and changes note type to eg + report or changes the path to a real media object. + 2007-11-27 Jerome Rapinat * src/TipOfDay.py: remove uneeded sax escape, issue #1368 diff --git a/src/AddMedia.py b/src/AddMedia.py index c0a2aeec6..1734e40bc 100644 --- a/src/AddMedia.py +++ b/src/AddMedia.py @@ -101,9 +101,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow): self.file_text = self.glade.get_widget("fname") if _last_directory and os.path.isdir(_last_directory): self.file_text.set_current_folder(_last_directory) - - self.internal = self.glade.get_widget('internal') - self.internal.connect('toggled', self.internal_toggled) + self.relpath = self.glade.get_widget('relpath') self.relpath.set_active(_relative_path) self.temp_name = "" @@ -118,12 +116,6 @@ class AddMediaObject(ManagedWindow.ManagedWindow): Build the menu name for the window manager """ return(_('Select media object'), None) - - def internal_toggled(self, obj): - """ - Toggles the file_text icon. - """ - self.file_text.set_sensitive(not obj.get_active()) def on_help_imagesel_clicked(self, obj): """Display the relevant portion of GRAMPS manual""" @@ -140,44 +132,38 @@ class AddMediaObject(ManagedWindow.ManagedWindow): description = unicode(self.description.get_text()) - if self.internal.get_active(): - mobj = gen.lib.MediaObject() - mobj.set_description(description) - mobj.set_handle(Utils.create_id()) - mobj.set_mime_type(None) - else: - if self.file_text.get_filename() is None: - msgstr = _("Import failed") - msgstr2 = _("The filename supplied could not be found.") - ErrorDialog(msgstr, msgstr2) - return + if self.file_text.get_filename() is None: + msgstr = _("Import failed") + msgstr2 = _("The filename supplied could not be found.") + ErrorDialog(msgstr, msgstr2) + return - filename = Utils.get_unicode_path(self.file_text.get_filename()) - full_file = filename + filename = Utils.get_unicode_path(self.file_text.get_filename()) + full_file = filename - if self.relpath.get_active(): - pname = self.dbase.get_save_path() - if not os.path.isdir(pname): - pname = os.path.dirname(pname) - filename = Utils.relative_path(filename, pname) + if self.relpath.get_active(): + pname = self.dbase.get_save_path() + if not os.path.isdir(pname): + pname = os.path.dirname(pname) + filename = Utils.relative_path(filename, pname) - if os.path.exists(filename) == 0: - msgstr = _("Cannot import %s") - msgstr2 = _("The filename supplied could not be found.") - ErrorDialog(msgstr % filename, msgstr2) - return + if os.path.exists(filename) == 0: + msgstr = _("Cannot import %s") + msgstr2 = _("The filename supplied could not be found.") + ErrorDialog(msgstr % filename, msgstr2) + return - mtype = Mime.get_type(full_file) - if description == "": - description = os.path.basename(filename) + mtype = Mime.get_type(full_file) + if description == "": + description = os.path.basename(filename) - mobj = gen.lib.MediaObject() - mobj.set_description(description) - mobj.set_mime_type(mtype) - name = filename - mobj.set_path(name) - _last_directory = os.path.dirname(full_file) - _relative_path = self.relpath.get_active() + mobj = gen.lib.MediaObject() + mobj.set_description(description) + mobj.set_mime_type(mtype) + name = filename + mobj.set_path(name) + _last_directory = os.path.dirname(full_file) + _relative_path = self.relpath.get_active() mobj.set_handle(Utils.create_id()) if not mobj.get_gramps_id(): diff --git a/src/Editors/_EditMedia.py b/src/Editors/_EditMedia.py index 18883cfc2..7aa14b0ba 100644 --- a/src/Editors/_EditMedia.py +++ b/src/Editors/_EditMedia.py @@ -124,12 +124,13 @@ class EditMedia(EditPrimary): pixmap = self.glade.get_widget("pixmap") ebox = self.glade.get_widget('eventbox') + ebox.connect('button-press-event', self.button_press_event) mtype = self.obj.get_mime_type() if mtype: - pb = ThumbNails.get_thumbnail_image(Utils.find_file(self.obj.get_path()),mtype) + pb = ThumbNails.get_thumbnail_image( + Utils.find_file(self.obj.get_path()),mtype) pixmap.set_from_pixbuf(pb) - ebox.connect('button-press-event', self.button_press_event) descr = Mime.get_description(mtype) if descr: self.glade.get_widget("type").set_text(descr) @@ -143,36 +144,20 @@ class EditMedia(EditPrimary): def _create_tabbed_pages(self): notebook = gtk.Notebook() - if self.obj.get_mime_type(): - self.src_list = self._add_tab( - notebook, - SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj)) - - self.attr_list = self._add_tab( - notebook, - AttrEmbedList(self.dbstate, self.uistate, self.track, - self.obj.get_attribute_list())) - - self.note_tab = self._add_tab( - notebook, - NoteTab(self.dbstate, self.uistate, self.track, - self.obj.get_note_list(), - notetype=gen.lib.NoteType.MEDIA)) - else: - self.note_tab = self._add_tab( - notebook, - NoteTab(self.dbstate, self.uistate, self.track, - self.obj.get_note_list(), - notetype=gen.lib.NoteType.MEDIA)) - - self.src_list = self._add_tab( - notebook, - SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj)) - - self.attr_list = self._add_tab( - notebook, - AttrEmbedList(self.dbstate, self.uistate, self.track, - self.obj.get_attribute_list())) + self.src_list = self._add_tab( + notebook, + SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj)) + + self.attr_list = self._add_tab( + notebook, + AttrEmbedList(self.dbstate, self.uistate, self.track, + self.obj.get_attribute_list())) + + self.note_tab = self._add_tab( + notebook, + NoteTab(self.dbstate, self.uistate, self.track, + self.obj.get_note_list(), + notetype=gen.lib.NoteType.MEDIA)) self.backref_list = self._add_tab( notebook, @@ -222,14 +207,9 @@ class EditMedia(EditPrimary): self.select = self.glade.get_widget('file_select') self.file_path = self.glade.get_widget("path") - if self.obj.get_mime_type(): - fname = Utils.get_unicode_path(self.obj.get_path()) - self.file_path.set_text(fname) - self.select.connect('clicked', self.select_file) - else: - self.glade.get_widget('path_label').hide() - self.file_path.hide() - self.select.hide() + fname = self.obj.get_path() + self.file_path.set_text(fname) + self.select.connect('clicked', self.select_file) def save(self, *obj): path = self.glade.get_widget('path').get_text() @@ -238,8 +218,7 @@ class EditMedia(EditPrimary): mime = Mime.get_type(Utils.find_file(os.path.abspath(path))) self.obj.set_mime_type(mime) - if self.obj.get_mime_type(): - self.obj.set_path(Utils.get_unicode_path(path)) + self.obj.set_path(Utils.get_unicode_path(path)) trans = self.db.transaction_begin() self.db.commit_media_object(self.obj,trans) diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index 4a3c860aa..75e03f9c2 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -314,7 +314,7 @@ 0.5 0 0 - gid + gid PANGO_ELLIPSIZE_NONE -1 False @@ -1282,7 +1282,7 @@ 0.5 0 0 - marriage_type + marriage_type PANGO_ELLIPSIZE_NONE -1 False @@ -1604,7 +1604,7 @@ 0.5 0 0 - lon_entry + lon_entry PANGO_ELLIPSIZE_NONE -1 False @@ -4396,7 +4396,7 @@ 6 True - 3 + 2 2 False 6 @@ -4452,28 +4452,6 @@ - - - True - True - Internal note - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 2 - 2 - 3 - fill - - - - True @@ -7375,7 +7353,7 @@ 0.5 0 0 - attr_menu + attr_menu PANGO_ELLIPSIZE_NONE -1 False @@ -14126,7 +14104,7 @@ Very High 0.5 0 0 - frel + frel PANGO_ELLIPSIZE_NONE -1 False @@ -14155,7 +14133,7 @@ Very High 0.5 0 0 - mrel + mrel PANGO_ELLIPSIZE_NONE -1 False @@ -14685,7 +14663,7 @@ Very High 0.5 0 0 - example_label + example_label PANGO_ELLIPSIZE_NONE -1 False @@ -15423,7 +15401,7 @@ Very High 0.5 0 0 - spell + spell PANGO_ELLIPSIZE_NONE -1 False @@ -15494,7 +15472,7 @@ Very High 0.5 0 0 - type + type PANGO_ELLIPSIZE_NONE -1 False @@ -15539,7 +15517,7 @@ Very High 0.5 0 0 - id + id PANGO_ELLIPSIZE_NONE -1 False @@ -15589,7 +15567,7 @@ Very High 0.5 0 0 - marker + marker PANGO_ELLIPSIZE_NONE -1 False