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>
|
2006-12-09 Benny Malengier <bm@cage.UGent.be>
|
||||||
* src/PlaceUtils.py: better parsing of longitude/latitude
|
* src/PlaceUtils.py: better parsing of longitude/latitude
|
||||||
|
|
||||||
|
@ -179,7 +179,20 @@ class MediaView(PageView.ListView):
|
|||||||
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
|
||||||
_('_Column Editor'), callback=self.column_editor)
|
_('_Column Editor'), callback=self.column_editor)
|
||||||
self.add_action('FilterEdit', None, _('Media Filter 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):
|
def filter_toggle(self, client, cnxn_id, etnry, data):
|
||||||
if Config.get(Config.FILTER):
|
if Config.get(Config.FILTER):
|
||||||
@ -229,26 +242,39 @@ class MediaView(PageView.ListView):
|
|||||||
self.image = gtk.Image()
|
self.image = gtk.Image()
|
||||||
self.image.set_size_request(int(const.thumbScale),
|
self.image.set_size_request(int(const.thumbScale),
|
||||||
int(const.thumbScale))
|
int(const.thumbScale))
|
||||||
vbox.pack_start(self.image,False)
|
ebox = gtk.EventBox()
|
||||||
vbox.pack_start(base,True)
|
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.selection.connect('changed',self.row_change)
|
||||||
self._set_dnd()
|
self._set_dnd()
|
||||||
return vbox
|
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):
|
def row_change(self,obj):
|
||||||
handle = self.first_selected()
|
handle = self.first_selected()
|
||||||
if not handle:
|
if not handle:
|
||||||
try:
|
try:
|
||||||
self.image.clear()
|
self.image.clear()
|
||||||
|
self.tt.disable()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# Working around the older pygtk
|
# Working around the older pygtk
|
||||||
# that lacks clear() method for gtk.Image()
|
# that lacks clear() method for gtk.Image()
|
||||||
self.image.set_from_file(None)
|
self.image.set_from_file(None)
|
||||||
|
self.tt.enable()
|
||||||
else:
|
else:
|
||||||
obj = self.dbstate.db.get_object_from_handle(handle)
|
obj = self.dbstate.db.get_object_from_handle(handle)
|
||||||
pix = ImgManip.get_thumbnail_image(obj.get_path())
|
pix = ImgManip.get_thumbnail_image(obj.get_path())
|
||||||
self.image.set_from_pixbuf(pix)
|
self.image.set_from_pixbuf(pix)
|
||||||
|
self.tt.enable()
|
||||||
|
|
||||||
def ui_definition(self):
|
def ui_definition(self):
|
||||||
return '''<ui>
|
return '''<ui>
|
||||||
@ -279,6 +305,7 @@ class MediaView(PageView.ListView):
|
|||||||
<popup name="Popup">
|
<popup name="Popup">
|
||||||
<menuitem action="Add"/>
|
<menuitem action="Add"/>
|
||||||
<menuitem action="Edit"/>
|
<menuitem action="Edit"/>
|
||||||
|
<menuitem action="OpenMedia"/>
|
||||||
<menuitem action="Remove"/>
|
<menuitem action="Remove"/>
|
||||||
</popup>
|
</popup>
|
||||||
</ui>'''
|
</ui>'''
|
||||||
|
@ -117,11 +117,13 @@ class EditMedia(EditPrimary):
|
|||||||
self.obj, self.db.readonly)
|
self.obj, self.db.readonly)
|
||||||
|
|
||||||
pixmap = self.glade.get_widget("pixmap")
|
pixmap = self.glade.get_widget("pixmap")
|
||||||
|
ebox = self.glade.get_widget('eventbox')
|
||||||
|
|
||||||
mtype = self.obj.get_mime_type()
|
mtype = self.obj.get_mime_type()
|
||||||
if mtype:
|
if mtype:
|
||||||
pb = ImgManip.get_thumbnail_image(self.obj.get_path(),mtype)
|
pb = ImgManip.get_thumbnail_image(self.obj.get_path(),mtype)
|
||||||
pixmap.set_from_pixbuf(pb)
|
pixmap.set_from_pixbuf(pb)
|
||||||
|
ebox.connect('button-press-event', self.button_press_event)
|
||||||
descr = Mime.get_description(mtype)
|
descr = Mime.get_description(mtype)
|
||||||
if descr:
|
if descr:
|
||||||
self.glade.get_widget("type").set_text(descr)
|
self.glade.get_widget("type").set_text(descr)
|
||||||
@ -175,6 +177,19 @@ class EditMedia(EditPrimary):
|
|||||||
def build_menu_names(self,person):
|
def build_menu_names(self,person):
|
||||||
return (_('Edit Media Object'), self.get_menu_title())
|
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):
|
def select_file(self,obj):
|
||||||
f = gtk.FileChooserDialog(
|
f = gtk.FileChooserDialog(
|
||||||
_('Select Media Object'),
|
_('Select Media Object'),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#
|
0#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
# 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.pix = ImgManip.get_thumbnail_image(self.source.get_path(),mtype)
|
||||||
self.pixmap = self.top.get_widget("pixmap")
|
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)
|
self.pixmap.set_from_pixbuf(self.pix)
|
||||||
|
|
||||||
coord = self.source_ref.get_rectangle()
|
coord = self.source_ref.get_rectangle()
|
||||||
@ -124,6 +127,17 @@ class EditMediaRef(EditReference):
|
|||||||
else:
|
else:
|
||||||
self.top.get_widget("type").set_text("")
|
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):
|
def _connect_signals(self):
|
||||||
self.define_cancel_button(self.top.get_widget('button84'))
|
self.define_cancel_button(self.top.get_widget('button84'))
|
||||||
self.define_ok_button(self.top.get_widget('button82'),self.save)
|
self.define_ok_button(self.top.get_widget('button82'),self.save)
|
||||||
|
@ -74,7 +74,7 @@ class EditPlace(EditPrimary):
|
|||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
def get_menu_title(self):
|
def get_menu_title(self):
|
||||||
if self.obj.get_handle():
|
if self.obj and self.obj.get_handle():
|
||||||
title = self.obj.get_title()
|
title = self.obj.get_title()
|
||||||
dialog_title = _('Place: %s') % title
|
dialog_title = _('Place: %s') % title
|
||||||
else:
|
else:
|
||||||
|
@ -1583,7 +1583,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkEntry" id="latitude">
|
<widget class="GtkEntry" id="latitude">
|
||||||
<property name="visible">True</property>
|
<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="can_focus">True</property>
|
||||||
<property name="editable">True</property>
|
<property name="editable">True</property>
|
||||||
<property name="visibility">True</property>
|
<property name="visibility">True</property>
|
||||||
@ -1634,7 +1634,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkEntry" id="longitude">
|
<widget class="GtkEntry" id="longitude">
|
||||||
<property name="visible">True</property>
|
<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="can_focus">True</property>
|
||||||
<property name="editable">True</property>
|
<property name="editable">True</property>
|
||||||
<property name="visibility">True</property>
|
<property name="visibility">True</property>
|
||||||
@ -5128,6 +5128,13 @@
|
|||||||
<property name="label_yalign">0.5</property>
|
<property name="label_yalign">0.5</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEventBox" id="eventbox">
|
||||||
|
<property name="visible">True</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>
|
<child>
|
||||||
<widget class="GtkImage" id="pixmap">
|
<widget class="GtkImage" id="pixmap">
|
||||||
<property name="width_request">100</property>
|
<property name="width_request">100</property>
|
||||||
@ -5139,6 +5146,8 @@
|
|||||||
<property name="ypad">0</property>
|
<property name="ypad">0</property>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label175">
|
<widget class="GtkLabel" id="label175">
|
||||||
@ -5614,6 +5623,13 @@
|
|||||||
<property name="label_yalign">0.5</property>
|
<property name="label_yalign">0.5</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEventBox" id="eventbox">
|
||||||
|
<property name="visible">True</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>
|
<child>
|
||||||
<widget class="GtkImage" id="pixmap">
|
<widget class="GtkImage" id="pixmap">
|
||||||
<property name="width_request">100</property>
|
<property name="width_request">100</property>
|
||||||
@ -5625,6 +5641,8 @@
|
|||||||
<property name="ypad">0</property>
|
<property name="ypad">0</property>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label188">
|
<widget class="GtkLabel" id="label188">
|
||||||
|
Loading…
Reference in New Issue
Block a user