scratchpad/drag-n-drop fixes

svn: r6194
This commit is contained in:
Don Allingham
2006-03-22 23:03:57 +00:00
parent d6a44469e0
commit 389fa7263e
24 changed files with 273 additions and 114 deletions

View File

@@ -37,6 +37,7 @@ import PageView
import DisplayModels
import const
import Utils
from DdTargets import DdTargets
from QuestionDialog import QuestionDialog, ErrorDialog
from Editors import EditEvent, DelEventQuery
@@ -77,6 +78,9 @@ class EventView(PageView.ListView):
DisplayModels.EventModel,
signal_map)
def drag_info(self):
return DdTargets.EVENT
def column_order(self):
return self.dbstate.db.get_event_column_order()

View File

@@ -493,22 +493,20 @@ class PersonView(PageView.PersonNavView):
if len(selected_ids) == 1:
self.tree.drag_source_set(BUTTON1_MASK,
[DdTargets.PERSON_LINK.target()],
ACTION_COPY)
[DdTargets.PERSON_LINK.target()],
ACTION_COPY)
elif len(selected_ids) > 1:
self.tree.drag_source_set(BUTTON1_MASK,
[DdTargets.PERSON_LINK_LIST.target()],
ACTION_COPY)
[DdTargets.PERSON_LINK_LIST.target()],
ACTION_COPY)
self.uistate.modify_statusbar()
def drag_data_get(self, widget, context, sel_data, info, time):
selected_ids = self.get_selected_objects()
if len(selected_ids) == 1:
sel_data.set(sel_data.target, 8, selected_ids[0])
elif len(selected_ids) > 1:
sel_data.set(DdTargets.PERSON_LINK_LIST.drag_type,8,
pickle.dumps(selected_ids))
data = (DdTargets.PERSON_LINK.drag_type, id(self), selected_ids[0], 0)
sel_data.set(sel_data.target, 8 ,pickle.dumps(data))
def person_added(self,handle_list):
self.model.clear_cache()

View File

@@ -37,6 +37,7 @@ import PageView
import DisplayModels
import const
import Utils
from DdTargets import DdTargets
from Editors import EditSource, DelSrcQuery
from QuestionDialog import QuestionDialog, ErrorDialog
@@ -77,6 +78,9 @@ class SourceView(PageView.ListView):
DisplayModels.SourceModel,
signal_map)
def drag_info(self):
return DdTargets.SOURCE_LINK
def define_actions(self):
PageView.ListView.define_actions(self)
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,