Aperture.Viewfinder

g Aperture.Viewfinder Aperture.Viewfinder Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Bin Gtk.Bin Gtk.Bin->Aperture.Viewfinder Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new ()

get_camera ()

get_detect_barcodes ()

get_state ()

set_camera (camera)

set_detect_barcodes (detect_barcodes)

start_recording_to_file (file)

stop_recording_async (cancellable, callback, *user_data)

stop_recording_finish (result)

take_picture_async (cancellable, callback, *user_data)

take_picture_finish (result)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

Properties

Inherited:

Gtk.Container (3), Gtk.Widget (39)

Name

Type

Flags

Short Description

camera

Aperture.Camera

r/w/en

The camera to use

detect-barcodes

bool

r/w/en

Whether to detect barcodes in the camera feed

state

Aperture.ViewfinderState

r

What the viewfinder is currently doing

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Short Description

barcode-detected

Emitted when a barcode is detected in the camera feed.

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Class Details

class Aperture.Viewfinder(**kwargs)
Bases:

Gtk.Bin

Abstract:

No

Structure:

Aperture.ViewfinderClass

classmethod new()
Returns:

a new Aperture.Viewfinder

Return type:

Aperture.Viewfinder

Creates a new Aperture.Viewfinder.

New in version 0.1.

get_camera()
Returns:

the current camera

Return type:

Aperture.Camera

Gets the camera that the Aperture.Viewfinder is currently using. See Aperture.Viewfinder :camera.

New in version 0.1.

get_detect_barcodes()
Returns:

True if the viewfinder is looking for barcodes, otherwise False

Return type:

bool

Gets whether the Aperture.Viewfinder is looking for barcodes in its camera feed.

New in version 0.1.

get_state()
Returns:

the viewfinder’s state

Return type:

Aperture.ViewfinderState

Gets the state of the Aperture.Viewfinder. See Aperture.Viewfinder :state.

New in version 0.1.

set_camera(camera)
Parameters:

camera (Aperture.Camera) – a camera index

Raises:

GLib.Error

Sets the camera that the Aperture.Viewfinder will use. See Aperture.Viewfinder :camera.

New in version 0.1.

set_detect_barcodes(detect_barcodes)
Parameters:

detect_barcodes (bool) – True to detect barcodes, otherwise False

Sets whether the Aperture.Viewfinder should look for barcodes in its camera feed. See Aperture.Viewfinder :detect-barcodes.

Before calling this function, use Aperture.is_barcode_detection_enabled() to make sure the barcode detection feature is enabled.

New in version 0.1.

start_recording_to_file(file)
Parameters:

file (str) – file path to save the video to

Raises:

GLib.Error

Starts recording a video. The video will be saved to file.

Call Aperture.Viewfinder.stop_recording_async() to stop recording.

New in version 0.1.

stop_recording_async(cancellable, callback, *user_data)
Parameters:

Stop recording video. callback will be called when this is complete.

New in version 0.1.

stop_recording_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult provided to callback

Raises:

GLib.Error

Returns:

True if the process succeeded, otherwise False

Return type:

bool

Finishes an operation started by Aperture.Viewfinder.stop_recording_async().

New in version 0.1.

take_picture_async(cancellable, callback, *user_data)
Parameters:

Takes a picture.

This may take a while. The resolution might be changed temporarily, autofocusing might take place, etc. Basically everything you’d expect to happen when you click the photo button in a camera app.

When the picture has been taken, callback will be called. Use Aperture.Viewfinder.take_picture_finish() to get the picture as a GdkPixbuf.Pixbuf.

New in version 0.1.

take_picture_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult provided to callback

Raises:

GLib.Error

Returns:

the image that was taken, or None if there was an error

Return type:

GdkPixbuf.Pixbuf

Finishes an operation started by Aperture.Viewfinder.take_picture_async().

New in version 0.1.

Signal Details

Aperture.Viewfinder.signals.barcode_detected(viewfinder, barcode_type, data)
Signal Name:

barcode-detected

Flags:

RUN_LAST

Parameters:

Emitted when a barcode is detected in the camera feed.

This will only be emitted if Aperture.Viewfinder :detect-barcodes is True.

Barcodes are only detected when they appear on the feed, not on every frame when they are visible.

New in version 0.1.

Property Details

Aperture.Viewfinder.props.camera
Name:

camera

Type:

Aperture.Camera

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The camera that is currently being used.

Use Aperture.DeviceManager to obtain Aperture.Camera objects.

To successfully switch cameras, the Aperture.Viewfinder must be in the Aperture.ViewfinderState.READY state. This is because switching camera sources would interrupt any picture or video that is being taken.

New in version 0.1.

Aperture.Viewfinder.props.detect_barcodes
Name:

detect-barcodes

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the Aperture.Viewfinder should detect barcodes.

When a barcode is detected, the ::barcode-detected signal will be emitted.

This only works if barcode detection is enabled. See Aperture.is_barcode_detection_enabled(). If barcode detection is not available, the value of this property will always be False, even if you try to set it to True.

New in version 0.1.

Aperture.Viewfinder.props.state
Name:

state

Type:

Aperture.ViewfinderState

Default Value:

Aperture.ViewfinderState.LOADING

Flags:

READABLE

What the viewfinder is currently doing.

The state indicates what the viewfinder is currently doing, or sometimes that an error occurred. Many operations, like taking a picture or starting a recording, require that the Aperture.Viewfinder be in the Aperture.ViewfinderState.READY state.

New in version 0.1.