GTK3 port, reenable ctrl+C copy behavior on listvie
svn: r20089
This commit is contained in:
parent
e44e69b0dc
commit
28a20116b5
@ -133,18 +133,18 @@ def obj2class(target):
|
||||
}
|
||||
return d[target] if target in d else None
|
||||
|
||||
def obj2target(target):
|
||||
d = {"Person": 'person-link',
|
||||
"Family": 'family-link',
|
||||
'Source': 'source-link',
|
||||
'Citation': 'citation-link',
|
||||
'Repository': 'repo-link',
|
||||
'Event': 'pevent',
|
||||
'Media': 'mediaobj',
|
||||
'Place': 'place-link',
|
||||
'Note': 'note-link',
|
||||
OBJ2TARGET = {"Person": Gdk.atom_intern('person-link', False),
|
||||
"Family": Gdk.atom_intern('family-link', False),
|
||||
'Source': Gdk.atom_intern('source-link', False),
|
||||
'Citation': Gdk.atom_intern('citation-link', False),
|
||||
'Repository': Gdk.atom_intern('repo-link', False),
|
||||
'Event': Gdk.atom_intern('pevent', False),
|
||||
'Media': Gdk.atom_intern('mediaobj', False),
|
||||
'Place': Gdk.atom_intern('place-link', False),
|
||||
'Note': Gdk.atom_intern('note-link', False),
|
||||
}
|
||||
return d[target] if target in d else None
|
||||
def obj2target(target):
|
||||
return OBJ2TARGET[target] if target in OBJ2TARGET else None
|
||||
|
||||
def model_contains(model, data):
|
||||
"""
|
||||
@ -857,7 +857,7 @@ class ClipDropHandleList(ClipDropList):
|
||||
retval = []
|
||||
for (objclass, handle) in self._obj_list:
|
||||
_class = obj2class(objclass)
|
||||
target = obj2target(objclass)
|
||||
target = obj2target(objclass).name()
|
||||
# outgoing:
|
||||
# (drag_type, idval, self._handle, val) = pickle.loads(self._obj)
|
||||
data = (target, id(self), handle, 0)
|
||||
|
@ -249,11 +249,17 @@ class PageView(DbGUIElement):
|
||||
class Selection(object):
|
||||
def __init__(self, data):
|
||||
self.data = data
|
||||
def get_data(self):
|
||||
return self.data
|
||||
class Context(object):
|
||||
targets = [drag_type]
|
||||
action = 1
|
||||
def list_targets(self):
|
||||
return Context.targets
|
||||
def get_actions(self):
|
||||
return Context.action
|
||||
# eg: ('person-link', 23767, '27365123671', 0)
|
||||
data = (drag_type, id(self), handle, 0)
|
||||
data = (drag_type.name(), id(self), handle, 0)
|
||||
clipboard.object_list.object_drag_data_received(
|
||||
clipboard.object_list._widget, # widget
|
||||
Context(), # drag type and action
|
||||
@ -271,7 +277,7 @@ class PageView(DbGUIElement):
|
||||
|
||||
The code creates the Clipboard if it does not already exist.
|
||||
"""
|
||||
from gui.clipboard import ClipboardWindow, obj2target
|
||||
from gui.clipboard import ClipboardWindow
|
||||
clipboard = None
|
||||
for widget in self.uistate.gwm.window_tree:
|
||||
if isinstance(widget, ClipboardWindow):
|
||||
|
Loading…
Reference in New Issue
Block a user