* src/ImageSelect.py: handle new file chooser

svn: r3133
This commit is contained in:
Don Allingham 2004-05-06 04:26:47 +00:00
parent a1078319aa
commit c068064279
5 changed files with 48 additions and 160 deletions

View File

@ -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],

View File

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

View File

@ -23716,7 +23716,8 @@
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</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="destroy_with_parent">False</property>
<property name="icon">gramps.png</property>
@ -23798,8 +23799,8 @@
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
@ -23808,36 +23809,36 @@
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="padding">6</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</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="n_rows">1</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label121">
<widget class="GtkFileChooserWidget" id="fname">
<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>
<property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
<property name="local_only">True</property>
<property name="select_multiple">False</property>
<property name="show_hidden">False</property>
<signal name="update_preview" handler="on_fname_update_preview" last_modification_time="Thu, 06 May 2004 03:53:53 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
</packing>
</child>
@ -23880,78 +23881,28 @@
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</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>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<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="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<property name="border_width">12</property>
<widget class="GtkHBox" id="hbox90">
<property name="border_width">6</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="row_spacing">6</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>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label118">
@ -23967,18 +23918,11 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">photoDescription</property>
<accessibility>
<atkrelation target="photoDescription" type="label-for"/>
</accessibility>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_padding">5</property>
<property name="x_options"></property>
<property name="y_options"></property>
<property name="padding">6</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
@ -23995,53 +23939,16 @@
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</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>
<property name="padding">6</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="padding">6</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>

View File

@ -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 = ""