Refactoring in the DataViews.
svn: r10927
This commit is contained in:
parent
f71e2b13b7
commit
87c5d3e65c
@ -239,10 +239,7 @@ class EventView(PageView.ListView):
|
||||
return (query, is_used, object)
|
||||
|
||||
def edit(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
|
||||
for handle in mlist:
|
||||
for handle in self.selected_handles():
|
||||
event = self.dbstate.db.get_event_from_handle(handle)
|
||||
try:
|
||||
EditEvent(self.dbstate, self.uistate, [], event)
|
||||
|
@ -180,9 +180,7 @@ class FamilyListView(PageView.ListView):
|
||||
return self.dbstate.db.get_family_bookmarks()
|
||||
|
||||
def add_bookmark(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
|
||||
mlist = self.selected_handles()
|
||||
if mlist:
|
||||
self.bookmarks.add(mlist[0])
|
||||
else:
|
||||
@ -204,19 +202,13 @@ class FamilyListView(PageView.ListView):
|
||||
self.uistate.set_busy_cursor(1)
|
||||
import gen.utils
|
||||
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
|
||||
for handle in mlist:
|
||||
for handle in self.selected_handles():
|
||||
gen.utils.remove_family_relationships(self.dbstate.db, handle)
|
||||
self.build_tree()
|
||||
self.uistate.set_busy_cursor(0)
|
||||
|
||||
def edit(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
|
||||
for handle in mlist:
|
||||
for handle in self.selected_handles():
|
||||
from Editors import EditFamily
|
||||
family = self.dbstate.db.get_family_from_handle(handle)
|
||||
try:
|
||||
|
@ -223,10 +223,7 @@ class MediaView(PageView.ListView):
|
||||
"""
|
||||
Launch external viewers based of mime types for the selected objects.
|
||||
"""
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
|
||||
for handle in mlist:
|
||||
for handle in self.selected_handles():
|
||||
ref_obj = self.dbstate.db.get_object_from_handle(handle)
|
||||
mime_type = ref_obj.get_mime_type()
|
||||
app = Mime.get_application(mime_type)
|
||||
@ -399,17 +396,14 @@ class MediaView(PageView.ListView):
|
||||
|
||||
def edit(self, obj):
|
||||
"""
|
||||
Edit the selected object in the EditMedia dialog
|
||||
Edit the selected objects in the EditMedia dialog
|
||||
"""
|
||||
handle = self.first_selected()
|
||||
if not handle:
|
||||
return
|
||||
|
||||
obj = self.dbstate.db.get_object_from_handle(handle)
|
||||
try:
|
||||
EditMedia(self.dbstate, self.uistate, [], obj)
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
for handle in self.selected_handles():
|
||||
object = self.dbstate.db.get_object_from_handle(handle)
|
||||
try:
|
||||
EditMedia(self.dbstate, self.uistate, [], object)
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
|
||||
def get_handle_from_gramps_id(self, gid):
|
||||
"""
|
||||
|
@ -206,10 +206,7 @@ class NoteView(PageView.ListView):
|
||||
return (query, is_used, object)
|
||||
|
||||
def edit(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
|
||||
for handle in mlist:
|
||||
for handle in self.selected_handles():
|
||||
note = self.dbstate.db.get_note_from_handle(handle)
|
||||
try:
|
||||
EditNote(self.dbstate, self.uistate, [], note)
|
||||
|
@ -43,6 +43,7 @@ import Utils
|
||||
import Errors
|
||||
import Bookmarks
|
||||
import Config
|
||||
from QuestionDialog import ErrorDialog
|
||||
from DdTargets import DdTargets
|
||||
from Editors import EditPlace, DeletePlaceQuery
|
||||
from Filters.SideBar import PlaceSidebarFilter
|
||||
@ -244,10 +245,7 @@ class PlaceView(PageView.ListView):
|
||||
return (query, is_used, object)
|
||||
|
||||
def edit(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
|
||||
for handle in mlist:
|
||||
for handle in self.selected_handles():
|
||||
place = self.dbstate.db.get_place_from_handle(handle)
|
||||
try:
|
||||
EditPlace(self.dbstate, self.uistate, [], place)
|
||||
@ -255,8 +253,7 @@ class PlaceView(PageView.ListView):
|
||||
pass
|
||||
|
||||
def fast_merge(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
mlist = self.selected_handles()
|
||||
|
||||
if len(mlist) != 2:
|
||||
msg = _("Cannot merge places.")
|
||||
|
@ -206,10 +206,7 @@ class RepositoryView(PageView.ListView):
|
||||
return (query, is_used, object)
|
||||
|
||||
def edit(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
|
||||
for handle in mlist:
|
||||
for handle in self.selected_handles():
|
||||
repos = self.dbstate.db.get_repository_from_handle(handle)
|
||||
try:
|
||||
EditRepository(self.dbstate, self.uistate, [], repos)
|
||||
|
@ -44,6 +44,7 @@ import Utils
|
||||
import Bookmarks
|
||||
import Errors
|
||||
from DdTargets import DdTargets
|
||||
from QuestionDialog import ErrorDialog
|
||||
from Editors import EditSource, DelSrcQuery
|
||||
from Filters.SideBar import SourceSidebarFilter
|
||||
|
||||
@ -191,10 +192,7 @@ class SourceView(PageView.ListView):
|
||||
return (query, is_used, object)
|
||||
|
||||
def edit(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
|
||||
for handle in mlist:
|
||||
for handle in self.selected_handles():
|
||||
source = self.dbstate.db.get_source_from_handle(handle)
|
||||
try:
|
||||
EditSource(self.dbstate, self.uistate, [], source)
|
||||
@ -202,8 +200,7 @@ class SourceView(PageView.ListView):
|
||||
pass
|
||||
|
||||
def fast_merge(self, obj):
|
||||
mlist = []
|
||||
self.selection.selected_foreach(self.blist, mlist)
|
||||
mlist = self.selected_handles()
|
||||
|
||||
if len(mlist) != 2:
|
||||
msg = _("Cannot merge sources.")
|
||||
|
Loading…
Reference in New Issue
Block a user