2006-12-09 Don Allingham <don@gramps-project.org>
* src/DataViews/_MediaView.py: external view support for media objects * src/Editors/_EditPlace.py: external view support for media objects * src/Editors/_EditMediaRef.py: external view support for media objects * src/Editors/_EditMedia.py: external view support for media objects * src/glade/gramps.glade: external view support for media objects svn: r7773
This commit is contained in:
parent
5598a9eecb
commit
9bb495d06a
@ -1,3 +1,10 @@
|
||||
2006-12-09 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_MediaView.py: external view support for media objects
|
||||
* src/Editors/_EditPlace.py: external view support for media objects
|
||||
* src/Editors/_EditMediaRef.py: external view support for media objects
|
||||
* src/Editors/_EditMedia.py: external view support for media objects
|
||||
* src/glade/gramps.glade: external view support for media objects
|
||||
|
||||
2006-12-09 Benny Malengier <bm@cage.UGent.be>
|
||||
* src/PlaceUtils.py: better parsing of longitude/latitude
|
||||
|
||||
|
@ -179,8 +179,21 @@ class MediaView(PageView.ListView):
|
||||
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||
_('_Column Editor'), callback=self.column_editor)
|
||||
self.add_action('FilterEdit', None, _('Media Filter Editor'),
|
||||
callback=self.filter_editor,)
|
||||
callback=self.filter_editor)
|
||||
self.add_action('OpenMedia', None, _('View in an external viewer'),
|
||||
callback=self.view_media)
|
||||
|
||||
def view_media(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist,mlist)
|
||||
|
||||
for handle in mlist:
|
||||
ref_obj = self.dbstate.db.get_object_from_handle(handle)
|
||||
mime_type = ref_obj.get_mime_type()
|
||||
app = Mime.get_application(mime_type)
|
||||
if app:
|
||||
Utils.launch(app[0],ref_obj.get_path())
|
||||
|
||||
def filter_toggle(self, client, cnxn_id, etnry, data):
|
||||
if Config.get(Config.FILTER):
|
||||
self.search_bar.hide()
|
||||
@ -229,26 +242,39 @@ class MediaView(PageView.ListView):
|
||||
self.image = gtk.Image()
|
||||
self.image.set_size_request(int(const.thumbScale),
|
||||
int(const.thumbScale))
|
||||
vbox.pack_start(self.image,False)
|
||||
vbox.pack_start(base,True)
|
||||
ebox = gtk.EventBox()
|
||||
ebox.add(self.image)
|
||||
ebox.connect('button-press-event', self.button_press_event)
|
||||
vbox.pack_start(ebox, False)
|
||||
vbox.pack_start(base, True)
|
||||
|
||||
self.tt = gtk.Tooltips()
|
||||
self.tt.set_tip(ebox, _('Double click image to view in an external viewer'))
|
||||
|
||||
self.selection.connect('changed',self.row_change)
|
||||
self._set_dnd()
|
||||
return vbox
|
||||
|
||||
def button_press_event(self, obj, event):
|
||||
if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
|
||||
self.view_media(obj)
|
||||
|
||||
def row_change(self,obj):
|
||||
handle = self.first_selected()
|
||||
if not handle:
|
||||
try:
|
||||
self.image.clear()
|
||||
self.tt.disable()
|
||||
except AttributeError:
|
||||
# Working around the older pygtk
|
||||
# that lacks clear() method for gtk.Image()
|
||||
self.image.set_from_file(None)
|
||||
self.tt.enable()
|
||||
else:
|
||||
obj = self.dbstate.db.get_object_from_handle(handle)
|
||||
pix = ImgManip.get_thumbnail_image(obj.get_path())
|
||||
self.image.set_from_pixbuf(pix)
|
||||
self.tt.enable()
|
||||
|
||||
def ui_definition(self):
|
||||
return '''<ui>
|
||||
@ -279,6 +305,7 @@ class MediaView(PageView.ListView):
|
||||
<popup name="Popup">
|
||||
<menuitem action="Add"/>
|
||||
<menuitem action="Edit"/>
|
||||
<menuitem action="OpenMedia"/>
|
||||
<menuitem action="Remove"/>
|
||||
</popup>
|
||||
</ui>'''
|
||||
|
@ -117,11 +117,13 @@ class EditMedia(EditPrimary):
|
||||
self.obj, self.db.readonly)
|
||||
|
||||
pixmap = self.glade.get_widget("pixmap")
|
||||
ebox = self.glade.get_widget('eventbox')
|
||||
|
||||
mtype = self.obj.get_mime_type()
|
||||
if mtype:
|
||||
pb = ImgManip.get_thumbnail_image(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)
|
||||
@ -175,6 +177,19 @@ class EditMedia(EditPrimary):
|
||||
def build_menu_names(self,person):
|
||||
return (_('Edit Media Object'), self.get_menu_title())
|
||||
|
||||
def button_press_event(self, obj, event):
|
||||
if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
|
||||
self.view_media(obj)
|
||||
|
||||
def view_media(self, obj):
|
||||
|
||||
ref_obj = self.dbstate.db.get_object_from_handle(self.obj.handle)
|
||||
mime_type = ref_obj.get_mime_type()
|
||||
app = Mime.get_application(mime_type)
|
||||
if app:
|
||||
import Utils
|
||||
Utils.launch(app[0],ref_obj.get_path())
|
||||
|
||||
def select_file(self,obj):
|
||||
f = gtk.FileChooserDialog(
|
||||
_('Select Media Object'),
|
||||
|
@ -1,4 +1,4 @@
|
||||
#
|
||||
0#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||
@ -80,6 +80,9 @@ class EditMediaRef(EditReference):
|
||||
|
||||
self.pix = ImgManip.get_thumbnail_image(self.source.get_path(),mtype)
|
||||
self.pixmap = self.top.get_widget("pixmap")
|
||||
ebox = self.top.get_widget('eventbox')
|
||||
ebox.connect('button-press-event', self.button_press_event)
|
||||
|
||||
self.pixmap.set_from_pixbuf(self.pix)
|
||||
|
||||
coord = self.source_ref.get_rectangle()
|
||||
@ -124,6 +127,17 @@ class EditMediaRef(EditReference):
|
||||
else:
|
||||
self.top.get_widget("type").set_text("")
|
||||
|
||||
def button_press_event(self, obj, event):
|
||||
if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
|
||||
self.view_media(obj)
|
||||
|
||||
def view_media(self, obj):
|
||||
mime_type = self.source.get_mime_type()
|
||||
app = Mime.get_application(mime_type)
|
||||
if app:
|
||||
import Utils
|
||||
Utils.launch(app[0],self.source.get_path())
|
||||
|
||||
def _connect_signals(self):
|
||||
self.define_cancel_button(self.top.get_widget('button84'))
|
||||
self.define_ok_button(self.top.get_widget('button82'),self.save)
|
||||
|
@ -74,7 +74,7 @@ class EditPlace(EditPrimary):
|
||||
self.window.show()
|
||||
|
||||
def get_menu_title(self):
|
||||
if self.obj.get_handle():
|
||||
if self.obj and self.obj.get_handle():
|
||||
title = self.obj.get_title()
|
||||
dialog_title = _('Place: %s') % title
|
||||
else:
|
||||
|
@ -1583,7 +1583,7 @@
|
||||
<child>
|
||||
<widget class="GtkEntry" id="latitude">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">North/South position, eg 50.84988, 50°50'59.60"N or 50:50:59.60</property>
|
||||
<property name="tooltip" translatable="yes">North/South position, eg 50.84988, 50°50'59.60"N or 50:50:59.60</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
@ -1634,7 +1634,7 @@
|
||||
<child>
|
||||
<widget class="GtkEntry" id="longitude">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">East/West position, eg -2.88589, 2°53'9.23" W or -2:53:9.23</property>
|
||||
<property name="tooltip" translatable="yes">East/West position, eg -2.88589, 2°53'9.23" W or -2:53:9.23</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
@ -5129,14 +5129,23 @@
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="pixmap">
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">100</property>
|
||||
<widget class="GtkEventBox" id="eventbox">
|
||||
<property name="visible">True</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="tooltip" translatable="yes">Double click image to view in an external viewer</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="above_child">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="pixmap">
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
@ -5615,14 +5624,23 @@
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="pixmap">
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">100</property>
|
||||
<widget class="GtkEventBox" id="eventbox">
|
||||
<property name="visible">True</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="tooltip" translatable="yes">Double click image to view in an external viewer</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="above_child">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="pixmap">
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user