GimpUi.SizeEntry¶
- Subclasses:
 None
Methods¶
- Inherited:
 Gtk.Grid (21), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2)
- Structs:
 Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)
class  | 
  | 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
Properties¶
- Inherited:
 Gtk.Grid (5), Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)
Child Properties¶
- Inherited:
 
Style Properties¶
- Inherited:
 
Signals¶
- Inherited:
 
Name  | 
Short Description  | 
|---|---|
Fields¶
- Inherited:
 
Class Details¶
- class GimpUi.SizeEntry(**kwargs)¶
 - Bases:
 - Abstract:
 No
- Structure:
 
This widget is used to enter pixel distances/sizes and resolutions.
You can specify the number of fields the widget should provide. For each field automatic mappings are performed between the field’s “reference value” and its “value”.
There is a
GimpUi.UnitComboBoxright of the entry fields which lets you specify theGimp.Unitof the displayed values.For each field, there can be one or two
Gtk.SpinButton's to enter “value” and “reference value”. If you specify show_refval asFalseinGimpUi.SizeEntry.new() there will be only oneGtk.SpinButtonand theGimpUi.UnitComboBoxwill contain an item for selectingGimp.UnitID.PIXEL.The “reference value” is either of
Gimp.UnitID.PIXELor dpi, depending on whichGimpUi.SizeEntryUpdatePolicyyou specify inGimpUi.SizeEntry.new(). The “value” is either the size in pixels mapped to the size in a real-world-unit (seeGimp.Unit) or the dpi value mapped to pixels per real-world-unit.- classmethod new(number_of_fields, unit, unit_format, menu_show_pixels, menu_show_percent, show_refval, spinbutton_width, update_policy)¶
 - Parameters:
 number_of_fields (
int) – The number of input fields.unit (
Gimp.Unit) – The initial unit.unit_format (
str) – A printf-like unit-format string as is used with gimp_unit_menu_new().menu_show_pixels (
bool) –Trueif the unit menu should contain an item forGimp.UnitID.PIXEL(ignored if the update_policy is notGimpUi.SizeEntryUpdatePolicy.NONE).menu_show_percent (
bool) –Trueif the unit menu should contain an item forGimp.UnitID.PERCENT.show_refval (
bool) –Trueif you want an extra “reference value” spinbutton per input field.spinbutton_width (
int) – The minimal horizontal size of theGtk.SpinButton's.update_policy (
GimpUi.SizeEntryUpdatePolicy) – How the automatic pixel <-> real-world-unit calculations should be done.
- Returns:
 A Pointer to the new
GimpUi.SizeEntrywidget.- Return type:
 
Creates a new
GimpUi.SizeEntrywidget.To have all automatic calculations performed correctly, set up the widget in the following order:
(for each additional input field)
GimpUi.SizeEntry.add_field()For each input field:
GimpUi.SizeEntry.set_resolution()GimpUi.SizeEntry.set_refval_boundaries() (orGimpUi.SizeEntry.set_value_boundaries())GimpUi.SizeEntry.set_refval() (orGimpUi.SizeEntry.set_value())The
GimpUi.SizeEntryis derived fromGtk.Gridand will have an empty border of one cell width on each side plus an empty column left of theGimpUi.UnitComboBoxto allow the caller to add labels or aGimpUi.ChainButton.
- add_field(value_spinbutton, refval_spinbutton)¶
 - Parameters:
 value_spinbutton (
Gtk.SpinButton) – The spinbutton to display the field’s value.refval_spinbutton (
Gtk.SpinButtonorNone) – The spinbutton to display the field’s reference value.
Adds an input field to the
GimpUi.SizeEntry.The new input field will have the index 0. If you specified show_refval as
TrueinGimpUi.SizeEntry.new() you have to pass an additionalGtk.SpinButtonto hold the reference value. If show_refval wasFalse, refval_spinbutton will be ignored.
- attach_label(text, row, column, alignment)¶
 - Parameters:
 - Returns:
 A pointer to the new
Gtk.Labelwidget.- Return type:
 
Attaches a
Gtk.Labelto theGimpUi.SizeEntry(which is aGtk.Grid).
- get_help_widget(field)¶
 - Parameters:
 field (
int) – the index of the widget you want to get a pointer to- Returns:
 a
Gtk.Widgetpointer that you can attach a tooltip to.- Return type:
 
You shouldn’t fiddle with the internals of a
GimpUi.SizeEntrybut if you want to set tooltips usingGimpUi.help_set_help_data() you can use this function to get a pointer to the spinbuttons.
- get_refval(field)¶
 - Parameters:
 field (
int) – The index of the field you want to know the reference value of.- Returns:
 The reference value of the chosen field.
- Return type:
 
Returns the reference value for field # field of the
GimpUi.SizeEntry.The reference value is either a distance in pixels or a resolution in dpi, depending on which
GimpUi.SizeEntryUpdatePolicyyou chose inGimpUi.SizeEntry.new().
- get_unit()¶
 - Returns:
 The sizeentry’s unit.
- Return type:
 
Returns the
Gimp.Unitthe user has selected in theGimpUi.SizeEntry'sGimpUi.UnitComboBox.
- get_unit_combo()¶
 - Returns:
 the size entry’s
GimpUi.UnitComboBox.- Return type:
 
- get_update_policy()¶
 - Return type:
 
- get_value(field)¶
 - Parameters:
 field (
int) – The index of the field you want to know the value of.- Returns:
 The value of the chosen field.
- Return type:
 
Returns the value of field # field of the
GimpUi.SizeEntry.The value returned is a distance or resolution in the
Gimp.Unitthe user has selected in theGimpUi.SizeEntry'sGimpUi.UnitComboBox.NOTE: In most cases you won’t be interested in this value because the
GimpUi.SizeEntry's purpose is to shield the programmer from unit calculations. UseGimpUi.SizeEntry.get_refval() instead.
- grab_focus()¶
 This function is rather ugly and just a workaround for the fact that it’s impossible to implement
Gtk.Widget.grab_focus() for aGtk.Grid(is this actually true after the Table->Grid conversion?).
- set_activates_default(setting)¶
 - 
Iterates over all entries in the
GimpUi.SizeEntryand callsGtk.Entry.set_activates_default() on them.New in version 2.4.
 
- set_pixel_digits(digits)¶
 - Parameters:
 digits (
int) – the number of digits to display for a pixel size
This function allows you set up a
GimpUi.SizeEntryso that sub-pixel sizes can be entered.
- set_refval(field, refval)¶
 - Parameters:
 
Sets the reference value for field # field of the
GimpUi.SizeEntry.The refval passed is either a distance in pixels or a resolution in dpi, depending on which
GimpUi.SizeEntryUpdatePolicyyou chose inGimpUi.SizeEntry.new().
- set_refval_boundaries(field, lower, upper)¶
 - Parameters:
 
Limits the range of possible reference values which can be entered in field # field of the
GimpUi.SizeEntry.The current reference value of the field will be clamped to fit in the field's new boundaries.
- set_refval_digits(field, digits)¶
 - Parameters:
 field (
int) – The index of the field you want to set the reference value for.digits (
int) – The new number of decimal digits for theGtk.SpinButtonwhich displays field's reference value.
Sets the decimal digits of field # field of the
GimpUi.SizeEntryto digits.If you don’t specify this value explicitly, the reference value’s number of digits will equal to 0 for
GimpUi.SizeEntryUpdatePolicy.SIZEand to 2 forGimpUi.SizeEntryUpdatePolicy.RESOLUTION.
- set_resolution(field, resolution, keep_size)¶
 - Parameters:
 
Sets the resolution (in dpi) for field # field of the
GimpUi.SizeEntry.The resolution passed will be clamped to fit in [
Gimp.MIN_RESOLUTION..:obj:Gimp.MAX_RESOLUTION].This function does nothing if the
GimpUi.SizeEntryUpdatePolicyspecified inGimpUi.SizeEntry.new() doesn’t equal toGimpUi.SizeEntryUpdatePolicy.SIZE.
- set_size(field, lower, upper)¶
 - Parameters:
 
Sets the pixel values for field # field of the
GimpUi.SizeEntrywhich will be treated as 0% and 100%.These values will be used if you specified menu_show_percent as
TrueinGimpUi.SizeEntry.new() and the user has selectedGimp.UnitID.PERCENTin theGimpUi.SizeEntry'sGimpUi.UnitComboBox.This function does nothing if the
GimpUi.SizeEntryUpdatePolicyspecified inGimpUi.SizeEntry.new() doesn’t equal toGimpUi.SizeEntryUpdatePolicy.SIZE.
- set_unit(unit)¶
 - Parameters:
 unit (
Gimp.Unit) – The new unit.
Sets the
GimpUi.SizeEntry's unit. The reference value for all fields will stay the same but the value in units or pixels per unit will change according to whichGimpUi.SizeEntryUpdatePolicyyou chose inGimpUi.SizeEntry.new().
- set_value(field, value)¶
 - Parameters:
 
Sets the value for field # field of the
GimpUi.SizeEntry.The value passed is treated to be a distance or resolution in the
Gimp.Unitthe user has selected in theGimpUi.SizeEntry'sGimpUi.UnitComboBox.NOTE: In most cases you won’t be interested in this value because the
GimpUi.SizeEntry's purpose is to shield the programmer from unit calculations. UseGimpUi.SizeEntry.set_refval() instead.
- set_value_boundaries(field, lower, upper)¶
 - Parameters:
 
Limits the range of possible values which can be entered in field # field of the
GimpUi.SizeEntry.The current value of the field will be clamped to fit in the field's new boundaries.
NOTE: In most cases you won’t be interested in this function because the
GimpUi.SizeEntry's purpose is to shield the programmer from unit calculations. UseGimpUi.SizeEntry.set_refval_boundaries() instead. Whatever you do, don’t mix these calls. A size entry should either be clamped by the value or the reference value.
Signal Details¶
- GimpUi.SizeEntry.signals.refval_changed(size_entry)¶
 - Signal Name:
 refval-changed- Flags:
 - Parameters:
 size_entry (
GimpUi.SizeEntry) – The object which received the signal
- GimpUi.SizeEntry.signals.unit_changed(size_entry)¶
 - Signal Name:
 unit-changed- Flags:
 - Parameters:
 size_entry (
GimpUi.SizeEntry) – The object which received the signal
- GimpUi.SizeEntry.signals.value_changed(size_entry)¶
 - Signal Name:
 value-changed- Flags:
 - Parameters:
 size_entry (
GimpUi.SizeEntry) – The object which received the signal