diff --git a/src/gui/clipboard.py b/src/gui/clipboard.py index 5184a43ec..91c2ddd38 100644 --- a/src/gui/clipboard.py +++ b/src/gui/clipboard.py @@ -895,7 +895,7 @@ class ClipboardListView(object): LOCAL_DRAG_TYPE = 'MY_TREE_MODEL_ROW' LOCAL_DRAG_ATOM_TYPE = Gdk.atom_intern(LOCAL_DRAG_TYPE, False) - LOCAL_DRAG_TARGET = (LOCAL_DRAG_TYPE, Gtk.TargetFlags.SAME_WIDGET, 0) + LOCAL_DRAG_TARGET = (LOCAL_DRAG_ATOM_TYPE, Gtk.TargetFlags.SAME_WIDGET, 0) def __init__(self, dbstate, widget): @@ -954,7 +954,7 @@ class ClipboardListView(object): targ_data = DdTargets.all_dtype() tglist = Gtk.TargetList.new([]) - tglist.add(ClipboardListView.LOCAL_DRAG_ATOM_TYPE, + tglist.add(ClipboardListView.LOCAL_DRAG_TARGET[0], ClipboardListView.LOCAL_DRAG_TARGET[1], ClipboardListView.LOCAL_DRAG_TARGET[2]) for tg in targ_data: @@ -1128,7 +1128,7 @@ class ClipboardListView(object): tree_selection = self._widget.get_selection() model, paths = tree_selection.get_selected_rows() if len(paths) > 1: - targets = [(DdTargets.RAW_LIST.drag_type, Gtk.TargetFlags.SAME_WIDGET, 0), + targets = [(DdTargets.RAW_LIST.atom_drag_type, Gtk.TargetFlags.SAME_WIDGET, 0), ClipboardListView.LOCAL_DRAG_TARGET] else: targets = [ClipboardListView.LOCAL_DRAG_TARGET] @@ -1136,11 +1136,16 @@ class ClipboardListView(object): node = model.get_iter(path) if node is not None: o = model.get_value(node,1) - targets += [target.target_data() for target in o.__class__.DROP_TARGETS] + targets += [target.target_data_atom() for target in o.__class__.DROP_TARGETS] + #TODO GTK3: wourkaround here for bug https://bugzilla.gnome.org/show_bug.cgi?id=680638 self._widget.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, - targets, + [], Gdk.DragAction.COPY | Gdk.DragAction.MOVE) + tglist = Gtk.TargetList.new([]) + for tg in targets: + tglist.add(tg[0], tg[1], tg[2]) + self._widget.drag_source_set_target_list(tglist) def object_drag_begin(self, widget, drag_context): """ Handle the beginning of a drag operation. """ @@ -1153,18 +1158,19 @@ class ClipboardListView(object): def object_drag_data_get(self, widget, context, sel_data, info, time): tree_selection = widget.get_selection() model, paths = tree_selection.get_selected_rows() + tgs = context.list_targets() if len(paths) == 1: path = paths[0] node = model.get_iter(path) o = model.get_value(node,1) - sel_data.set(sel_data.target, 8, o.pack()) + sel_data.set(tgs[0], 8, o.pack()) elif len(paths) > 1: raw_list = [] for path in paths: node = model.get_iter(path) o = model.get_value(node,1) raw_list.append(o.pack()) - sel_data.set(sel_data.target, 8, pickle.dumps(raw_list)) + sel_data.set(tgs[0], 8, pickle.dumps(raw_list)) def object_drag_data_received(self, widget, context, x, y, selection, info, time, title=None, value=None, dbid=None, diff --git a/src/gui/ddtargets.py b/src/gui/ddtargets.py index a79086553..1865895b7 100644 --- a/src/gui/ddtargets.py +++ b/src/gui/ddtargets.py @@ -100,6 +100,13 @@ class _DdType: """ return [self.drag_type, self.target_flags, self.app_id] + def target_data_atom(self): + """ + Return the target information as a list in the format required by + Gtk3 functions. + """ + return [self.atom_drag_type, self.target_flags, self.app_id] + class _DdTargets(object): """A single class that manages all the drag and drop targets.""" diff --git a/src/gui/editors/displaytabs/embeddedlist.py b/src/gui/editors/displaytabs/embeddedlist.py index 1c041a128..a73757f04 100644 --- a/src/gui/editors/displaytabs/embeddedlist.py +++ b/src/gui/editors/displaytabs/embeddedlist.py @@ -180,16 +180,24 @@ class EmbeddedList(ButtonTab): """ if self._DND_EXTRA: - dnd_types = [self._DND_TYPE.target_data(), - self._DND_EXTRA.target_data()] + dnd_types = [self._DND_TYPE, + self._DND_EXTRA] else: - dnd_types = [self._DND_TYPE.target_data()] + dnd_types = [self._DND_TYPE] - self.tree.enable_model_drag_dest(dnd_types, - Gdk.DragAction.COPY) - self.tree.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, - [self._DND_TYPE.target_data()], - Gdk.DragAction.COPY) + #TODO GTK3: wourkaround here for bug https://bugzilla.gnome.org/show_bug.cgi?id=680638 + self.tree.enable_model_drag_dest([], Gdk.DragAction.COPY) + self.tree.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, [], + Gdk.DragAction.COPY) + tglist = Gtk.TargetList.new([]) + for tg in dnd_types: + tglist.add(tg.atom_drag_type, tg.target_flags, tg.app_id) + self.tree.drag_dest_set_target_list(tglist) + tglist = Gtk.TargetList.new([]) + tglist.add(self._DND_TYPE.atom_drag_type, self._DND_TYPE.target_flags, + self._DND_TYPE.app_id) + self.tree.drag_source_set_target_list(tglist) + self.tree.connect('drag_data_get', self.drag_data_get) if not self.dbstate.db.readonly: self.tree.connect('drag_data_received', self.drag_data_received) @@ -220,7 +228,7 @@ class EmbeddedList(ButtonTab): data = pickle.dumps(value) # pass as a string (8 bits) - sel_data.set(sel_data.target, 8, data) + sel_data.set(self._DND_TYPE.atom_drag_type, 8, data) def drag_data_received(self, widget, context, x, y, sel_data, info, time): """ @@ -229,8 +237,8 @@ class EmbeddedList(ButtonTab): If the selection data is defined, extract the value from sel_data.data, and decide if this is a move or a reorder. """ - if sel_data and sel_data.data: - (mytype, selfid, obj, row_from) = pickle.loads(sel_data.data) + if sel_data and sel_data.get_data(): + (mytype, selfid, obj, row_from) = pickle.loads(sel_data.get_data()) # make sure this is the correct DND type for this object if mytype == self._DND_TYPE.drag_type: diff --git a/src/gui/editors/displaytabs/groupembeddedlist.py b/src/gui/editors/displaytabs/groupembeddedlist.py index d7a7fc054..d07c4ca20 100644 --- a/src/gui/editors/displaytabs/groupembeddedlist.py +++ b/src/gui/editors/displaytabs/groupembeddedlist.py @@ -148,7 +148,7 @@ class GroupEmbeddedList(EmbeddedList): data = pickle.dumps(value) # pass as a string (8 bits) - sel_data.set(sel_data.target, 8, data) + sel_data.set(self._DND_TYPE.atom_drag_type, 8, data) def drag_data_received(self, widget, context, x, y, sel_data, info, time): """ @@ -157,8 +157,8 @@ class GroupEmbeddedList(EmbeddedList): If the selection data is define, extract the value from sel_data.data, and decide if this is a move or a reorder. """ - if sel_data and sel_data.data: - (mytype, selfid, obj, row_from) = pickle.loads(sel_data.data) + if sel_data and sel_data.get_data(): + (mytype, selfid, obj, row_from) = pickle.loads(sel_data.get_data()) # make sure this is the correct DND type for this object if mytype == self._DND_TYPE.drag_type: diff --git a/src/gui/editors/editchildref.py b/src/gui/editors/editchildref.py index afba08325..9e22dd1dc 100644 --- a/src/gui/editors/editchildref.py +++ b/src/gui/editors/editchildref.py @@ -161,7 +161,7 @@ class EditChildRef(EditSecondary): self._setup_notebook_tabs( notebook) notebook.show_all() - self.top.get_object('vbox').pack_start(notebook,True) + self.top.get_object('vbox').pack_start(notebook, True, True, 0) def _post_init(self): self.ok_button.grab_focus() diff --git a/src/gui/glade/editchildref.glade b/src/gui/glade/editchildref.glade index 7639302e2..006bdcafa 100644 --- a/src/gui/glade/editchildref.glade +++ b/src/gui/glade/editchildref.glade @@ -73,8 +73,15 @@ - + True + True + + + True + True + + 1 diff --git a/src/plugins/tool/changetypes.glade b/src/plugins/tool/changetypes.glade index 4c9b5dcb2..135876189 100644 --- a/src/plugins/tool/changetypes.glade +++ b/src/plugins/tool/changetypes.glade @@ -76,8 +76,15 @@ - + True + True + + + True + True + + 1 @@ -89,8 +96,15 @@ - + True + True + + + True + True + + 1 diff --git a/src/plugins/tool/notrelated.glade b/src/plugins/tool/notrelated.glade index 33e5efe4a..824f0d60e 100644 --- a/src/plugins/tool/notrelated.glade +++ b/src/plugins/tool/notrelated.glade @@ -69,8 +69,15 @@ True 3 - + True + True + + + True + True + + diff --git a/src/plugins/tool/soundgen.glade b/src/plugins/tool/soundgen.glade index c7df1b64b..3c3f8677e 100644 --- a/src/plugins/tool/soundgen.glade +++ b/src/plugins/tool/soundgen.glade @@ -76,8 +76,15 @@ - + True + True + + + True + True + + 1