Gdk.Clipboard¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/en |
|||
r/w/co/en |
|||
r/en |
|||
r/en |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Emitted when the clipboard changes ownership. |
Fields¶
- Inherited:
Class Details¶
- class Gdk.Clipboard(**kwargs)¶
- Bases:
- Abstract:
No
Represents data shared between applications or inside an application.
To get a
GdkClipboardobject, use [method`Gdk`.Display.get_clipboard] or [method`Gdk`.Display.get_primary_clipboard]. You can find out about the data that is currently available in a clipboard using [method`Gdk`.Clipboard.get_formats].To make text or image data available in a clipboard, use [method`Gdk`.Clipboard.set_text] or [method`Gdk`.Clipboard.set_texture]. For other data, you can use [method`Gdk`.Clipboard.set_content], which takes a [class`Gdk`.ContentProvider] object.
To read textual or image data from a clipboard, use [method`Gdk`.Clipboard.read_text_async] or [method`Gdk`.Clipboard.read_texture_async]. For other data, use [method`Gdk`.Clipboard.read_async], which provides a
GInputStreamobject.- get_content()[source]¶
- Returns:
The content of a clipboard if the clipboard does not maintain any content
- Return type:
Returns the
GdkContentProvidercurrently set on self.If the self is empty or its contents are not owned by the current process,
Nonewill be returned.
- get_display()[source]¶
- Returns:
a
GdkDisplay- Return type:
Gets the
GdkDisplaythat the clipboard was created for.
- get_formats()[source]¶
- Returns:
The formats of the clipboard
- Return type:
Gets the formats that the clipboard can provide its current contents in.
- is_local()[source]¶
-
Returns if the clipboard is local.
A clipboard is considered local if it was last claimed by the running application.
Note that [method`Gdk`.Clipboard.get_content] may return
Noneeven on a local clipboard. In this case the clipboard is empty.
- read_async(mime_types, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters:
mime_types ([
str]) – aNone-terminated array of mime types to choose fromio_priority (
int) – the I/O priority of the requestcancellable (
Gio.CancellableorNone) – optionalGCancellableobjectcallback (
Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfieduser_data (
objectorNone) – the data to pass to callback function
Asynchronously requests an input stream to read the self's contents from.
The clipboard will choose the most suitable mime type from the given list to fulfill the request, preferring the ones listed first.
- read_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGAsyncResult- Raises:
- Returns:
a
GInputStream- out_mime_type:
location to store the chosen mime type
- Return type:
(
Gio.InputStreamorNone, out_mime_type:str)
Finishes an asynchronous clipboard read.
See [method`Gdk`.Clipboard.read_async].
- read_text_async(cancellable, callback, *user_data)[source]¶
- Parameters:
cancellable (
Gio.CancellableorNone) – optionalGCancellableobjectcallback (
Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfieduser_data (
objectorNone) – the data to pass to callback function
Asynchronously request the self contents converted to a string.
This is a simple wrapper around [method`Gdk`.Clipboard.read_value_async]. Use that function or [method`Gdk`.Clipboard.read_async] directly if you need more control over the operation.
- read_text_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGAsyncResult- Raises:
- Returns:
a new string
- Return type:
Finishes an asynchronous clipboard read.
See [method`Gdk`.Clipboard.read_text_async].
- read_texture_async(cancellable, callback, *user_data)[source]¶
- Parameters:
cancellable (
Gio.CancellableorNone) – optionalGCancellableobject,Noneto ignore.callback (
Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfieduser_data (
objectorNone) – the data to pass to callback function
Asynchronously request the self contents converted to a
GdkPixbuf.This is a simple wrapper around [method`Gdk`.Clipboard.read_value_async]. Use that function or [method`Gdk`.Clipboard.read_async] directly if you need more control over the operation.
- read_texture_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGAsyncResult- Raises:
- Returns:
a new
GdkTexture- Return type:
Gdk.TextureorNone
Finishes an asynchronous clipboard read.
See [method`Gdk`.Clipboard.read_texture_async].
- read_value_async(type, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters:
type (
GObject.GType) – aGTypeto readio_priority (
int) – the I/O priority of the requestcancellable (
Gio.CancellableorNone) – optionalGCancellableobjectcallback (
Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfieduser_data (
objectorNone) – the data to pass to callback function
Asynchronously request the self contents converted to the given type.
For local clipboard contents that are available in the given
GType, the value will be copied directly. Otherwise, GDK will try to use [func`content_deserialize_async`] to convert the clipboard’s data.
- read_value_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGAsyncResult- Raises:
- Returns:
a
GValuecontaining the result.- Return type:
Finishes an asynchronous clipboard read.
See [method`Gdk`.Clipboard.read_value_async].
- set(value)[source]¶
- Parameters:
value (
GObject.Value) – aGValueto set
Sets the self to contain the given value.
- set_content(provider)[source]¶
- Parameters:
provider (
Gdk.ContentProviderorNone) – the new contents of self orNoneto clear the clipboard- Returns:
Trueif setting the clipboard succeeded- Return type:
Sets a new content provider on self.
The clipboard will claim the
GdkDisplay’s resources and advertise these new contents to other applications.In the rare case of a failure, this function will return
False. The clipboard will then continue reporting its old contents and ignore provider.If the contents are read by either an external application or the self's read functions, self will select the best format to transfer the contents and then request that format from provider.
- store_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters:
io_priority (
int) – the I/O priority of the requestcancellable (
Gio.CancellableorNone) – optionalGCancellableobjectcallback (
Gio.AsyncReadyCallbackorNone) – callback to call when the request is satisfieduser_data (
objectorNone) – the data to pass to callback function
Asynchronously instructs the self to store its contents remotely.
If the clipboard is not local, this function does nothing but report success.
The purpose of this call is to preserve clipboard contents beyond the lifetime of an application, so this function is typically called on exit. Depending on the platform, the functionality may not be available unless a “clipboard manager” is running.
This function is called automatically when a GtkApplication is shut down, so you likely don’t need to call it.
- store_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult) – aGAsyncResult- Raises:
- Returns:
Trueif storing was successful.- Return type:
Finishes an asynchronous clipboard store.
See [method`Gdk`.Clipboard.store_async].
Signal Details¶
- Gdk.Clipboard.signals.changed(clipboard)¶
- Signal Name:
changed- Flags:
- Parameters:
clipboard (
Gdk.Clipboard) – The object which received the signal
Emitted when the clipboard changes ownership.
Property Details¶
- Gdk.Clipboard.props.content¶
- Name:
content- Type:
- Default Value:
- Flags:
The
GdkContentProviderorNoneif the clipboard is empty or contents are provided otherwise.
- Gdk.Clipboard.props.display¶
- Name:
display- Type:
- Default Value:
- Flags:
The
GdkDisplaythat the clipboard belongs to.
- Gdk.Clipboard.props.formats¶
- Name:
formats- Type:
- Default Value:
- Flags:
The possible formats that the clipboard can provide its data in.