2007-11-27 Benny Malengier <benny.malengier@gramps-project.org>

* 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
This commit is contained in:
Benny Malengier 2007-11-27 19:51:45 +00:00
parent cbffb044c5
commit 4fb394530e
4 changed files with 70 additions and 118 deletions

View File

@ -1,3 +1,12 @@
2007-11-27 Benny Malengier <benny.malengier@gramps-project.org>
* 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 <romjerome@yahoo.fr>
* src/TipOfDay.py: remove uneeded sax escape, issue #1368

View File

@ -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():

View File

@ -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)

View File

@ -314,7 +314,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">gid</property>
<property name="mnemonic_widget">gid</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -1282,7 +1282,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">marriage_type</property>
<property name="mnemonic_widget">marriage_type</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -1604,7 +1604,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">lon_entry</property>
<property name="mnemonic_widget">lon_entry</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -4396,7 +4396,7 @@
<widget class="GtkTable" id="table51">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -4452,28 +4452,6 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="internal">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Internal note</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="relpath">
<property name="visible">True</property>
@ -7375,7 +7353,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">attr_menu</property>
<property name="mnemonic_widget">attr_menu</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -14126,7 +14104,7 @@ Very High</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">frel</property>
<property name="mnemonic_widget">frel</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -14155,7 +14133,7 @@ Very High</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">mrel</property>
<property name="mnemonic_widget">mrel</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -14685,7 +14663,7 @@ Very High</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">example_label</property>
<property name="mnemonic_widget">example_label</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -15423,7 +15401,7 @@ Very High</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">spell</property>
<property name="mnemonic_widget">spell</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -15494,7 +15472,7 @@ Very High</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">type</property>
<property name="mnemonic_widget">type</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -15539,7 +15517,7 @@ Very High</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">id</property>
<property name="mnemonic_widget">id</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -15589,7 +15567,7 @@ Very High</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">marker</property>
<property name="mnemonic_widget">marker</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>