diff --git a/gramps/src/EditPerson.glade b/gramps/src/EditPerson.glade
index b55c42296..e936a5e5a 100644
--- a/gramps/src/EditPerson.glade
+++ b/gramps/src/EditPerson.glade
@@ -22,7 +22,7 @@
Fri, 03 Aug 2001 01:42:42 GMT
Gramps - Edit Person
- GTK_WINDOW_TOPLEVEL
+ GTK_WINDOW_DIALOG
GTK_WIN_POS_NONE
False
False
@@ -3567,10 +3567,10 @@
GtkHButtonBox
hbuttonbox13
GTK_BUTTONBOX_SPREAD
- 30
+ 15
85
27
- 7
+ 3
0
0
@@ -3589,7 +3589,7 @@
Sat, 09 Dec 2000 22:09:54 GMT
-
+
GTK_RELIEF_NORMAL
@@ -3604,7 +3604,7 @@
Sun, 10 Dec 2000 03:48:08 GMT
-
+
GTK_RELIEF_NORMAL
@@ -3619,7 +3619,22 @@
Sun, 10 Dec 2000 15:10:41 GMT
-
+
+ GTK_RELIEF_NORMAL
+
+
+
+ GtkButton
+ button127
+ True
+ True
+
+ clicked
+ on_edit_properties_clicked
+
+ Thu, 11 Oct 2001 22:22:08 GMT
+
+
GTK_RELIEF_NORMAL
diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py
index 207001de8..591b530e0 100644
--- a/gramps/src/EditPerson.py
+++ b/gramps/src/EditPerson.py
@@ -197,6 +197,7 @@ class EditPerson:
"on_delete_event" : on_delete_event,
"on_delete_url_clicked" : on_delete_url_clicked,
"on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked,
+ "on_edit_properties_clicked": self.gallery.popup_change_description,
"on_editperson_switch_page" : on_switch_page,
"on_event_add_clicked" : on_event_add_clicked,
"on_event_delete_clicked" : on_event_delete_clicked,
@@ -263,7 +264,8 @@ class EditPerson:
if len(photo_list) != 0:
ph = photo_list[0]
object = ph.getReference()
- self.load_photo(object.getPath())
+ if object.getMimeType()[0:5] == "image":
+ self.load_photo(object.getPath())
# set notes data
self.notes_field.set_point(0)
@@ -407,11 +409,12 @@ class PersonGallery(ImageSelect.Gallery):
for i in range(0,selected_icon):
photolist[selected_icon-i] = photolist[selected_icon-i-1]
photolist[0] = savePhoto
-
- self.epo.load_photo(savePhoto.getReference().getPath())
+
+ ref = savePhoto.getReference()
+ if ref.getMimeType() == "image":
+ self.epo.load_photo(savePhoto.getReference().getPath())
self.load_images()
utils.modified()
-
#-------------------------------------------------------------------------
#
diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py
index 391242813..18d7ea4f1 100644
--- a/gramps/src/GrampsParser.py
+++ b/gramps/src/GrampsParser.py
@@ -505,7 +505,7 @@ class GrampsParser(handler.ContentHandler):
a.setType(key)
a.setValue(u2l(attrs[key]))
self.photo.addAttribute(a)
- self.photo.setMimeType(gnome.mime.type_or_default(self.photo.getPath(),"unknown"))
+ self.photo.setMimeType(utils.get_mime_type(self.photo.getPath()))
self.db.addObject(self.photo)
if self.family:
self.family.addPhoto(self.pref)
diff --git a/gramps/src/ImageSelect.py b/gramps/src/ImageSelect.py
index f4b21e972..d0737ae8e 100644
--- a/gramps/src/ImageSelect.py
+++ b/gramps/src/ImageSelect.py
@@ -34,7 +34,6 @@ import string
from gtk import *
from gnome.ui import *
import GDK
-import gnome.mime
import libglade
import GdkImlib
@@ -103,8 +102,12 @@ class ImageSelect:
def on_name_changed(self, obj):
filename = self.fname.get_text()
if os.path.isfile(filename):
- image = RelImage.scale_image(filename,const.thumbScale)
- self.image.load_imlib(image)
+ type = utils.get_mime_type(filename)
+ if type[0:5] == "image":
+ image = RelImage.scale_image(filename,const.thumbScale)
+ self.image.load_imlib(image)
+ else:
+ self.image.load_file(utils.find_icon(type))
#-------------------------------------------------------------------------
#
@@ -119,24 +122,31 @@ class ImageSelect:
GnomeErrorDialog(_("That is not a valid file name."));
return
- if self.external.get_active() == 1:
- if os.path.isfile(filename):
- name = filename
- thumb = "%s%s.thumb%s%s" % (self.path,os.sep,os.sep,os.path.basename(filename))
- RelImage.mk_thumb(filename,thumb,const.thumbScale)
- else:
- return
- else:
- name = RelImage.import_photo(filename,self.path,self.prefix)
- if name == None:
- return
-
- photo = Photo()
- photo.setPath(name)
- photo.setDescription(description)
- photo.setMimeType(gnome.mime.type_or_default_of_file(name,"unknown"))
+ type = utils.get_mime_type(filename)
+ mobj = Photo()
+ if description == "":
+ description = os.path.basename(name)
+ mobj.setDescription(description)
+ mobj.setMimeType(type)
+ self.savephoto(mobj)
- self.savephoto(photo)
+ if type[0:5] == "image":
+ if self.external.get_active() == 1:
+ if os.path.isfile(filename):
+ name = filename
+ thumb = "%s/.thumb/%s.jpg" % (self.path,mobj.getId())
+ RelImage.mk_thumb(filename,thumb,const.thumbScale)
+ else:
+ return
+ else:
+ name = RelImage.import_media_object(filename,self.path,mobj.getId())
+ else:
+ if self.external.get_active() == 1:
+ name = filename
+ else:
+ name = RelImage.import_media_object(filename,self.path,mobj.getId())
+
+ mobj.setPath(name)
utils.modified()
utils.destroy_passed_object(obj)
@@ -166,11 +176,11 @@ class Gallery(ImageSelect):
('text/uri-list',0,2),
('application/x-rootwin-drop',0,1)]
- icon_list.drag_dest_set(DEST_DEFAULT_ALL, t, GDK.ACTION_COPY)
+ icon_list.drag_dest_set(DEST_DEFAULT_ALL, t, GDK.ACTION_COPY | GDK.ACTION_MOVE)
icon_list.connect("drag_data_received", self.on_photolist_drag_data_received)
icon_list.drag_source_set(GDK.BUTTON1_MASK|GDK.BUTTON3_MASK,t,\
- GDK.ACTION_COPY)
+ GDK.ACTION_COPY | GDK.ACTION_MOVE)
icon_list.connect("drag_data_get", self.on_photolist_drag_data_get)
@@ -210,11 +220,11 @@ class Gallery(ImageSelect):
object = photo.getReference()
path = object.getPath()
src = os.path.basename(path)
- if object.getLocal():
- thumb = "%s%s.thumb%s%s" % (self.path,os.sep,os.sep,src)
+ if object.getMimeType()[0:5] == "image":
+ thumb = "%s/.thumb/%s.jpg" % (self.path,object.getId())
+ RelImage.check_thumb(path,thumb,const.thumbScale)
else:
- thumb = "%s%s.thumb%s%s.jpg" % (self.path,os.sep,os.sep,os.path.basename(src))
- RelImage.check_thumb(path,thumb,const.thumbScale)
+ thumb = utils.find_icon(object.getMimeType())
self.icon_list.append(thumb,object.getDescription())
#-------------------------------------------------------------------------
@@ -244,22 +254,25 @@ class Gallery(ImageSelect):
d = string.strip(string.replace(data.data,'\0',' '))
if d[0:5] == "file:":
name = d[5:]
- mime = gnome.mime.type_or_default_of_file(name,"unknown")
- if mime[0:5] == "image":
- photo = Photo()
- photo.setPath(name)
- photo.setMimeType(mime)
- self.savephoto(photo)
- else:
- print name,mime
+ mime = utils.get_mime_type(name)
+ photo = Photo()
+ photo.setPath(name)
+ photo.setMimeType(mime)
+ description = os.path.basename(name)
+ photo.setDescription(description)
+ self.savephoto(photo)
else:
if self.db.getObjectMap().has_key(data.data):
- w.drag_finish(context, TRUE, FALSE, time)
+ for p in self.dataobj.getPhotoList():
+ if data.data == p.getReference().getId():
+ w.drag_finish(context, TRUE, FALSE, time)
+ return
oref = ObjectRef()
oref.setReference(self.db.findObjectNoMap(data.data))
self.dataobj.addPhoto(oref)
self.add_thumbnail(oref)
utils.modified()
+ w.drag_finish(context, TRUE, FALSE, time)
else:
w.drag_finish(context, FALSE, FALSE, time)
@@ -292,6 +305,11 @@ class Gallery(ImageSelect):
if icon != -1:
self.icon_list.remove(icon)
del self.dataobj.getPhotoList()[icon]
+ if len(self.dataobj.getPhotoList()) == 0:
+ self.selectedIcon = -1
+ else:
+ self.selectedIcon = 0
+ self.icon_list.select_icon(0)
#-------------------------------------------------------------------------
#
@@ -310,9 +328,9 @@ class Gallery(ImageSelect):
item = GtkTearoffMenuItem()
item.show()
menu.append(item)
- utils.add_menuitem(menu,_("View Object"),None,self.popup_view_photo)
- utils.add_menuitem(menu,_("Edit Object"),None,self.popup_edit_photo)
- utils.add_menuitem(menu,_("Edit Description"),None,
+ utils.add_menuitem(menu,_("View in the default viewer"),None,self.popup_view_photo)
+ utils.add_menuitem(menu,_("Edit in the default editor"),None,self.popup_edit_photo)
+ utils.add_menuitem(menu,_("Edit Object Properties"),None,
self.popup_change_description)
object = photo.getReference()
if object.getLocal() == 0:
@@ -362,17 +380,31 @@ class Gallery(ImageSelect):
def popup_change_description(self, obj):
photo = self.dataobj.getPhotoList()[self.selectedIcon]
object = photo.getReference()
+ path = object.getPath()
+ src = os.path.basename(path)
+
self.change_dialog = libglade.GladeXML(const.imageselFile,"change_description")
-
window = self.change_dialog.get_widget("change_description")
- text = self.change_dialog.get_widget("text")
- text.set_text(object.getDescription())
-
- image2 = RelImage.scale_image(object.getPath(),200.0)
- self.change_dialog.get_widget("photo").load_imlib(image2)
+ self.change_dialog.get_widget("description").set_text(object.getDescription())
+ pixmap = self.change_dialog.get_widget("pixmap")
+ mtype = object.getMimeType()
+ if mtype[0:5] == "image":
+ thumb = "%s/.thumb/%s" % (self.path,object.getId())
+ RelImage.check_thumb(path,thumb,const.thumbScale)
+ pixmap.load_file(thumb)
+ else:
+ pixmap.load_file(utils.find_icon(mtype))
+
+ self.change_dialog.get_widget("gid").set_text(object.getId())
+ self.change_dialog.get_widget("description").set_text(object.getDescription())
+ if object.getLocal():
+ self.change_dialog.get_widget("path").set_text("")
+ else:
+ self.change_dialog.get_widget("path").set_text(path)
+ self.change_dialog.get_widget("type").set_text(utils.get_mime_description(mtype))
+ self.change_dialog.get_widget("notes").insert_defaults(photo.getNote())
window.set_data("p",photo)
- window.set_data("t",text)
- window.editable_enters(text)
+ window.set_data("t",self.change_dialog)
self.change_dialog.signal_autoconnect({
"on_cancel_clicked" : utils.destroy_passed_object,
"on_ok_clicked" : self.new_desc_ok_clicked,
@@ -386,11 +418,11 @@ class Gallery(ImageSelect):
#-------------------------------------------------------------------------
def new_desc_apply_clicked(self, obj):
photo = obj.get_data("p")
- object = photo.getReference()
- text = obj.get_data("t").get_text()
- if text != object.getDescription():
- object.setDescription(text)
- self.load_images()
+ top = obj.get_data('t')
+ text = top.get_widget("notes").get_chars(0,-1)
+ note = photo.getNote()
+ if text != note:
+ photo.setNote(text)
utils.modified()
#-------------------------------------------------------------------------
diff --git a/gramps/src/RelImage.py b/gramps/src/RelImage.py
index e71455fe2..f5aca56ca 100644
--- a/gramps/src/RelImage.py
+++ b/gramps/src/RelImage.py
@@ -26,6 +26,8 @@
import os
import const
import intl
+import string
+import utils
from gnome.ui import *
_ = intl.gettext
@@ -38,49 +40,47 @@ except:
#-------------------------------------------------------------------------
#
-# import_photo
+# import_media_object
#
#-------------------------------------------------------------------------
-def import_photo(filename,path,prefix):
- import gnome.mime
+def import_media_object(filename,path,base):
import shutil
- type = gnome.mime.type_of_file(filename)
- if type[0:6] != "image/":
- GnomeErrorDialog(_("Currently only image files are supported"))
- return None
-
- for index in range(0,1000):
- name = "%s%s%s_%d.jpg" % (path,os.sep,prefix,index)
- base = "%s_%d.jpg" % (prefix,index)
- if os.path.exists(name) == 0:
- break
+ type = utils.get_mime_type(filename)
+ if type[0:5] == "image":
+ name = "%s/%s.jpg" % (path,base)
+ base = "%s.jpg" % (base)
- thumb = "%s%s.thumb" % (path,os.sep)
+ thumb = "%s/.thumb" % (path)
- try:
- if not os.path.exists(thumb):
- os.mkdir(thumb)
- except IOError,msg:
- GnomeErrorDialog(_("Could not create %s") % thumb + "\n" + str(msg))
- except:
- GnomeErrorDialog(_("Could not create %s") % thumb)
+ try:
+ if not os.path.exists(thumb):
+ os.mkdir(thumb)
+ except IOError,msg:
+ GnomeErrorDialog(_("Could not create %s") % thumb + "\n" + str(msg))
+ except:
+ GnomeErrorDialog(_("Could not create %s") % thumb)
- try:
- path = "%s%s%s" % (thumb,os.sep,base)
+ try:
+ path = "%s/%s" % (thumb,base)
- mk_thumb(filename,path,const.thumbScale)
+ mk_thumb(filename,path,const.thumbScale)
- if type == "image/jpeg":
- shutil.copy(filename,name)
- else:
- if no_pil:
- cmd = "%s '%s' '%s'" % (const.convert,filename,name)
- os.system(cmd)
+ if type == "image/jpeg":
+ shutil.copy(filename,name)
else:
- PIL.Image.open(filename).save(name)
- except:
- return None
+ if no_pil:
+ cmd = "%s '%s' '%s'" % (const.convert,filename,name)
+ os.system(cmd)
+ else:
+ PIL.Image.open(filename).save(name)
+ except:
+ return None
+ else:
+ bname = os.path.basename(filename)
+ l = string.split(bname,'.')
+ name = "%s/%s.%s" % (path,base,l[-1])
+ shutil.copy(filename,name)
return name
diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py
index 0870da108..e2a710956 100644
--- a/gramps/src/WriteXML.py
+++ b/gramps/src/WriteXML.py
@@ -293,8 +293,6 @@ def write_photo_list(g,list,indent=3):
g.write(">\n")
write_attribute_list(g,proplist,indent+1)
write_note(g,"note",photo.getNote(),indent+1)
- for s in photo.getSourceRefList():
- dump_source_ref(g,s,indent+1)
g.write('%s\n' % sp)
def write_url_list(g, list):
diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade
index 2f9933ad8..3ef503ae5 100644
--- a/gramps/src/gramps.glade
+++ b/gramps/src/gramps.glade
@@ -2879,6 +2879,11 @@
on_media_list_drag_data_get
Tue, 09 Oct 2001 21:02:46 GMT
+
+ drag_data_received
+ on_media_list_drag_data_received
+ Thu, 11 Oct 2001 22:42:26 GMT
+
5
33,331,104,168,80
GTK_SELECTION_SINGLE
@@ -2972,6 +2977,11 @@
button142
True
True
+
+ clicked
+ on_add_media_clicked
+ Thu, 11 Oct 2001 22:36:50 GMT
+
GTK_RELIEF_NORMAL
diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py
index d795e06bc..f1f8c3a89 100755
--- a/gramps/src/gramps_main.py
+++ b/gramps/src/gramps_main.py
@@ -42,7 +42,6 @@ _ = intl.gettext
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
-
import GDK
import GTK
import libglade
@@ -1681,7 +1680,7 @@ def remove_from_person_list(person):
del id2col[person]
del alt2col[person]
- if row <= person_list.rows:
+ if row > person_list.rows:
(active_person,alt) = person_list.get_row_data(row)
person_list.thaw()
@@ -2118,6 +2117,7 @@ def load_places():
def on_media_list_select_row(obj,row,b,c):
mobj = obj.get_row_data(row)
type = mobj.getMimeType()
+ type_name = utils.get_mime_description(type)
path = mobj.getPath()
if type[0:5] == "image":
dir = os.path.dirname(path)
@@ -2126,9 +2126,10 @@ def on_media_list_select_row(obj,row,b,c):
RelImage.check_thumb(path,thumb,const.thumbScale)
preview.load_file(thumb)
else:
- pass
+ preview.load_file(utils.find_icon(type))
+
mid.set_text(mobj.getId())
- mtype.set_text(type)
+ mtype.set_text(type_name)
mdesc.set_text(mobj.getDescription())
if path[0] == "/":
mpath.set_text(path)
@@ -2156,7 +2157,7 @@ def load_media():
for src in objects:
title = src.getDescription()
id = src.getId()
- type = src.getMimeType()
+ type = utils.get_mime_description(src.getMimeType())
if src.getLocal():
path = ""
else:
@@ -3338,8 +3339,12 @@ def main(arg):
dateArrow = gtop.get_widget("dateSort")
deathArrow = gtop.get_widget("deathSort")
- t = [('STRING', 0, 0)]
+ t = [ ('STRING', 0, 0),
+ ('text/plain',0,0),
+ ('text/uri-list',0,2),
+ ('application/x-rootwin-drop',0,1)]
media_list.drag_source_set(GDK.BUTTON1_MASK|GDK.BUTTON3_MASK,t,GDK.ACTION_COPY)
+ media_list.drag_dest_set(DEST_DEFAULT_ALL,t,GDK.ACTION_COPY|GDK.ACTION_MOVE)
person_list.set_column_visibility(5,0)
person_list.set_column_visibility(6,0)
person_list.set_column_visibility(7,0)
@@ -3406,9 +3411,11 @@ def main(arg):
"on_person_list_select_row" : on_person_list_select_row,
"on_place_list_button_press_event" : on_place_list_button_press_event,
"on_main_key_release_event" : on_main_key_release_event,
+ "on_add_media_clicked" : create_add_dialog,
"on_media_activate" : on_media_activate,
"on_media_list_select_row" : on_media_list_select_row,
"on_media_list_drag_data_get" : on_media_list_drag_data_get,
+ "on_media_list_drag_data_received" : on_media_list_drag_data_received,
"on_places_activate" : on_places_activate,
"on_preferences_activate" : on_preferences_activate,
"on_remove_child_clicked" : on_remove_child_clicked,
@@ -3463,6 +3470,80 @@ def on_canvas1_event(obj,event):
load_canvas()
return 0
+def create_add_dialog(obj):
+ glade = libglade.GladeXML(const.imageselFile,"imageSelect")
+ window = glade.get_widget("imageSelect")
+ fname = glade.get_widget("fname")
+ image = glade.get_widget("image")
+ description = glade.get_widget("photoDescription")
+ external = glade.get_widget("private")
+
+ glade.signal_autoconnect({
+ "on_savephoto_clicked" : on_savephoto_clicked,
+ "on_name_changed" : on_name_changed,
+ "destroy_passed_object" : utils.destroy_passed_object
+ })
+
+ window.editable_enters(description)
+ window.set_data("t",glade)
+ window.show()
+
+def on_savephoto_clicked(obj):
+ glade = obj.get_data("t")
+ filename = glade.get_widget("photosel").get_full_path(0)
+ description = glade.get_widget("photoDescription").get_text()
+ external = glade.get_widget("private")
+
+ if os.path.exists(filename) == 0:
+ GnomeErrorDialog(_("That is not a valid file name."));
+ return
+
+ type = utils.get_mime_type(filename)
+ mobj = Photo()
+ if description == "":
+ description = os.path.basename(filename)
+ mobj.setDescription(description)
+ mobj.setMimeType(type)
+ database.addObject(mobj)
+
+ if external.get_active() == 0:
+ path = database.getSavePath()
+ name = RelImage.import_media_object(filename,path,mobj.getId())
+ mobj.setPath(name)
+
+ utils.modified()
+ load_media()
+ utils.destroy_passed_object(obj)
+
+def on_name_changed(obj):
+ glade = obj.get_data('t')
+ filename = glade.get_widget("fname").get_text()
+ if os.path.isfile(filename):
+ type = utils.get_mime_type(filename)
+ if type[0:5] == "image":
+ image = RelImage.scale_image(filename,const.thumbScale)
+ glade.get_widget("image").load_imlib(image)
+ else:
+ glade.get_widget("image").load_file(utils.find_icon(type))
+
+def on_media_list_drag_data_received(w, context, x, y, data, info, time):
+ if data and data.format == 8:
+ d = string.strip(string.replace(data.data,'\0',' '))
+ if d[0:5] == "file:":
+ name = d[5:]
+ mime = utils.get_mime_type(name)
+ photo = Photo()
+ photo.setPath(name)
+ photo.setMimeType(mime)
+ description = os.path.basename(name)
+ photo.setDescription(description)
+ database.addObject(photo)
+ utils.modified()
+ w.drag_finish(context, TRUE, FALSE, time)
+ load_media()
+ else:
+ w.drag_finish(context, FALSE, FALSE, time)
+
#-------------------------------------------------------------------------
#
# Start it all
diff --git a/gramps/src/imagesel.glade b/gramps/src/imagesel.glade
index f3720d192..c49b4f79f 100644
--- a/gramps/src/imagesel.glade
+++ b/gramps/src/imagesel.glade
@@ -15,7 +15,7 @@
GnomeDialog
imageSelect
- Gramps - Select a picture
+ Gramps - Select a Media Object
GTK_WINDOW_DIALOG
GTK_WIN_POS_NONE
False
@@ -99,7 +99,7 @@
GtkLabel
picTitle
-
+
GTK_JUSTIFY_CENTER
False
0.5
@@ -283,7 +283,7 @@
GtkCheckButton
private
True
-
+
False
True
@@ -352,12 +352,12 @@
GnomeDialog
change_description
- Gramps - Change image description
+ Gramps - Change Local Media Object Properties
GTK_WINDOW_TOPLEVEL
GTK_WIN_POS_NONE
True
False
- False
+ True
False
False
False
@@ -406,20 +406,6 @@
GNOME_STOCK_BUTTON_OK
-
- GtkButton
- button83
- True
- True
-
- clicked
- on_apply_clicked
-
- Thu, 19 Apr 2001 00:00:06 GMT
-
- GNOME_STOCK_BUTTON_APPLY
-
-
GtkButton
button84
@@ -449,7 +435,7 @@
GtkLabel
label119
-
+
GTK_JUSTIFY_CENTER
False
0.5
@@ -468,37 +454,1670 @@
hseparator9
10
- True
+ False
True
- GnomePixmap
- photo
+ GtkHBox
+ hbox2
+ False
+ 0
0
True
True
+
+
+ GnomePixmap
+ pixmap
+ 100
+ 100
+
+ 0
+ False
+ True
+
+
+
+
+ GtkFrame
+ frame4
+ 0
+ GTK_SHADOW_ETCHED_IN
+
+ 0
+ True
+ True
+
+
+
+ GtkTable
+ table2
+ 4
+ 3
+ False
+ 0
+ 0
+
+
+ GtkLabel
+ label126
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 5
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label128
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 1
+ 2
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label129
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 5
+
+ 0
+ 1
+ 2
+ 3
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label130
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 1
+ 2
+ 2
+ 3
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ description
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 3
+ 1
+ 2
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ path
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 3
+ 2
+ 3
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label132
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 5
+
+ 0
+ 1
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label133
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 1
+ 2
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label135
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 5
+
+ 0
+ 1
+ 3
+ 4
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label136
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 1
+ 2
+ 3
+ 4
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ type
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 3
+ 3
+ 4
+ 5
+ 5
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ gid
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 3
+ 0
+ 1
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
- GtkEntry
- text
- 300
+ GtkNotebook
+ notebook1
True
- True
- True
- True
- 0
-
+ True
+ True
+ GTK_POS_TOP
+ False
+ 2
+ 2
+ False
10
+ True
+ True
+
+
+
+ GtkScrolledWindow
+ scrolledwindow1
+ GTK_POLICY_NEVER
+ GTK_POLICY_AUTOMATIC
+ GTK_UPDATE_CONTINUOUS
+ GTK_UPDATE_CONTINUOUS
+
+
+ GtkText
+ notes
+ True
+ True
+
+
+
+
+
+ GtkLabel
+ Notebook:tab
+ label125
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ GtkVBox
+ vbox24
+ False
+ 0
+
+
+ GtkFrame
+ frame2
+ 5
+
+ 0
+ GTK_SHADOW_ETCHED_IN
+
+ 5
+ False
+ False
+
+
+
+ GtkTable
+ table3
+ 2
+ 3
+ False
+ 0
+ 0
+
+
+ GtkLabel
+ label138
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 3
+
+ 0
+ 1
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label139
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 3
+ 0
+ 1
+ 3
+ 3
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label140
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 3
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label141
+
+ GTK_JUSTIFY_LEFT
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 3
+ 1
+ 2
+ 3
+ 3
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label142
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 3
+
+ 1
+ 2
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label143
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 3
+
+ 1
+ 2
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+
+
+ GtkScrolledWindow
+ scrolledwindow2
+ 550
+ 150
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+ GTK_UPDATE_CONTINUOUS
+ GTK_UPDATE_CONTINUOUS
+
+ 0
+ True
+ True
+
+
+
+ GtkCList
+ clist1
+ True
+
+ select_row
+ on_attr_list_select_row
+ Tue, 01 May 2001 17:24:40 GMT
+
+ 3
+ 200,250,50
+ GTK_SELECTION_SINGLE
+ True
+ GTK_SHADOW_IN
+
+
+ GtkLabel
+ CList:title
+ label144
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ GtkLabel
+ CList:title
+ label145
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ GtkLabel
+ CList:title
+ label146
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+
+
+ GtkHButtonBox
+ hbuttonbox1
+ GTK_BUTTONBOX_SPREAD
+ 30
+ 85
+ 27
+ 7
+ 0
+
+ 0
+ False
+ True
+
+
+
+ GtkButton
+ button86
+ Creates a new event from the above data
+ True
+ True
+
+ clicked
+ on_add_attr_clicked
+
+ Tue, 01 May 2001 17:26:06 GMT
+
+
+ GTK_RELIEF_NORMAL
+
+
+
+ GtkButton
+ button87
+ Updates the selected event with the above data
+ True
+ True
+
+ clicked
+ on_update_attr_clicked
+
+ Tue, 01 May 2001 17:26:20 GMT
+
+
+ GTK_RELIEF_NORMAL
+
+
+
+ GtkButton
+ button88
+ Delete the selected event
+ True
+ True
+
+ clicked
+ on_delete_attr_clicked
+
+ Tue, 01 May 2001 17:26:35 GMT
+
+
+ GTK_RELIEF_NORMAL
+
+
+
+
+
+ GtkLabel
+ Notebook:tab
+ label124
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+
+
+
+
+ GnomeDialog
+ change_global
+ Gramps - Change Global Medial Object Properties
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_NONE
+ True
+ False
+ True
+ False
+ False
+ False
+
+
+ GtkVBox
+ GnomeDialog:vbox
+ vbox25
+ False
+ 8
+
+ 4
+ True
+ True
+
+
+
+ GtkHButtonBox
+ GnomeDialog:action_area
+ hbuttonbox2
+ GTK_BUTTONBOX_END
+ 8
+ 85
+ 27
+ 7
+ 0
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+ GtkButton
+ button89
+ True
+ True
+ True
+
+ clicked
+ on_ok_clicked
+
+ Thu, 19 Apr 2001 00:00:19 GMT
+
+ GNOME_STOCK_BUTTON_OK
+
+
+
+ GtkButton
+ button90
+ True
+ True
+
+ clicked
+ on_apply_clicked
+
+ Thu, 19 Apr 2001 00:00:06 GMT
+
+ GNOME_STOCK_BUTTON_APPLY
+
+
+
+ GtkButton
+ button91
+ True
+ True
+
+ clicked
+ on_cancel_clicked
+
+ Thu, 19 Apr 2001 00:00:43 GMT
+
+ GNOME_STOCK_BUTTON_CANCEL
+
+
+
+
+ GtkVBox
+ vbox26
+ False
+ 0
+
+ 0
+ True
+ True
+
+
+
+ GtkLabel
+ label147
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+ 0
False
False
+
+
+ GtkHSeparator
+ hseparator11
+
+ 10
+ False
+ True
+
+
+
+
+ GtkNotebook
+ notebook2
+ True
+ True
+ True
+ GTK_POS_TOP
+ False
+ 2
+ 2
+ False
+
+ 0
+ True
+ True
+
+
+
+ GtkVBox
+ vbox27
+ False
+ 0
+
+
+ GtkHBox
+ hbox3
+ False
+ 0
+
+ 0
+ True
+ True
+
+
+
+ Placeholder
+
+
+
+ GnomePixmap
+ pixmap1
+ 100
+ 100
+
+ 0
+ False
+ True
+
+
+
+
+ Placeholder
+
+
+
+
+ GtkHSeparator
+ hseparator12
+
+ 10
+ False
+ True
+
+
+
+
+ GtkTable
+ table4
+ 4
+ 4
+ False
+ 0
+ 0
+
+ 0
+ True
+ True
+
+
+
+ GtkLabel
+ label148
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 5
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label149
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 1
+ 2
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label150
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 5
+
+ 0
+ 1
+ 2
+ 3
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label151
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 1
+ 2
+ 2
+ 3
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label153
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 3
+ 2
+ 3
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkButton
+ button92
+ True
+
+ GTK_RELIEF_NORMAL
+
+ 3
+ 4
+ 2
+ 3
+ 5
+ 5
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label154
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 5
+
+ 0
+ 1
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label155
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 1
+ 2
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label156
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 5
+
+ 0
+ 1
+ 3
+ 4
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label157
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 1
+ 2
+ 3
+ 4
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label158
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 4
+ 3
+ 4
+ 5
+ 5
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label159
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 4
+ 0
+ 1
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkEntry
+ description
+ True
+ True
+ True
+ 0
+
+
+ 2
+ 4
+ 1
+ 2
+ 5
+ 5
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+
+
+ GtkLabel
+ Notebook:tab
+ label160
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ GtkVBox
+ vbox28
+ False
+ 0
+
+
+ GtkFrame
+ frame3
+ 5
+
+ 0
+ GTK_SHADOW_ETCHED_IN
+
+ 5
+ False
+ False
+
+
+
+ GtkTable
+ table5
+ 2
+ 3
+ False
+ 0
+ 0
+
+
+ GtkLabel
+ label161
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 3
+
+ 0
+ 1
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label162
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 3
+ 0
+ 1
+ 3
+ 3
+ True
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label163
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 5
+ 3
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label164
+
+ GTK_JUSTIFY_LEFT
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+ 2
+ 3
+ 1
+ 2
+ 3
+ 3
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label165
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 3
+
+ 1
+ 2
+ 0
+ 1
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkLabel
+ label166
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0.5
+ 0
+ 3
+
+ 1
+ 2
+ 1
+ 2
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+
+
+ GtkScrolledWindow
+ scrolledwindow3
+ 550
+ 150
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_AUTOMATIC
+ GTK_UPDATE_CONTINUOUS
+ GTK_UPDATE_CONTINUOUS
+
+ 0
+ True
+ True
+
+
+
+ GtkCList
+ clist2
+ True
+
+ select_row
+ on_attr_list_select_row
+ Tue, 01 May 2001 17:24:40 GMT
+
+ 3
+ 200,250,50
+ GTK_SELECTION_SINGLE
+ True
+ GTK_SHADOW_IN
+
+
+ GtkLabel
+ CList:title
+ label167
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ GtkLabel
+ CList:title
+ label168
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ GtkLabel
+ CList:title
+ label169
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+
+
+ GtkHButtonBox
+ hbuttonbox3
+ GTK_BUTTONBOX_SPREAD
+ 30
+ 85
+ 27
+ 7
+ 0
+
+ 0
+ False
+ True
+
+
+
+ GtkButton
+ button93
+ Creates a new event from the above data
+ True
+ True
+
+ clicked
+ on_add_attr_clicked
+
+ Tue, 01 May 2001 17:26:06 GMT
+
+
+ GTK_RELIEF_NORMAL
+
+
+
+ GtkButton
+ button94
+ Updates the selected event with the above data
+ True
+ True
+
+ clicked
+ on_update_attr_clicked
+
+ Tue, 01 May 2001 17:26:20 GMT
+
+
+ GTK_RELIEF_NORMAL
+
+
+
+ GtkButton
+ button95
+ Delete the selected event
+ True
+ True
+
+ clicked
+ on_delete_attr_clicked
+
+ Tue, 01 May 2001 17:26:35 GMT
+
+
+ GTK_RELIEF_NORMAL
+
+
+
+
+
+ GtkLabel
+ Notebook:tab
+ label170
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ GtkScrolledWindow
+ scrolledwindow4
+ GTK_POLICY_NEVER
+ GTK_POLICY_AUTOMATIC
+ GTK_UPDATE_CONTINUOUS
+ GTK_UPDATE_CONTINUOUS
+
+
+ GtkText
+ text2
+ True
+ False
+
+
+
+
+
+ GtkLabel
+ Notebook:tab
+ label171
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
diff --git a/gramps/src/utils.py b/gramps/src/utils.py
index f3e3a2713..ce71b2003 100644
--- a/gramps/src/utils.py
+++ b/gramps/src/utils.py
@@ -20,6 +20,7 @@
import gtk
import gnome.mime
+from gnome.ui import *
import string
import os
import const
@@ -247,8 +248,27 @@ def add_menuitem(menu,msg,obj,func):
#
#-------------------------------------------------------------------------
def view_photo(photo):
- type = gnome.mime.type(photo.getPath())
- prog = string.split(gnome.mime.get_value(type,'view'))
+ type = photo.getMimeType()
+ prog = ""
+ open = ""
+ edit = ""
+ for key in gnome.mime.get_keys(type):
+ print key,gnome.mime.get_value(type,key)
+ if key == 'view':
+ prog = string.split(gnome.mime.get_value(type,key))
+ if key == 'open':
+ open = string.split(gnome.mime.get_value(type,key))
+ if key == 'edit':
+ edit = string.split(gnome.mime.get_value(type,key))
+ if prog == "" and open == "" and edit == "":
+ GnomeWarningDialog("Sorry, I cannot find a viewer for %s type" % type)
+ return
+
+ if prog == "" and open == "":
+ prog = edit
+ else:
+ prog = open
+
args = []
for val in prog:
if val == "%f":
@@ -256,6 +276,7 @@ def view_photo(photo):
else:
args.append(val)
+ print args
if os.fork() == 0:
os.execvp(args[0],args)
@@ -312,3 +333,39 @@ def get_place_from_list(obj):
return None
else:
return select[0].get_data(LISTOBJ)
+
+def find_icon(mtype):
+ icon = None
+ nicon = None
+ for k in gnome.mime.get_keys(mtype):
+ if k == "icon-filename":
+ icon = gnome.mime.get_value(mtype,k)
+ elif k == "icon_filename":
+ nicon = gnome.mime.get_value(mtype,k)
+ if nicon:
+ p = "%s/%s" % (gnome.util.pixmap_file("nautilus"),nicon)
+ if os.path.isfile(p):
+ print "n",p
+ return p
+ p = "%s.png" % p
+ if os.path.isfile(p):
+ print "n",p
+ return p
+ if icon:
+ return icon
+ return ""
+
+def get_mime_type(file):
+ if os.path.isfile(file) or os.path.isdir(file):
+ mtype = gnome.mime.type_of_file(file)
+ if len(string.split(mtype,"/")) != 2:
+ mtype = gnome.mime.type(file)
+ else:
+ mtype = gnome.mime.type(file)
+ return mtype
+
+def get_mime_description(type):
+ for key in gnome.mime.get_keys(type):
+ if key == "description":
+ return gnome.mime.get_value(type,key)
+ return type