* src/ImageSelect.py: handle new file chooser
svn: r3133
This commit is contained in:
parent
a432f34e8f
commit
1e9a1fc2cc
@ -103,22 +103,18 @@ class ImageSelect:
|
|||||||
self.fname = self.glade.get_widget("fname")
|
self.fname = self.glade.get_widget("fname")
|
||||||
self.image = self.glade.get_widget("image")
|
self.image = self.glade.get_widget("image")
|
||||||
self.description = self.glade.get_widget("photoDescription")
|
self.description = self.glade.get_widget("photoDescription")
|
||||||
self.external = self.glade.get_widget("private")
|
|
||||||
self.photosel = self.glade.get_widget("photosel")
|
|
||||||
self.temp_name = ""
|
self.temp_name = ""
|
||||||
|
|
||||||
Utils.set_titles(self.window,self.glade.get_widget('title'),
|
Utils.set_titles(self.window,self.glade.get_widget('title'),
|
||||||
_('Select a media object'))
|
_('Select a media object'))
|
||||||
|
|
||||||
self.glade.signal_autoconnect({
|
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,
|
"on_help_imagesel_clicked" : self.on_help_imagesel_clicked,
|
||||||
})
|
})
|
||||||
|
|
||||||
if os.path.isdir(_last_path):
|
if os.path.isdir(_last_path):
|
||||||
self.photosel.set_default_path(_last_path)
|
self.fname.set_current_folder(_last_path)
|
||||||
self.photosel.set_filename(_last_path)
|
|
||||||
self.photosel.gtk_entry().set_position(len(_last_path))
|
|
||||||
|
|
||||||
if self.parent_window:
|
if self.parent_window:
|
||||||
self.window.set_transient_for(self.parent_window)
|
self.window.set_transient_for(self.parent_window)
|
||||||
@ -135,7 +131,7 @@ class ImageSelect:
|
|||||||
|
|
||||||
def on_name_changed(self, obj):
|
def on_name_changed(self, obj):
|
||||||
"""The filename has changed. Verify it and load the picture."""
|
"""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)
|
basename = os.path.basename(filename)
|
||||||
(root,ext) = os.path.splitext(basename)
|
(root,ext) = os.path.splitext(basename)
|
||||||
@ -158,7 +154,7 @@ class ImageSelect:
|
|||||||
"""Save the photo in the dataobj object. (Required function)"""
|
"""Save the photo in the dataobj object. (Required function)"""
|
||||||
global _last_path
|
global _last_path
|
||||||
|
|
||||||
filename = self.photosel.get_full_path(0)
|
filename = self.fname.get_filename()
|
||||||
_last_path = os.path.dirname(filename)
|
_last_path = os.path.dirname(filename)
|
||||||
|
|
||||||
description = unicode(self.description.get_text())
|
description = unicode(self.description.get_text())
|
||||||
@ -189,22 +185,8 @@ class ImageSelect:
|
|||||||
mobj.set_description(description)
|
mobj.set_description(description)
|
||||||
mobj.set_mime_type(type)
|
mobj.set_mime_type(type)
|
||||||
self.savephoto(mobj)
|
self.savephoto(mobj)
|
||||||
|
mobj.set_path(filename)
|
||||||
if type[0:5] == "image":
|
self.db.commit_media_object(mobj)
|
||||||
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)
|
|
||||||
|
|
||||||
self.parent.lists_changed = 1
|
self.parent.lists_changed = 1
|
||||||
self.load_images()
|
self.load_images()
|
||||||
@ -615,7 +597,6 @@ class Gallery(ImageSelect):
|
|||||||
menu.set_title(_("Media Object"))
|
menu.set_title(_("Media Object"))
|
||||||
object = self.db.find_object_from_id(photo.get_reference_id())
|
object = self.db.find_object_from_id(photo.get_reference_id())
|
||||||
mtype = object.get_mime_type()
|
mtype = object.get_mime_type()
|
||||||
print mtype
|
|
||||||
progname = GrampsMime.get_application(mtype)
|
progname = GrampsMime.get_application(mtype)
|
||||||
|
|
||||||
Utils.add_menuitem(menu,_("Open in %s") % progname[1],
|
Utils.add_menuitem(menu,_("Open in %s") % progname[1],
|
||||||
|
@ -256,7 +256,6 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
self.top_visible[col[0]] = val
|
self.top_visible[col[0]] = val
|
||||||
self.visible[iter] = val
|
self.visible[iter] = val
|
||||||
except:
|
except:
|
||||||
print iter,val
|
|
||||||
self.visible[iter] = val
|
self.visible[iter] = val
|
||||||
|
|
||||||
def on_iter_next(self, node):
|
def on_iter_next(self, node):
|
||||||
|
@ -23716,7 +23716,8 @@
|
|||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
<property name="modal">False</property>
|
<property name="modal">False</property>
|
||||||
<property name="default_width">500</property>
|
<property name="default_width">650</property>
|
||||||
|
<property name="default_height">450</property>
|
||||||
<property name="resizable">True</property>
|
<property name="resizable">True</property>
|
||||||
<property name="destroy_with_parent">False</property>
|
<property name="destroy_with_parent">False</property>
|
||||||
<property name="icon">gramps.png</property>
|
<property name="icon">gramps.png</property>
|
||||||
@ -23798,8 +23799,8 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes"></property>
|
<property name="label" translatable="yes"></property>
|
||||||
<property name="use_underline">False</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="use_markup">True</property>
|
<property name="use_markup">False</property>
|
||||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="wrap">False</property>
|
<property name="wrap">False</property>
|
||||||
<property name="selectable">False</property>
|
<property name="selectable">False</property>
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0.5</property>
|
||||||
@ -23808,36 +23809,36 @@
|
|||||||
<property name="ypad">0</property>
|
<property name="ypad">0</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">6</property>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox1">
|
<widget class="GtkTable" id="table1">
|
||||||
|
<property name="border_width">12</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="n_rows">1</property>
|
||||||
|
<property name="n_columns">2</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="spacing">0</property>
|
<property name="row_spacing">6</property>
|
||||||
|
<property name="column_spacing">12</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label121">
|
<widget class="GtkFileChooserWidget" id="fname">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes"></property>
|
<property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
|
||||||
<property name="use_underline">False</property>
|
<property name="local_only">True</property>
|
||||||
<property name="use_markup">False</property>
|
<property name="select_multiple">False</property>
|
||||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
<property name="show_hidden">False</property>
|
||||||
<property name="wrap">False</property>
|
<signal name="update_preview" handler="on_fname_update_preview" last_modification_time="Thu, 06 May 2004 03:53:53 GMT"/>
|
||||||
<property name="selectable">False</property>
|
|
||||||
<property name="xalign">0.5</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="expand">True</property>
|
<property name="right_attach">1</property>
|
||||||
<property name="fill">True</property>
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
@ -23880,25 +23881,14 @@
|
|||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="expand">False</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="fill">False</property>
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="x_options"></property>
|
||||||
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label122">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes"></property>
|
|
||||||
<property name="use_underline">False</property>
|
|
||||||
<property name="use_markup">False</property>
|
|
||||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
|
||||||
<property name="wrap">False</property>
|
|
||||||
<property name="selectable">False</property>
|
|
||||||
<property name="xalign">0.5</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
@ -23906,52 +23896,13 @@
|
|||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">0</property>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTable" id="table1">
|
<widget class="GtkHBox" id="hbox90">
|
||||||
<property name="border_width">12</property>
|
<property name="border_width">6</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="n_rows">2</property>
|
|
||||||
<property name="n_columns">2</property>
|
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="row_spacing">6</property>
|
<property name="spacing">0</property>
|
||||||
<property name="column_spacing">12</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label120">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">_File:</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="use_markup">False</property>
|
|
||||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
|
||||||
<property name="wrap">False</property>
|
|
||||||
<property name="selectable">False</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
<property name="mnemonic_widget">fname</property>
|
|
||||||
<accessibility>
|
|
||||||
<atkrelation target="photosel" type="label-for"/>
|
|
||||||
</accessibility>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="right_attach">1</property>
|
|
||||||
<property name="top_attach">0</property>
|
|
||||||
<property name="bottom_attach">1</property>
|
|
||||||
<property name="y_padding">10</property>
|
|
||||||
<property name="x_options">fill</property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label118">
|
<widget class="GtkLabel" id="label118">
|
||||||
@ -23967,18 +23918,11 @@
|
|||||||
<property name="xpad">0</property>
|
<property name="xpad">0</property>
|
||||||
<property name="ypad">0</property>
|
<property name="ypad">0</property>
|
||||||
<property name="mnemonic_widget">photoDescription</property>
|
<property name="mnemonic_widget">photoDescription</property>
|
||||||
<accessibility>
|
|
||||||
<atkrelation target="photoDescription" type="label-for"/>
|
|
||||||
</accessibility>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="padding">6</property>
|
||||||
<property name="right_attach">1</property>
|
<property name="expand">False</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="fill">False</property>
|
||||||
<property name="bottom_attach">2</property>
|
|
||||||
<property name="y_padding">5</property>
|
|
||||||
<property name="x_options"></property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
@ -23995,53 +23939,16 @@
|
|||||||
<property name="activates_default">False</property>
|
<property name="activates_default">False</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="padding">6</property>
|
||||||
<property name="right_attach">2</property>
|
<property name="expand">True</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="fill">True</property>
|
||||||
<property name="bottom_attach">2</property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GnomeFileEntry" id="photosel">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="history_id">photoselect</property>
|
|
||||||
<property name="max_saved">10</property>
|
|
||||||
<property name="browse_dialog_title" translatable="yes">Select an image</property>
|
|
||||||
<property name="directory_entry">False</property>
|
|
||||||
<property name="modal">True</property>
|
|
||||||
<property name="use_filechooser">False</property>
|
|
||||||
|
|
||||||
<child internal-child="entry">
|
|
||||||
<widget class="GtkEntry" id="fname">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="has_focus">True</property>
|
|
||||||
<property name="editable">True</property>
|
|
||||||
<property name="visibility">True</property>
|
|
||||||
<property name="max_length">0</property>
|
|
||||||
<property name="text" translatable="yes"></property>
|
|
||||||
<property name="has_frame">True</property>
|
|
||||||
<property name="invisible_char" translatable="yes">*</property>
|
|
||||||
<property name="activates_default">False</property>
|
|
||||||
<signal name="changed" handler="on_name_changed" object="imageSelect"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="top_attach">0</property>
|
|
||||||
<property name="bottom_attach">1</property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">6</property>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -977,6 +977,7 @@ class GedcomParser:
|
|||||||
oref = RelLib.MediaRef()
|
oref = RelLib.MediaRef()
|
||||||
oref.set_reference_id(photo.get_id())
|
oref.set_reference_id(photo.get_id())
|
||||||
self.person.add_media_reference(oref)
|
self.person.add_media_reference(oref)
|
||||||
|
self.db.commit_person(self.person)
|
||||||
|
|
||||||
def parse_family_object(self,level):
|
def parse_family_object(self,level):
|
||||||
form = ""
|
form = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user