GnomeQRGtk.Widget

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned GnomeQRGtk.Widget GnomeQRGtk.Widget Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->GnomeQRGtk.Widget

Subclasses:

None

Methods

Inherited:

Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (18), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (text)

get_alternative_text ()

get_ecc_level ()

get_size ()

get_text ()

set_alternative_text (alternative_text)

set_ecc_level (ecc)

set_size (size)

set_text (text)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (7), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (35), Gtk.Accessible (1)

Name

Type

Flags

Short Description

alternative-text

str

r/w/c/en

ecc-level

GnomeQR.EccLevel

r/w/c/en

size

int

r/w/c/en

text

str

r/w/c/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

changed

Emitted when the QR code texture has been regenerated.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class GnomeQRGtk.Widget(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

GnomeQRGtk.WidgetClass

The GnomeQrWidget widget displays a rendered QR Code.

CSS nodes

GnomeQrWidget has a single CSS node with the name gnome-qr-code. It can be themed using the color and background-color properties.

Accessibility

GnomeQrWidget uses the GTK_ACCESSIBLE_ROLE_IMG role.

classmethod new(text)
Parameters:

text (str or None) – the text to encode in the QR code

Returns:

a new GnomeQRGtk.Widget

Return type:

Gtk.Widget

Creates a new GnomeQRGtk.Widget.

get_alternative_text()
Returns:

the alternative textual description of self.

Return type:

str or None

Gets the alternative textual description of the QR code.

The returned string will be None if the qr code cannot be described textually.

get_ecc_level()
Returns:

the error correction level

Return type:

GnomeQR.EccLevel

Gets the current error correction level of the QR code.

get_size()
Returns:

the size in pixels

Return type:

int

Gets the current natural size of the widget.

get_text()
Returns:

the text being encoded, or None if none is set

Return type:

str or None

Gets the text currently encoded in the QR code.

set_alternative_text(alternative_text)
Parameters:

alternative_text (str or None) – the alternative text description for the QR code

Sets an alternative textual description for the QR Code contents.

It is equivalent to the “alt” attribute for images on websites.

This text will be made available to accessibility tools.

If the QR code cannot be described textually, set this property to None.

By default, this is set to “QR Code”.

set_ecc_level(ecc)
Parameters:

ecc (GnomeQR.EccLevel) – the error correction level

Sets the error correction level for the QR code.

Higher error correction levels provide better recovery from damage or obscured areas, but result in larger QR codes with more modules.

set_size(size)
Parameters:

size (int) – the size in pixels for the widget’s natural and minimum size

Sets the natural and minimum size (width and height) of the widget.

The QR code will be rendered to fit within this size while maintaining its aspect ratio (square).

If the size is smaller than the minimum size of the QR code, it will be ignored and the QR code will be rendered at its minimum size (1 pixel per block).

set_text(text)
Parameters:

text (str or None) – the text to encode in the QR code

Sets the text to be encoded in the QR code.

If text is None or empty, the QR code will not be displayed.

Signal Details

GnomeQRGtk.Widget.signals.changed(widget)
Signal Name:

changed

Flags:

RUN_FIRST

Parameters:

widget (GnomeQRGtk.Widget) – The object which received the signal

Emitted when the QR code texture has been regenerated.

This signal is emitted after the widget’s text or error correction level changes and the new QR code has been successfully generated.

Property Details

GnomeQRGtk.Widget.props.alternative_text
Name:

alternative-text

Type:

str

Default Value:

'QR Code'

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

GnomeQRGtk.Widget.props.ecc_level
Name:

ecc-level

Type:

GnomeQR.EccLevel

Default Value:

GnomeQR.EccLevel.MEDIUM

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

GnomeQRGtk.Widget.props.size
Name:

size

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

GnomeQRGtk.Widget.props.text
Name:

text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY