2008-02-08 Raphael Ackermann <raphael.ackermann@gmail.com>

* src/Editors/_EditEvent.py:
    * src/Editors/_EditFamily.py:
    * src/Editors/_EditMedia.py:
    * src/Editors/_EditNote.py:
    * src/Editors/_EditPlace.py:
    * src/Editors/_EditPrimary.py:
    * src/Editors/_EditRepository.py:
    * src/Editors/_EditSource.py:
    pylint fixes

svn: r10005
This commit is contained in:
Raphael Ackermann 2008-02-08 15:29:28 +00:00
parent 6776b91ca5
commit 04e16919a1
9 changed files with 259 additions and 224 deletions

View File

@ -1,4 +1,15 @@
2008-02-07 Raphael Ackermann <raphael.ackermann@gmail.com>
2008-02-08 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/Editors/_EditEvent.py:
* src/Editors/_EditFamily.py:
* src/Editors/_EditMedia.py:
* src/Editors/_EditNote.py:
* src/Editors/_EditPlace.py:
* src/Editors/_EditPrimary.py:
* src/Editors/_EditRepository.py:
* src/Editors/_EditSource.py:
pylint fixes
2008-02-08 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/Editors/_EditEvent.py:
* src/Editors/_EditFamily.py:
* src/Editors/_EditMedia.py:

View File

@ -33,6 +33,7 @@ from gettext import gettext as _
#
#-------------------------------------------------------------------------
import gtk
from gtk import glade
#-------------------------------------------------------------------------
#
@ -43,11 +44,13 @@ import const
import Config
import gen.lib
import GrampsDisplay
from _EditPrimary import EditPrimary
from Editors import EditPrimary
from QuestionDialog import ErrorDialog
from DisplayTabs import SourceEmbedList, NoteTab, GalleryTab, EventBackRefList, AttrEmbedList
from GrampsWidgets import *
from DisplayTabs import (SourceEmbedList, NoteTab, GalleryTab,
EventBackRefList, AttrEmbedList)
from GrampsWidgets import (MonitoredEntry, PlaceEntry, PrivacyButton,
MonitoredDataType, MonitoredDate)
#-------------------------------------------------------------------------
#
@ -62,7 +65,7 @@ from GrampsWidgets import *
#-------------------------------------------------------------------------
class EditEvent(EditPrimary):
def __init__(self,dbstate,uistate,track,event,callback=None):
def __init__(self, dbstate, uistate, track, event, callback=None):
EditPrimary.__init__(self, dbstate, uistate, track,
event, dbstate.db.get_event_from_handle)
@ -90,7 +93,7 @@ class EditEvent(EditPrimary):
self.dbstate.db.get_family_event_types()
def _local_init(self):
self.top = gtk.glade.XML(const.GLADE_FILE, "event_edit","gramps")
self.top = glade.XML(const.GLADE_FILE, "event_edit","gramps")
self.set_window(self.top.get_widget("event_edit"), None,
self.get_menu_title())
@ -103,12 +106,12 @@ class EditEvent(EditPrimary):
self.window.resize(width, height)
def _connect_signals(self):
self.top.get_widget('button111').connect('clicked',self.close)
self.top.get_widget('button126').connect('clicked',self.help_clicked)
self.top.get_widget('button111').connect('clicked', self.close)
self.top.get_widget('button126').connect('clicked', self.help_clicked)
self.ok_button = self.top.get_widget('ok')
self.ok_button.set_sensitive(not self.db.readonly)
self.ok_button.connect('clicked',self.save)
self.ok_button.connect('clicked', self.save)
def _setup_fields(self):
@ -187,7 +190,7 @@ class EditEvent(EditPrimary):
self._setup_notebook_tabs( notebook)
notebook.show_all()
self.top.get_widget('vbox').pack_start(notebook,True)
self.top.get_widget('vbox').pack_start(notebook, True)
def _cleanup_on_exit(self):
self.backref_tab.close()
@ -196,14 +199,14 @@ class EditEvent(EditPrimary):
Config.set(Config.EVENT_HEIGHT, height)
Config.sync()
def build_menu_names(self,event):
def build_menu_names(self, event):
return (_('Edit Event'), self.get_menu_title())
def help_clicked(self,obj):
def help_clicked(self, obj):
"""Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('adv-ev')
def save(self,*obj):
def save(self, *obj):
self.ok_button.set_sensitive(False)
if self.object_is_empty():
ErrorDialog(_("Cannot save event"),
@ -226,12 +229,12 @@ class EditEvent(EditPrimary):
self.db.transaction_commit(trans, _("Add Event"))
else:
orig = self.get_from_handle(self.obj.handle)
if cmp(self.obj.serialize(),orig.serialize()):
if cmp(self.obj.serialize(), orig.serialize()):
trans = self.db.transaction_begin()
if not self.obj.get_gramps_id():
self.obj.set_gramps_id(self.db.find_next_event_gramps_id())
self.commit_event(self.obj,trans)
self.db.transaction_commit(trans,_("Edit Event"))
self.commit_event(self.obj, trans)
self.db.transaction_commit(trans, _("Edit Event"))
if self.callback:
self.callback(self.obj)
@ -289,7 +292,7 @@ class EditFamilyEvent(EditEvent):
#
#-------------------------------------------------------------------------
class DelEventQuery:
def __init__(self,dbstate,uistate,event,person_list,family_list):
def __init__(self, dbstate, uistate, event, person_list, family_list):
self.event = event
self.db = dbstate.db
self.uistate = uistate
@ -304,15 +307,15 @@ class DelEventQuery:
for handle in self.person_list:
person = self.db.get_person_from_handle(handle)
person.remove_handle_references('Event',ev_handle_list)
self.db.commit_person(person,trans)
person.remove_handle_references('Event', ev_handle_list)
self.db.commit_person(person, trans)
for handle in self.family_list:
family = self.db.get_family_from_handle(handle)
family.remove_handle_references('Event',ev_handle_list)
self.db.commit_family(family,trans)
family.remove_handle_references('Event', ev_handle_list)
self.db.commit_family(family, trans)
self.db.enable_signals()
self.db.remove_event(self.event.get_handle(),trans)
self.db.remove_event(self.event.get_handle(), trans)
self.db.transaction_commit(
trans,_("Delete Event (%s)") % self.event.get_gramps_id())

View File

@ -26,6 +26,9 @@
#
#-------------------------------------------------------------------------
from bsddb import db as bsddb_db
from gettext import gettext as _
from DdTargets import DdTargets
import pickle
#-------------------------------------------------------------------------
#
# enable logging for error handling
@ -39,7 +42,9 @@ log = logging.getLogger(".")
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
from gtk import glade
from gtk import gdk
#-------------------------------------------------------------------------
#
@ -47,26 +52,27 @@ from gtk import glade
#
#-------------------------------------------------------------------------
import Utils
import const
import Config
from BasicUtils import name_displayer
import gen.lib
import Errors
from _EditPrimary import EditPrimary
from Editors import EditPrimary
from ReportBase import ReportUtils
from DisplayTabs import \
EmbeddedList,EventEmbedList,SourceEmbedList,FamilyAttrEmbedList,\
NoteTab,GalleryTab,FamilyLdsEmbedList, ChildModel
from GrampsWidgets import *
from DisplayTabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
FamilyAttrEmbedList, NoteTab, GalleryTab,
FamilyLdsEmbedList, ChildModel)
from GrampsWidgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
IconButton, LinkBox, BasicLabel)
from ReportBase import CATEGORY_QR_FAMILY
import QuestionDialog
#from ObjectSelector import PersonSelector,PersonFilterSpec
from Selectors import selector_factory
SelectPerson = selector_factory('Person')
_RETURN = gtk.gdk.keyval_from_name("Return")
_KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter")
_RETURN = gdk.keyval_from_name("Return")
_KP_ENTER = gdk.keyval_from_name("KP_Enter")
class ChildEmbedList(EmbeddedList):
"""
@ -116,33 +122,33 @@ class ChildEmbedList(EmbeddedList):
(True, True, gtk.STOCK_REMOVE, self.del_button_clicked),
]
def find_index(self,obj):
def find_index(self, obj):
"""
returns the index of the object within the associated data
"""
reflist = [ref.ref for ref in self.family.get_child_ref_list()]
return reflist.index(obj)
def _find_row(self,x,y):
row = self.tree.get_path_at_pos(x,y)
def _find_row(self, x, y):
row = self.tree.get_path_at_pos(x, y)
if row == None:
return len(self.family.get_child_ref_list())
else:
return row[0][0]
def _handle_drag(self, row, obj):
self.family.get_child_ref_list().insert(row,obj)
self.family.get_child_ref_list().insert(row, obj)
self.changed = True
self.rebuild()
def _move(self, row_from, row_to, obj):
dlist = self.family.get_child_ref_list()
if row_from < row_to:
dlist.insert(row_to,obj)
dlist.insert(row_to, obj)
del dlist[row_from]
else:
del dlist[row_from]
dlist.insert(row_to-1,obj)
dlist.insert(row_to-1, obj)
self.changed = True
self.rebuild()
@ -187,9 +193,10 @@ class ChildEmbedList(EmbeddedList):
return self.family
def column_order(self):
return [(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(0,8),(0,9)]
return [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
(0, 8), (0, 9)]
def add_button_clicked(self,obj):
def add_button_clicked(self, obj):
from Editors import EditPerson
person = gen.lib.Person()
autoname = Config.get(Config.SURNAME_GUESSING)
@ -206,7 +213,7 @@ class ChildEmbedList(EmbeddedList):
person.get_primary_name().set_surname(name[1])
person.get_primary_name().set_surname_prefix(name[0])
EditPerson(self.dbstate, self.uistate, self.track,person,
EditPerson(self.dbstate, self.uistate, self.track, person,
self.new_child_added)
def new_child_added(self, person):
@ -219,7 +226,7 @@ class ChildEmbedList(EmbeddedList):
def child_ref_edited(self, person):
self.rebuild()
def share_button_clicked(self,obj):
def share_button_clicked(self, obj):
# it only makes sense to skip those who are already in the family
skip_list = [self.family.get_father_handle(), \
@ -237,12 +244,12 @@ class ChildEmbedList(EmbeddedList):
self.rebuild()
self.call_edit_childref(ref.ref)
def run(self,skip):
def run(self, skip):
skip_list = [ x for x in skip if x]
SelectPerson(self.dbstate, self.uistate, self.track,
_("Select Child"), skip=skip_list)
def del_button_clicked(self,obj):
def del_button_clicked(self, obj):
handle = self.get_selected()
if handle:
for ref in self.family.get_child_ref_list():
@ -250,7 +257,7 @@ class ChildEmbedList(EmbeddedList):
self.family.remove_child_ref(ref)
self.rebuild()
def edit_button_clicked(self,obj):
def edit_button_clicked(self, obj):
handle = self.get_selected()
if handle:
self.call_edit_childref(handle)
@ -289,16 +296,16 @@ class ChildEmbedList(EmbeddedList):
if handle:
pos = self.find_index(handle)
if pos > 0 :
self._move_up(pos,self.family.get_child_ref_list()[pos]
,selmethod=self.family.get_child_ref_list)
self._move_up(pos,self.family.get_child_ref_list()[pos],
selmethod=self.family.get_child_ref_list)
def down_button_clicked(self, obj):
ref = self.get_selected()
if ref:
pos = self.find_index(ref)
if pos >=0 and pos < len(self.family.get_child_ref_list())-1:
self._move_down(pos,self.family.get_child_ref_list()[pos]
,selmethod=self.family.get_child_ref_list)
self._move_down(pos,self.family.get_child_ref_list()[pos],
selmethod=self.family.get_child_ref_list)
def drag_data_received(self, widget, context, x, y, sel_data, info, time):
@ -337,7 +344,7 @@ class ChildEmbedList(EmbeddedList):
if father_handle:
father = self.dbstate.db.get_person_from_handle(father_handle)
pname = father.get_primary_name()
return (pname.get_surname_prefix(),pname.get_surname())
return (pname.get_surname_prefix(), pname.get_surname())
return ("","")
def no_name(self):
@ -356,27 +363,27 @@ class ChildEmbedList(EmbeddedList):
fsn = father.get_primary_name().get_surname()
msn = mother.get_primary_name().get_surname()
try:
return ("","%s %s" % (fsn.split()[0],msn.split()[0]))
return ("", "%s %s" % (fsn.split()[0], msn.split()[0]))
except:
return ("","")
return ("", "")
else:
return ("","")
return ("", "")
class FastMaleFilter:
def __init__(self,db):
def __init__(self, db):
self.db = db
def match(self, handle,db):
def match(self, handle, db):
value = self.db.get_raw_person_data(handle)
return value[2] == gen.lib.Person.MALE
class FastFemaleFilter:
def __init__(self,db):
def __init__(self, db):
self.db = db
def match(self, handle,db):
def match(self, handle, db):
value = self.db.get_raw_person_data(handle)
return value[2] == gen.lib.Person.FEMALE
@ -389,7 +396,7 @@ class EditFamily(EditPrimary):
QR_CATEGORY = CATEGORY_QR_FAMILY
def __init__(self,dbstate, uistate, track, family):
def __init__(self, dbstate, uistate, track, family):
self.tooltips = gtk.Tooltips()
EditPrimary.__init__(self, dbstate, uistate, track,
@ -482,12 +489,12 @@ class EditFamily(EditPrimary):
dialog_title = _("New Family")
return dialog_title
def build_menu_names(self,family):
def build_menu_names(self, family):
return (_('Edit Family'), self.get_menu_title())
def build_interface(self):
self.top = glade.XML(const.GLADE_FILE,"family_editor","gramps")
self.top = glade.XML(const.GLADE_FILE, "family_editor", "gramps")
self.set_window(self.top.get_widget("family_editor"), None, self.get_menu_title())
@ -503,9 +510,9 @@ class EditFamily(EditPrimary):
self.mdeath = self.top.get_widget('mdeath')
self.mbutton = self.top.get_widget('mbutton')
self.mbutton2= self.top.get_widget('mbutton2')
self.mbutton2 = self.top.get_widget('mbutton2')
self.fbutton = self.top.get_widget('fbutton')
self.fbutton2= self.top.get_widget('fbutton2')
self.fbutton2 = self.top.get_widget('fbutton2')
self.tooltips.set_tip(self.mbutton2,
_("Add a new person as the mother"))
@ -527,7 +534,7 @@ class EditFamily(EditPrimary):
def _setup_fields(self):
self.private= PrivacyButton(
self.private = PrivacyButton(
self.top.get_widget('private'),
self.obj,
self.db.readonly)
@ -566,10 +573,10 @@ class EditFamily(EditPrimary):
self.phandles = [handle for handle in self.phandles if handle]
self.mbutton.connect('clicked',self.mother_clicked)
self.mbutton2.connect('clicked',self.add_mother_clicked)
self.fbutton.connect('clicked',self.father_clicked)
self.fbutton2.connect('clicked',self.add_father_clicked)
self.mbutton.connect('clicked', self.mother_clicked)
self.mbutton2.connect('clicked', self.add_mother_clicked)
self.fbutton.connect('clicked', self.father_clicked)
self.fbutton2.connect('clicked', self.add_father_clicked)
def _create_tabbed_pages(self):
@ -579,13 +586,16 @@ class EditFamily(EditPrimary):
notebook,
ChildEmbedList(self.dbstate,self.uistate, self.track, self.obj))
self.event_embed = EventEmbedList(self.dbstate,self.uistate, self.track,self.obj)
self.event_embed = EventEmbedList(self.dbstate, self.uistate,
self.track,self.obj)
self.event_list = self._add_tab(notebook, self.event_embed)
self.source_embed = SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj)
self.source_embed = SourceEmbedList(self.dbstate, self.uistate,
self.track, self.obj)
self.src_list = self._add_tab(notebook, self.source_embed)
self.attr_embed = FamilyAttrEmbedList(self.dbstate, self.uistate, self.track,
self.attr_embed = FamilyAttrEmbedList(self.dbstate, self.uistate,
self.track,
self.obj.get_attribute_list())
self.attr_list = self._add_tab(notebook, self.attr_embed)
@ -600,7 +610,8 @@ class EditFamily(EditPrimary):
GalleryTab(self.dbstate, self.uistate, self.track,
self.obj.get_media_list()))
self.lds_embed = FamilyLdsEmbedList(self.dbstate, self.uistate, self.track,
self.lds_embed = FamilyLdsEmbedList(self.dbstate, self.uistate,
self.track,
self.obj.get_lds_ord_list())
self.lds_list = self._add_tab(notebook, self.lds_embed)
@ -608,15 +619,15 @@ class EditFamily(EditPrimary):
notebook.show_all()
self.hidden = (notebook, self.top.get_widget('info'))
self.top.get_widget('vbox').pack_start(notebook,True)
self.top.get_widget('vbox').pack_start(notebook, True)
def update_father(self,handle):
def update_father(self, handle):
self.load_parent(handle, self.fbox, self.fbirth,
self.fdeath, self.fbutton, self.fbutton2,
_("Select a person as the father"),
_("Remove the person as the father"))
def update_mother(self,handle):
def update_mother(self, handle):
self.load_parent(handle, self.mbox, self.mbirth,
self.mdeath, self.mbutton, self.mbutton2,
_("Select a person as the mother"),
@ -762,7 +773,7 @@ class EditFamily(EditPrimary):
'you cancel the editing of this window, and '
'select the existing family'))
def edit_person(self,obj,event,handle):
def edit_person(self, obj, event, handle):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1 \
or event.keyval in (_RETURN, _KP_ENTER):
from _EditPerson import EditPerson
@ -792,17 +803,17 @@ class EditFamily(EditPrimary):
person = db.get_person_from_handle(handle)
name = "%s [%s]" % (name_displayer.display(person),
person.gramps_id)
data = ReportUtils.get_birth_death_strings(db,person)
data = ReportUtils.get_birth_death_strings(db, person)
birth = data[0]
death = data[4]
del_image = gtk.Image()
del_image.show()
del_image.set_from_stock(gtk.STOCK_REMOVE,gtk.ICON_SIZE_BUTTON)
del_image.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_BUTTON)
self.tooltips.set_tip(btn_obj, del_msg)
btn_obj.add(del_image)
edit_btn = IconButton(self.edit_person,person.handle)
edit_btn = IconButton(self.edit_person, person.handle)
self.tooltips.set_tip(edit_btn, _('Edit %s') % name)
box.pack_start(LinkBox(
@ -817,31 +828,31 @@ class EditFamily(EditPrimary):
add_image = gtk.Image()
add_image.show()
add_image.set_from_stock(gtk.STOCK_INDEX,gtk.ICON_SIZE_BUTTON)
add_image.set_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON)
self.tooltips.set_tip(btn_obj, add_msg)
btn_obj.add(add_image)
birth_obj.set_text(birth)
death_obj.set_text(death)
def fix_parent_handles(self,orig_handle, new_handle, trans):
def fix_parent_handles(self, orig_handle, new_handle, trans):
if orig_handle != new_handle:
if orig_handle:
person = self.db.get_person_from_handle(orig_handle)
person.family_list.remove(self.obj.handle)
self.db.commit_person(person,trans)
self.db.commit_person(person, trans)
if new_handle:
person = self.db.get_person_from_handle(new_handle)
if self.obj.handle not in person.family_list:
person.family_list.append(self.obj.handle)
self.db.commit_person(person,trans)
self.db.commit_person(person, trans)
def object_is_empty(self):
return self.obj.get_father_handle() == None and \
self.obj.get_mother_handle() == None and \
len(self.obj.get_child_ref_list()) == 0
def save(self,*obj):
def save(self, *obj):
try:
self.__do_save()
except bsddb_db.DBRunRecoveryError, msg:
@ -903,36 +914,36 @@ class EditFamily(EditPrimary):
if handle:
parent = self.db.get_person_from_handle(handle)
parent.add_family_handle(self.obj.handle)
self.db.commit_person(parent,trans)
self.db.commit_person(parent, trans)
# find the mother, add the family handle to the mother
handle = self.obj.get_mother_handle()
if handle:
parent = self.db.get_person_from_handle(handle)
parent.add_family_handle(self.obj.handle)
self.db.commit_person(parent,trans)
self.db.commit_person(parent, trans)
# for each child, add the family handle to the child
for ref in self.obj.get_child_ref_list():
child = self.db.get_person_from_handle(ref.ref)
# fix - relationships need to be extracted from the list
child.add_parent_family_handle(self.obj.handle)
self.db.commit_person(child,trans)
self.db.commit_person(child, trans)
self.db.add_family(self.obj,trans)
self.db.transaction_commit(trans,_("Add Family"))
self.db.add_family(self.obj, trans)
self.db.transaction_commit(trans, _("Add Family"))
elif original and self.object_is_empty():
trans = self.db.transaction_begin()
self.db.remove_family(self.obj.handle,trans)
self.db.transaction_commit(trans,_("Remove Family"))
self.db.remove_family(self.obj.handle, trans)
self.db.transaction_commit(trans, _("Remove Family"))
elif cmp(original.serialize(),self.obj.serialize()):
trans = self.db.transaction_begin()
self.fix_parent_handles(original.get_father_handle(),
self.obj.get_father_handle(),trans)
self.obj.get_father_handle(), trans)
self.fix_parent_handles(original.get_mother_handle(),
self.obj.get_mother_handle(),trans)
self.obj.get_mother_handle(), trans)
orig_set = set(original.get_child_ref_list())
new_set = set(self.obj.get_child_ref_list())
@ -941,21 +952,21 @@ class EditFamily(EditPrimary):
for ref in orig_set.difference(new_set):
person = self.db.get_person_from_handle(ref.ref)
person.remove_parent_family_handle(self.obj.handle)
self.db.commit_person(person,trans)
self.db.commit_person(person, trans)
# add the family to children which have been added
for ref in new_set.difference(orig_set):
person = self.db.get_person_from_handle(ref.ref)
person.add_parent_family_handle(self.obj.handle)
self.db.commit_person(person,trans)
self.db.commit_person(person, trans)
if self.object_is_empty():
self.db.remove_family(self.obj.handle,trans)
self.db.remove_family(self.obj.handle, trans)
else:
if not self.obj.get_gramps_id():
self.obj.set_gramps_id(self.db.find_next_family_gramps_id())
self.db.commit_family(self.obj,trans)
self.db.transaction_commit(trans,_("Edit Family"))
self.db.commit_family(self.obj, trans)
self.db.transaction_commit(trans, _("Edit Family"))
self.close()
@ -981,8 +992,8 @@ class EditFamily(EditPrimary):
child = self.db.get_person_from_handle(ref.ref)
if child:
pname = child.get_primary_name()
return (pname.get_surname_prefix(),pname.get_surname())
return ("","")
return (pname.get_surname_prefix(), pname.get_surname())
return ("", "")
def latin_american_child(self, parent):
"""
@ -1003,9 +1014,9 @@ class EditFamily(EditPrimary):
else:
fsn, msn = surname, surname
if parent == "father":
return prefix,fsn
return prefix, fsn
elif parent == "mother":
return prefix,msn
return prefix, msn
else:
return ("","")
return ("","")
return ("", "")
return ("", "")

View File

@ -27,7 +27,6 @@
#-------------------------------------------------------------------------
from gettext import gettext as _
import os
import sys
#-------------------------------------------------------------------------
#
@ -35,6 +34,7 @@ import sys
#
#-------------------------------------------------------------------------
import gtk
from gtk import glade
#-------------------------------------------------------------------------
#
@ -47,12 +47,11 @@ import gen.lib
import Mime
import ThumbNails
import Utils
from _EditPrimary import EditPrimary
from AddMedia import AddMediaObject
from GrampsWidgets import *
from DisplayTabs import SourceEmbedList,AttrEmbedList,NoteTab,MediaBackRefList
from Editors import EditPrimary
from GrampsWidgets import MonitoredDate, MonitoredEntry, PrivacyButton
from DisplayTabs import (SourceEmbedList, AttrEmbedList, NoteTab,
MediaBackRefList)
from Editors.AddMedia import AddMediaObject
#-------------------------------------------------------------------------
#
# EditMedia
@ -88,7 +87,7 @@ class EditMedia(EditPrimary):
def _local_init(self):
assert(self.obj)
self.glade = gtk.glade.XML(const.GLADE_FILE,
self.glade = glade.XML(const.GLADE_FILE,
"change_global","gramps")
self.set_window(self.glade.get_widget('change_global'),
@ -183,13 +182,13 @@ class EditMedia(EditPrimary):
self._setup_notebook_tabs( notebook)
notebook.show_all()
self.glade.get_widget('vbox').pack_start(notebook,True)
self.glade.get_widget('vbox').pack_start(notebook, True)
def build_menu_names(self,person):
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:
if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
self.view_media(obj)
def view_media(self, obj):
@ -197,8 +196,7 @@ class EditMedia(EditPrimary):
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())
Utils.launch(app[0], ref_obj.get_path())
def select_file(self, val):
AddMediaObject(self.dbstate, self.uistate, self.track, self.obj,
@ -251,7 +249,7 @@ class EditMedia(EditPrimary):
class DeleteMediaQuery:
def __init__(self,dbstate,uistate,media_handle,the_lists):
def __init__(self, dbstate, uistate, media_handle, the_lists):
self.db = dbstate.db
self.uistate = uistate
self.media_handle = media_handle
@ -261,7 +259,7 @@ class DeleteMediaQuery:
trans = self.db.transaction_begin()
self.db.disable_signals()
(person_list,family_list,event_list,
(person_list, family_list, event_list,
place_list,source_list) = self.the_lists
for handle in person_list:
@ -269,36 +267,36 @@ class DeleteMediaQuery:
new_list = [ photo for photo in person.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
person.set_media_list(new_list)
self.db.commit_person(person,trans)
self.db.commit_person(person, trans)
for handle in family_list:
family = self.db.get_family_from_handle(handle)
new_list = [ photo for photo in family.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
family.set_media_list(new_list)
self.db.commit_family(family,trans)
self.db.commit_family(family, trans)
for handle in event_list:
event = self.db.get_event_from_handle(handle)
new_list = [ photo for photo in event.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
event.set_media_list(new_list)
self.db.commit_event(event,trans)
self.db.commit_event(event, trans)
for handle in place_list:
place = self.db.get_place_from_handle(handle)
new_list = [ photo for photo in place.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
place.set_media_list(new_list)
self.db.commit_place(place,trans)
self.db.commit_place(place, trans)
for handle in source_list:
source = self.db.get_source_from_handle(handle)
new_list = [ photo for photo in source.get_media_list() \
if photo.get_reference_handle() != self.media_handle ]
source.set_media_list(new_list)
self.db.commit_source(source,trans)
self.db.commit_source(source, trans)
self.db.enable_signals()
self.db.remove_object(self.media_handle,trans)
self.db.transaction_commit(trans,_("Remove Media Object"))
self.db.remove_object(self.media_handle, trans)
self.db.transaction_commit(trans, _("Remove Media Object"))

View File

@ -27,13 +27,17 @@
#-------------------------------------------------------------------------
from gettext import gettext as _
import logging
log = logging.getLogger(".")
#-------------------------------------------------------------------------
#
# GTK libraries
#
#-------------------------------------------------------------------------
import gtk
from pango import WEIGHT_BOLD, STYLE_ITALIC, UNDERLINE_SINGLE
from gtk import glade
import gobject
from pango import UNDERLINE_SINGLE
#-------------------------------------------------------------------------
#
@ -45,9 +49,10 @@ import Spell
import Config
import GrampsDisplay
import MarkupText
from _EditPrimary import EditPrimary
from Editors._EditPrimary import EditPrimary
from DisplayTabs import GrampsTab, NoteBackRefList
from GrampsWidgets import *
from GrampsWidgets import (MonitoredDataType, MonitoredCheckbox,
MonitoredEntry, PrivacyButton)
from gen.lib import Note
#-------------------------------------------------------------------------
@ -174,7 +179,7 @@ class EditNote(EditPrimary):
and overridden here.
"""
self.top = gtk.glade.XML(const.GLADE_FILE, "edit_note", "gramps")
self.top = glade.XML(const.GLADE_FILE, "edit_note", "gramps")
win = self.top.get_widget("edit_note")
self.set_window(win, None, self.get_menu_title())
@ -236,7 +241,7 @@ class EditNote(EditPrimary):
Called by the init routine of the base class (_EditPrimary).
"""
self.define_ok_button(self.top.get_widget('ok'),self.save)
self.define_ok_button(self.top.get_widget('ok'), self.save)
self.define_cancel_button(self.top.get_widget('cancel'))
self.define_help_button(self.top.get_widget('help'), '')
@ -275,22 +280,22 @@ class EditNote(EditPrimary):
</ui>
'''
buffer = MarkupText.MarkupBuffer()
buffer.create_tag('hyperlink',
buffer_ = MarkupText.MarkupBuffer()
buffer_.create_tag('hyperlink',
underline=UNDERLINE_SINGLE,
foreground='blue')
buffer.match_add("(www|ftp)[" + HOSTCHARS + "]*\\.[" + HOSTCHARS +
buffer_.match_add("(www|ftp)[" + HOSTCHARS + "]*\\.[" + HOSTCHARS +
".]+" + "(:[0-9]+)?(" + URLPATH + ")?/?", HTTP)
buffer.match_add("(mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9][a-z0-9-]*"
buffer_.match_add("(mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9][a-z0-9-]*"
"(\\.[a-z0-9][a-z0-9-]*)+", MAIL)
buffer.match_add(SCHEME + "//(" + USER + "@)?[" + HOSTCHARS + ".]+" +
buffer_.match_add(SCHEME + "//(" + USER + "@)?[" + HOSTCHARS + ".]+" +
"(:[0-9]+)?(" + URLPATH + ")?/?", GENERAL)
self.match = None
self.last_match = None
self.text = self.top.get_widget('text')
self.text.set_editable(not self.dbstate.db.readonly)
self.text.set_buffer(buffer)
self.text.set_buffer(buffer_)
self.text.connect('key-press-event',
self.on_textview_key_press_event)
self.text.connect('insert-at-cursor',
@ -328,7 +333,7 @@ class EditNote(EditPrimary):
# create a formatting toolbar
if not self.dbstate.db.readonly:
uimanager = gtk.UIManager()
uimanager.insert_action_group(buffer.format_action_group, 0)
uimanager.insert_action_group(buffer_.format_action_group, 0)
uimanager.add_ui_from_string(FORMAT_TOOLBAR)
uimanager.ensure_update()
@ -337,12 +342,12 @@ class EditNote(EditPrimary):
vbox = self.top.get_widget('container')
vbox.pack_start(toolbar)
# setup initial values for textview and buffer
# setup initial values for textview and buffer_
if self.obj:
self.empty = False
self.flow_changed(self.obj.get_format())
buffer.set_text(self.obj.get(markup=True))
log.debug("Initial Note: %s" % buffer.get_text())
buffer_.set_text(self.obj.get(markup=True))
log.debug("Initial Note: %s" % buffer_.get_text())
else:
self.empty = True
@ -374,20 +379,20 @@ class EditNote(EditPrimary):
x, y = textview.window_to_buffer_coords(gtk.TEXT_WINDOW_WIDGET,
int(event.x), int(event.y))
iter = textview.get_iter_at_location(x, y)
buffer = textview.get_buffer()
self.match = buffer.match_check(iter.get_offset())
buffer_ = textview.get_buffer()
self.match = buffer_.match_check(iter.get_offset())
if self.match != self.last_match:
start, end = buffer.get_bounds()
buffer.remove_tag_by_name('hyperlink', start, end)
start, end = buffer_.get_bounds()
buffer_.remove_tag_by_name('hyperlink', start, end)
if self.match:
start_offset = self.match[MarkupText.MATCH_START]
end_offset = self.match[MarkupText.MATCH_END]
start = buffer.get_iter_at_offset(start_offset)
end = buffer.get_iter_at_offset(end_offset)
start = buffer_.get_iter_at_offset(start_offset)
end = buffer_.get_iter_at_offset(end_offset)
buffer.apply_tag_by_name('hyperlink', start, end)
buffer_.apply_tag_by_name('hyperlink', start, end)
window.set_cursor(self.hand_cursor)
else:
window.set_cursor(self.regular_cursor)
@ -462,9 +467,9 @@ class EditNote(EditPrimary):
def update_note(self):
"""Update the Note object with current value."""
if self.obj:
buffer = self.text.get_buffer()
(start, stop) = buffer.get_bounds()
text = buffer.get_text(start, stop)
buffer_ = self.text.get_buffer()
(start, stop) = buffer_.get_bounds()
text = buffer_.get_text(start, stop)
self.obj.set(text)
log.debug(text)
@ -481,12 +486,12 @@ class EditNote(EditPrimary):
self.update_note()
if not self.obj.get_handle():
self.db.add_note(self.obj,trans)
self.db.add_note(self.obj, trans)
msg = _("Add Note")
else:
if not self.obj.get_gramps_id():
self.obj.set_gramps_id(self.db.find_next_note_gramps_id())
self.db.commit_note(self.obj,trans)
self.db.commit_note(self.obj, trans)
msg = _("Edit Note")
self.db.transaction_commit(trans, msg)
@ -524,37 +529,37 @@ class DeleteNoteQuery:
for handle in person_list:
person = self.db.get_person_from_handle(handle)
person.remove_note(note_handle)
self.db.commit_person(person,trans)
self.db.commit_person(person, trans)
for handle in family_list:
family = self.db.get_family_from_handle(handle)
family.remove_note(note_handle)
self.db.commit_family(family,trans)
self.db.commit_family(family, trans)
for handle in event_list:
event = self.db.get_event_from_handle(handle)
event.remove_note(note_handle)
self.db.commit_event(event,trans)
self.db.commit_event(event, trans)
for handle in place_list:
place = self.db.get_place_from_handle(handle)
place.remove_note(note_handle)
self.db.commit_place(place,trans)
self.db.commit_place(place, trans)
for handle in source_list:
source = self.db.get_source_from_handle(handle)
source.remove_note(note_handle)
self.db.commit_source(source,trans)
self.db.commit_source(source, trans)
for handle in media_list:
media = self.db.get_object_from_handle(handle)
media.remove_note(note_handle)
self.db.commit_media_object(media,trans)
self.db.commit_media_object(media, trans)
for handle in repo_list:
repo = self.db.get_repository_from_handle(handle)
repo.remove_note(note_handle)
self.db.commit_repository(repo,trans)
self.db.commit_repository(repo, trans)
self.db.enable_signals()
self.db.remove_note(note_handle, trans)

View File

@ -36,6 +36,7 @@ log = logging.getLogger(".")
#
#-------------------------------------------------------------------------
import gtk
from gtk import glade
#-------------------------------------------------------------------------
#
@ -45,10 +46,11 @@ import gtk
import const
import Config
import gen.lib
from _EditPrimary import EditPrimary
from DisplayTabs import *
from GrampsWidgets import *
from Editors._EditPrimary import EditPrimary
from DisplayTabs import (GrampsTab, LocationEmbedList, SourceEmbedList,
GalleryTab, NoteTab, WebEmbedList, PlaceBackRefList)
from GrampsWidgets import MonitoredEntry, PrivacyButton
from Errors import ValidationError
from PlaceUtils import conv_lat_lon
#-------------------------------------------------------------------------
@ -101,7 +103,7 @@ class MainLocTab(GrampsTab):
#-------------------------------------------------------------------------
class EditPlace(EditPrimary):
def __init__(self,dbstate,uistate,track,place,callback=None):
def __init__(self, dbstate, uistate, track, place, callback=None):
EditPrimary.__init__(self, dbstate, uistate, track, place,
dbstate.db.get_place_from_handle, callback)
@ -109,7 +111,7 @@ class EditPlace(EditPrimary):
return gen.lib.Place()
def _local_init(self):
self.top = gtk.glade.XML(const.GLADE_FILE,"place_editor","gramps")
self.top = glade.XML(const.GLADE_FILE, "place_editor","gramps")
self.set_window(self.top.get_widget("place_editor"), None,
self.get_menu_title())
@ -132,7 +134,7 @@ class EditPlace(EditPrimary):
return dialog_title
def _connect_signals(self):
self.define_ok_button(self.top.get_widget('ok'),self.save)
self.define_ok_button(self.top.get_widget('ok'), self.save)
self.define_cancel_button(self.top.get_widget('cancel'))
self.define_help_button(self.top.get_widget('help'),'adv-plc')
@ -205,7 +207,7 @@ class EditPlace(EditPrimary):
return ValidationError(_(u"Invalid longitude (syntax: 18\u00b09'" +
'48.21"E, -18.2412 or -18:9:48.21)'))
def build_menu_names(self,place):
def build_menu_names(self, place):
return (_('Edit Place'), self.get_menu_title())
def _create_tabbed_pages(self):
@ -257,13 +259,12 @@ class EditPlace(EditPrimary):
Config.set(Config.PLACE_HEIGHT, height)
Config.sync()
def save(self,*obj):
def save(self, *obj):
self.ok_button.set_sensitive(False)
title = self.obj.get_title()
trans = self.db.transaction_begin()
if not self.obj.get_handle():
self.db.add_place(self.obj,trans)
self.db.add_place(self.obj, trans)
msg = _("Add Place (%s)") % self.obj.get_title()
else:
if not self.obj.get_gramps_id():
@ -283,8 +284,8 @@ class EditPlace(EditPrimary):
#-------------------------------------------------------------------------
class DeletePlaceQuery:
def __init__(self,dbstate,uistate,
place,person_list,family_list,event_list):
def __init__(self, dbstate, uistate, place, person_list, family_list,
event_list):
self.db = dbstate.db
self.uistate = uistate
self.obj = place
@ -300,20 +301,20 @@ class DeletePlaceQuery:
for handle in self.person_list:
person = self.db.get_person_from_handle(handle)
person.remove_handle_references('Place',place_handle)
self.db.commit_person(person,trans)
person.remove_handle_references('Place', place_handle)
self.db.commit_person(person, trans)
for handle in self.family_list:
family = self.db.get_family_from_handle(handle)
family.remove_handle_references('Place',place_handle)
self.db.commit_family(family,trans)
family.remove_handle_references('Place', place_handle)
self.db.commit_family(family, trans)
for handle in self.event_list:
event = self.db.get_event_from_handle(handle)
event.remove_handle_references('Place',place_handle)
self.db.commit_event(event,trans)
event.remove_handle_references('Place', place_handle)
self.db.commit_event(event, trans)
self.db.enable_signals()
self.db.remove_place(place_handle,trans)
self.db.remove_place(place_handle, trans)
self.db.transaction_commit(
trans,_("Delete Place (%s)") % self.obj.get_title())

View File

@ -34,7 +34,8 @@ class EditPrimary(ManagedWindow.ManagedWindow):
QR_CATEGORY = -1
def __init__(self, state, uistate, track, obj, get_from_handle, callback=None):
def __init__(self, state, uistate, track, obj, get_from_handle,
callback=None):
"""Creates an edit window. Associates a person with the window."""
self.dp = DateHandler.parser
@ -73,7 +74,7 @@ class EditPrimary(ManagedWindow.ManagedWindow):
pass
def _add_db_signal(self, name, callback):
self.signal_keys.append(self.db.connect(name,callback))
self.signal_keys.append(self.db.connect(name, callback))
def _connect_signals(self):
pass
@ -84,7 +85,7 @@ class EditPrimary(ManagedWindow.ManagedWindow):
def _create_tabbed_pages(self):
pass
def build_window_key(self,obj):
def build_window_key(self, obj):
if obj and obj.get_handle():
return obj.get_handle()
else:
@ -101,11 +102,12 @@ class EditPrimary(ManagedWindow.ManagedWindow):
page_no)
child.set_parent_notebook(notebook)
def _switch_page_on_dnd(self, widget, context, x, y, time, notebook, page_no):
def _switch_page_on_dnd(self, widget, context, x, y, time, notebook,
page_no):
if notebook.get_current_page() != page_no:
notebook.set_current_page(page_no)
def _add_tab(self,notebook,page):
def _add_tab(self, notebook, page):
notebook.insert_page(page, page.get_tab_widget())
page.add_db_signal_callback(self._add_db_signal)
return page
@ -122,19 +124,19 @@ class EditPrimary(ManagedWindow.ManagedWindow):
button.connect('clicked', function)
button.set_sensitive(not self.db.readonly)
def define_cancel_button(self,button):
button.connect('clicked',self.close)
def define_cancel_button(self, button):
button.connect('clicked', self.close)
def define_help_button(self,button,tag):
def define_help_button(self, button, tag):
button.connect('clicked', lambda x: GrampsDisplay.help(tag))
def _do_close(self,*obj):
def _do_close(self, *obj):
for key in self.signal_keys:
self.db.disconnect(key)
self._cleanup_on_exit()
ManagedWindow.ManagedWindow.close(self)
def close(self,*obj):
def close(self, *obj):
"""If the data has changed, give the user a chance to cancel
the close window"""
if not Config.get(Config.DONT_ASK) and self.data_has_changed():
@ -169,7 +171,7 @@ class EditPrimary(ManagedWindow.ManagedWindow):
return cmp(cmp_obj.serialize()[1:],
self.obj.serialize()[1:]) != 0
def save(self,*obj):
def save(self, *obj):
pass
def set_contexteventbox(self, eventbox):
@ -237,7 +239,7 @@ class EditPrimary(ManagedWindow.ManagedWindow):
Derived class can create a ui with menuitems and corresponding list of
actiongroups
"""
return "",[]
return "", []
def _post_build_popup_ui(self):
"""

View File

@ -33,6 +33,7 @@ from gettext import gettext as _
#
#-------------------------------------------------------------------------
import gtk
from gtk import glade
#-------------------------------------------------------------------------
#
@ -43,13 +44,13 @@ import const
import Config
import gen.lib
from GrampsWidgets import *
from DisplayTabs import AddrEmbedList,WebEmbedList,NoteTab,SourceBackRefList
from _EditPrimary import EditPrimary
from GrampsWidgets import MonitoredEntry, MonitoredDataType, PrivacyButton
from DisplayTabs import AddrEmbedList, WebEmbedList, NoteTab, SourceBackRefList
from Editors._EditPrimary import EditPrimary
class EditRepository(EditPrimary):
def __init__(self,dbstate,uistate,track,repository):
def __init__(self, dbstate, uistate, track, repository):
EditPrimary.__init__(self, dbstate, uistate, track,
repository, dbstate.db.get_repository_from_handle)
@ -69,15 +70,16 @@ class EditRepository(EditPrimary):
return title
def _local_init(self):
self.glade = gtk.glade.XML(const.GLADE_FILE,"repository_editor","gramps")
self.glade = glade.XML(const.GLADE_FILE, "repository_editor","gramps")
self.set_window(self.glade.get_widget("repository_editor"), None, self.get_menu_title())
self.set_window(self.glade.get_widget("repository_editor"), None,
self.get_menu_title())
width = Config.get(Config.REPO_WIDTH)
height = Config.get(Config.REPO_HEIGHT)
self.window.resize(width, height)
def build_menu_names(self,source):
def build_menu_names(self, source):
return (_('Edit Repository'), self.get_menu_title())
def _setup_fields(self):
@ -134,7 +136,7 @@ class EditRepository(EditPrimary):
self._setup_notebook_tabs( notebook)
notebook.show_all()
self.glade.get_widget("vbox").pack_start(notebook,True,True)
self.glade.get_widget("vbox").pack_start(notebook, True, True)
def _connect_signals(self):
self.define_help_button(self.glade.get_widget('help'),'adv-src')
@ -172,7 +174,7 @@ class EditRepository(EditPrimary):
Config.sync()
class DelRepositoryQuery:
def __init__(self,dbstate,uistate,repository,sources):
def __init__(self, dbstate, uistate, repository, sources):
self.obj = repository
self.db = dbstate.db
self.uistate = uistate
@ -186,8 +188,8 @@ class DelRepositoryQuery:
for handle in self.sources:
source = self.db.get_source_from_handle(handle)
source.remove_repo_references(repos_handle_list)
self.db.commit_source(source,trans)
self.db.commit_source(source, trans)
self.db.remove_repository(self.obj.get_handle(),trans)
self.db.remove_repository(self.obj.get_handle(), trans)
self.db.transaction_commit(
trans,_("Delete Repository (%s)") % self.obj.get_name())
trans, _("Delete Repository (%s)") % self.obj.get_name())

View File

@ -35,7 +35,8 @@ log = logging.getLogger(".")
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk.glade
import gtk
from gtk import glade
#-------------------------------------------------------------------------
#
@ -45,11 +46,11 @@ import gtk.glade
import const
import Config
import gen.lib
from _EditPrimary import EditPrimary
from Editors._EditPrimary import EditPrimary
from DisplayTabs import \
NoteTab,GalleryTab,DataEmbedList,SourceBackRefList,RepoEmbedList
from GrampsWidgets import *
from DisplayTabs import (NoteTab, GalleryTab, DataEmbedList,
SourceBackRefList, RepoEmbedList)
from GrampsWidgets import MonitoredEntry, PrivacyButton
#-------------------------------------------------------------------------
#
@ -58,7 +59,7 @@ from GrampsWidgets import *
#-------------------------------------------------------------------------
class EditSource(EditPrimary):
def __init__(self,dbstate,uistate,track,source):
def __init__(self, dbstate, uistate, track,source):
EditPrimary.__init__(self, dbstate, uistate, track,
source, dbstate.db.get_source_from_handle)
@ -77,9 +78,10 @@ class EditSource(EditPrimary):
def _local_init(self):
assert(self.obj)
self.glade = gtk.glade.XML(const.GLADE_FILE,"source_editor","gramps")
self.glade = glade.XML(const.GLADE_FILE, "source_editor","gramps")
self.set_window(self.glade.get_widget("source_editor"), None, self.get_menu_title())
self.set_window(self.glade.get_widget("source_editor"), None,
self.get_menu_title())
width = Config.get(Config.SOURCE_WIDTH)
height = Config.get(Config.SOURCE_HEIGHT)
self.window.resize(width, height)
@ -155,9 +157,9 @@ class EditSource(EditPrimary):
self._setup_notebook_tabs( notebook)
notebook.show_all()
self.glade.get_widget('vbox').pack_start(notebook,True)
self.glade.get_widget('vbox').pack_start(notebook, True)
def build_menu_names(self,source):
def build_menu_names(self, source):
return (_('Edit Source'), self.get_menu_title())
def save(self, *obj):
@ -192,7 +194,7 @@ class EditSource(EditPrimary):
Config.sync()
class DelSrcQuery:
def __init__(self,dbstate,uistate,source,the_lists):
def __init__(self, dbstate, uistate, source, the_lists):
self.source = source
self.db = dbstate.db
self.uistate = uistate
@ -202,47 +204,47 @@ class DelSrcQuery:
trans = self.db.transaction_begin()
self.db.disable_signals()
(person_list,family_list,event_list,place_list,source_list,
media_list,repo_list) = self.the_lists
(person_list, family_list, event_list, place_list, source_list,
media_list, repo_list) = self.the_lists
src_handle_list = [self.source.get_handle()]
for handle in person_list:
person = self.db.get_person_from_handle(handle)
person.remove_source_references(src_handle_list)
self.db.commit_person(person,trans)
self.db.commit_person(person, trans)
for handle in family_list:
family = self.db.get_family_from_handle(handle)
family.remove_source_references(src_handle_list)
self.db.commit_family(family,trans)
self.db.commit_family(family, trans)
for handle in event_list:
event = self.db.get_event_from_handle(handle)
event.remove_source_references(src_handle_list)
self.db.commit_event(event,trans)
self.db.commit_event(event, trans)
for handle in place_list:
place = self.db.get_place_from_handle(handle)
place.remove_source_references(src_handle_list)
self.db.commit_place(place,trans)
self.db.commit_place(place, trans)
for handle in source_list:
source = self.db.get_source_from_handle(handle)
source.remove_source_references(src_handle_list)
self.db.commit_source(source,trans)
self.db.commit_source(source, trans)
for handle in media_list:
media = self.db.get_object_from_handle(handle)
media.remove_source_references(src_handle_list)
self.db.commit_media_object(media,trans)
self.db.commit_media_object(media, trans)
for handle in repo_list:
repo = self.db.get_repository_from_handle(handle)
repo.remove_source_references(src_handle_list)
self.db.commit_repository(repo,trans)
self.db.commit_repository(repo, trans)
self.db.enable_signals()
self.db.remove_source(self.source.get_handle(),trans)
self.db.remove_source(self.source.get_handle(), trans)
self.db.transaction_commit(
trans,_("Delete Source (%s)") % self.source.get_title())
trans, _("Delete Source (%s)") % self.source.get_title())