def _do_munge_raw_selection_to_wire(self, type, format, data): if format == 32 and type in ("ATOM", "ATOM_PAIR"): # Convert to strings and send that. Bizarrely, the atoms are # not actual X atoms, but an array of GdkAtom's reinterpreted # as a byte buffer. atoms = gdk_atom_objects_from_gdk_atom_array(data) return ("atoms", [str(atom) for atom in atoms]) return ClipboardProtocolHelperBase._do_munge_raw_selection_to_wire(self, type, format, data)
def _do_munge_raw_selection_to_wire(self, target, ype, format, data): if format == 32 and type in ("ATOM", "ATOM_PAIR"): # Convert to strings and send that. Bizarrely, the atoms are # not actual X atoms, but an array of GdkAtom's reinterpreted # as a byte buffer. atoms = gdk_atom_objects_from_gdk_atom_array(data) atom_names = [str(atom) for atom in atoms] if target=="TARGET": atom_names.remove("SAVE_TARGETS") atom_names.remove("COMPOUND_TEXT") return ("atoms", atom_names) return ClipboardProtocolHelperBase._do_munge_raw_selection_to_wire(self, target, type, format, data)
def _do_munge_raw_selection_to_wire(self, type, format, data): if format == 32: if type in ("ATOM", "ATOM_PAIR"): # Convert to strings and send that. Bizarrely, the atoms are # not actual X atoms, but an array of GdkAtom's reinterpreted # as a byte buffer. atoms = gdk_atom_objects_from_gdk_atom_array(data) return ("atoms", [str(atom) for atom in atoms]) else: sizeof_long = struct.calcsize("@L") format = "@" + "L" * (len(data) // sizeof_long) ints = struct.unpack(format, data) return ("integers", ints) return ClipboardProtocolHelperBase._do_munge_raw_selection_to_wire(self, type, format, data)
def _do_munge_raw_selection_to_wire(self, target, datatype, dataformat, data): if dataformat == 32 and datatype in ("ATOM", "ATOM_PAIR"): debug("_do_munge_raw_selection_to_wire(%s, %s, %s, %s:%s:%s) using gdk atom code", target, datatype, dataformat, type(data), len(data), list(data)) # Convert to strings and send that. Bizarrely, the atoms are # not actual X atoms, but an array of GdkAtom's reinterpreted # as a byte buffer. atoms = gdk_atom_objects_from_gdk_atom_array(data) debug("_do_munge_raw_selection_to_wire(%s, %s, %s, %s:%s) atoms=%s", target, datatype, dataformat, type(data), len(data), list(atoms)) atom_names = [str(atom) for atom in atoms] debug("_do_munge_raw_selection_to_wire(%s, %s, %s, %s:%s) atom_names=%s", target, datatype, dataformat, type(data), len(data), atom_names) if target=="TARGETS": atom_names = self._filter_targets(atom_names) return "atoms", atom_names return ClipboardProtocolHelperBase._do_munge_raw_selection_to_wire(self, target, datatype, dataformat, data)
def _do_munge_raw_selection_to_wire(self, target, dtype, dformat, data): if dformat == 32 and dtype in ("ATOM", "ATOM_PAIR"): # Convert to strings and send that. Bizarrely, the atoms are # not actual X atoms, but an array of GdkAtom's reinterpreted # as a byte buffer. atoms = gdk_atom_objects_from_gdk_atom_array(data) atom_names = [str(atom) for atom in atoms] if target=="TARGETS": otargets = list(atom_names) discard_targets = ("SAVE_TARGETS", "COMPOUND_TEXT") for x in discard_targets: if x in atom_names: atom_names.remove(x) debug("_do_munge_raw_selection_to_wire(%s, %s, %s, %s:%s) filtered targets(%s)=%s", target, dtype, dformat, type(data), len(data), otargets, atom_names) return ("atoms", atom_names) return ClipboardProtocolHelperBase._do_munge_raw_selection_to_wire(self, target, dtype, dformat, data)
def _do_munge_raw_selection_to_wire(self, target, dtype, dformat, data): if dformat == 32 and dtype in ("ATOM", "ATOM_PAIR"): # Convert to strings and send that. Bizarrely, the atoms are # not actual X atoms, but an array of GdkAtom's reinterpreted # as a byte buffer. atoms = gdk_atom_objects_from_gdk_atom_array(data) atom_names = [str(atom) for atom in atoms] if target == "TARGETS": otargets = list(atom_names) discard_targets = ("SAVE_TARGETS", "COMPOUND_TEXT") for x in discard_targets: if x in atom_names: atom_names.remove(x) debug( "_do_munge_raw_selection_to_wire(%s, %s, %s, %s:%s) filtered targets(%s)=%s", target, dtype, dformat, type(data), len(data), otargets, atom_names) return ("atoms", atom_names) return ClipboardProtocolHelperBase._do_munge_raw_selection_to_wire( self, target, dtype, dformat, data)