Name
gtk.SelectionData — an object that stores information about a
selection
Description
A gtk.SelectionData
object is used to store information about a chunk of data associated with a
selection. In PyGTK the selection data is always a string so the application
will have to provide functions to convert the data to and from a string to
support data types other than strings and targets. The string and targets
types are directly supported using the set_text(),
get_text()
and get_targets()
methods.
Methods
gtk.SelectionData.set
def set(type, format, data)
|
type : | a gtk.gdk.Atom or string
that specifies a gtk.gdk.Atom |
format : | the number of bits in a
unit |
data : | a string containing the
data |
The set() method sets the data for a
selection in the gtk.SelectionData
object. data is a string containing the data to be
set; format is the number of bits in a unit of the
data (e.g. integer data has a format of 32 on most systems; string data
format is 8); and, type is a gtk.gdk.Atom or a
string that specifies a gtk.gdk.Atom.
gtk.SelectionData.set_text
str : | a string |
len : | the length of str, or -1
if str for the full length. |
Returns : | TRUE, if the selection was
successfully set; otherwise, FALSE. |
The set_text() method sets the contents
of the selection from the string specified by str.
The string is converted to the form specified by the
selection_data.target attribute. This method returns TRUE
if the selection data was successfully set.
gtk.SelectionData.get_text
Returns : | a string containing the converted text, or
None. |
The get_text() method returns the
contents of the selection data as a string.
gtk.SelectionData.get_targets
Returns : | a tuple containing a list of targets (gtk.gdk.Atoms) or
None if no valid targets are
available. |
The get_targets() method returns a
tuple containing a list of valid targets for the selection as a list of
gtk.gdk.Atoms or
None if there are no valid targets.
gtk.SelectionData.targets_include_text
def targets_include_text()
|
Returns : | TRUE if the selection data
holds a list of targets, and a suitable target for text is
included. |
The targets_include_text() method
returns TRUE if any of the selection data targets can be
used to provide text.
gtk.SelectionData.tree_set_row_drag_data
def tree_set_row_drag_data(tree_model, path)
|
The tree_set_row_drag_data() method
sets the selection data of target type GTK_TREE_MODEL_ROW
for the row (specified by path) in the gtk.TreeModel
(specified by tree_model). Normally used in a "drag-data-get" signal
handler.
gtk.SelectionData.tree_get_row_drag_data
def tree_get_row_drag_data()
|
The tree_get_row_drag_data() method
returns a tuple containing a gtk.TreeModel and
a row from that gtk.TreeModel
from selection data of target type GTK_TREE_MODEL_ROW.
Normally called from a "drag-data-received"
signal handler. This method can only be used if the selection data
originates from the same process that's calling this method, because a
pointer to the tree model is being passed around. In the "drag-data-received"
signal handler, you can assume that selection data of type
"GTK_TREE_MODEL_ROW" is from the current process.
Functions
gtk.selection_owner_set_for_display
def gtk.selection_owner_set_for_display(display, widget, selection, time=0)
|
display : | the gtk.gdk.Display
where the selection is set |
widget : | the new selection owner (a gtk.Widget),
or None. |
selection : | a gtk.gdk.Atom
or string representing a selection target |
time : | the timestamp used to claim the
selection |
Returns : | TRUE if the operation
succeeded |
The gtk.selection_owner_set_for_display()
function claims ownership of the selection specified by
selection for the widget specified by
widget on the gtk.gdk.Display
specified by display. If
widget is None, the ownership of
the selection is released.