Gnm.Style

Fields

None

Methods

class

border_fetch (line_type, color, orientation)

class

border_get_orientation (type)

class

border_get_width (line_type)

class

border_none ()

class

border_none_set_color (color)

class

border_ref (border)

class

border_set_dash (i, context)

class

border_unref (border)

class

border_visible_in_blank (border)

class

borders_row_draw (prev_vert, sr, cr, x, y1, y2, colwidths, draw_vertical, dir)

class

borders_row_print_gtk (prev_vert, sr, context, x, y1, y2, sheet, draw_vertical, dir)

class

color_auto_back ()

class

color_auto_font ()

class

color_auto_pattern ()

class

color_black ()

class

color_equal (a, b)

class

color_grid (context)

class

color_ref (sc)

class

color_unref (sc)

class

color_white ()

class

context_get_color (context, state, color)

class

hash (style)

class

hash_XL (style)

class

list_free (l)

class

list_get_style (l, col, row)

class

new ()

class

new_default ()

abandon_link ()

border_draw_diag (cr, x1, y1, x2, y2)

border_print_diag_gtk (context, x1, y1, x2, y2)

cmp (b)

default_halign (c)

dump ()

dup ()

eq (b)

equal (b)

equal_XL (b)

equal_elem (b, e)

equal_header (b, top)

find_conflicts (overlay, conflicts)

find_differences (b, relax_sheet)

generate_attrs_full ()

get_align_h ()

get_align_v ()

get_back_color ()

get_border (elem)

get_cond_style (ix)

get_conditions ()

get_contents_hidden ()

get_contents_locked ()

get_effective_wrap_text ()

get_font (context)

get_font_bold ()

get_font_color ()

get_font_italic ()

get_font_name ()

get_font_script ()

get_font_size ()

get_font_strike ()

get_font_uline ()

get_format ()

get_hlink ()

get_indent ()

get_input_msg ()

get_pango_attrs (context, zoom)

get_pango_height (context, zoom)

get_pattern ()

get_pattern_color ()

get_rotation ()

get_shrink_to_fit ()

get_text_dir ()

get_validation ()

get_wrap_text ()

is_complete ()

is_element_set (elem)

link ()

link_dependents (r)

link_sheet (sheet)

merge (overlay)

merge_element (src, elem)

new_merged (overlay)

required_spanflags ()

set_align_h (a)

set_align_v (a)

set_back_color (col)

set_border (elem, border)

set_conditions (sc)

set_contents_hidden (f)

set_contents_locked (f)

set_font_bold (bold)

set_font_color (col)

set_font_italic (italic)

set_font_name (name)

set_font_script (script)

set_font_size (size)

set_font_strike (strike)

set_font_uline (ul)

set_format (fmt)

set_format_text (fmt)

set_from_pango_attribute (attr)

set_hlink (lnk)

set_indent (i)

set_input_msg (msg)

set_pattern (pattern)

set_pattern_color (col)

set_rotation (r)

set_shrink_to_fit (f)

set_text_dir (text_dir)

set_validation (v)

set_wrap_text (f)

unlink ()

unlink_dependents (r)

unset_element (elem)

visible_in_blank ()

Details

class Gnm.Style
classmethod border_fetch(line_type, color, orientation)
Parameters:
Returns:

A Gnm.Border

Return type:

Gnm.Border

classmethod border_get_orientation(type)
Parameters:

type (Gnm.StyleBorderLocation) –

Return type:

Gnm.StyleBorderOrientation

classmethod border_get_width(line_type)
Parameters:

line_type (Gnm.StyleBorderType) –

Return type:

int

classmethod border_none()
Returns:

A Gnm.Border with no borders.

Return type:

Gnm.Border

classmethod border_none_set_color(color)
Parameters:

color (Gnm.Color) – Gnm.Color

This function updates the color of Gnm.Style.border_none when the wanted grid color is known. Gnm.Style.border_none tells how to render the grid. Because the grid color may be different for different sheets, the functions which render the grid call this function first. The rule for selecting the grid color, which is the same as in Excel, is: - if the auto pattern color is default (which is black), the grid color is gray, as returned by Gnm.Style.color_grid (). - otherwise, the auto pattern color is used for the grid.

classmethod border_ref(border)
Parameters:

border (Gnm.Border or None) – Gnm.Border

Returns:

a reference to border

Return type:

Gnm.Border or None

classmethod border_set_dash(i, context)
Parameters:
classmethod border_unref(border)
Parameters:

border (Gnm.Border or None) – Gnm.Border

classmethod border_visible_in_blank(border)
Parameters:

border (Gnm.Border) –

Return type:

bool

classmethod borders_row_draw(prev_vert, sr, cr, x, y1, y2, colwidths, draw_vertical, dir)
Parameters:

TODO : This is not the final resting place for this. It will move into the gui layer eventually.

classmethod borders_row_print_gtk(prev_vert, sr, context, x, y1, y2, sheet, draw_vertical, dir)
Parameters:
classmethod color_auto_back()
Return type:

Gnm.Color

Always white, as far as we know.

classmethod color_auto_font()
Return type:

Gnm.Color

Always black, as far as we know.

classmethod color_auto_pattern()
Return type:

Gnm.Color

Normally black, but follows grid color if so told.

classmethod color_black()
Return type:

Gnm.Color

classmethod color_equal(a, b)
Parameters:
Return type:

int

classmethod color_grid(context)
Parameters:

context (Gtk.StyleContext) –

Return type:

Gnm.Color

classmethod color_ref(sc)
Parameters:

sc (Gnm.Color) –

Return type:

Gnm.Color

classmethod color_unref(sc)
Parameters:

sc (Gnm.Color) –

classmethod color_white()
Return type:

Gnm.Color

classmethod context_get_color(context, state, color)
Parameters:
classmethod hash(style)
Parameters:

style (object or None) –

Return type:

int

classmethod hash_XL(style)
Parameters:

style (object or None) –

Return type:

int

classmethod list_free(l)
Parameters:

l ([object]) – the list to free

Free up the resources in the style list. This includes unreferencing the styles.

classmethod list_get_style(l, col, row)
Parameters:
  • l ([object]) – A style list.

  • col (int) – Column number

  • row (int) – Row number

Returns:

The style found.

Return type:

Gnm.Style or None

Attempts to find the style associated with the pos offset within the 0,0 based style list.

classmethod new()
Returns:

a new style with _no_ elements set.

Return type:

Gnm.Style

classmethod new_default()
Returns:

a new style initialized to the default state.

Return type:

Gnm.Style

border_draw_diag(cr, x1, y1, x2, y2)
Parameters:
border_print_diag_gtk(context, x1, y1, x2, y2)
Parameters:
cmp(b)
Parameters:

b (Gnm.Style) –

Return type:

int

default_halign(c)
Parameters:

c (Gnm.Cell) –

Return type:

Gnm.HAlign

Select the appropriate horizontal alignment depending on the style and cell GOffice.value.

dump()

This function dumps the given style’s contents to stderr. This is meant for debug purposes only and doesn’t do a very good job for, for example, conditional style settings.

dup()
Return type:

Gnm.Style

eq(b)
Parameters:

b (Gnm.Style) –

Return type:

bool

equal(b)
Parameters:

b (Gnm.Style) –

Return type:

bool

equal_XL(b)
Parameters:

b (Gnm.Style) –

Return type:

bool

equal_elem(b, e)
Parameters:
Returns:

True, if the two styles have the same contents for the given element, either because neither have it set, or because both have it set and to the same GOffice.value.

Return type:

bool

equal_header(b, top)
Parameters:
Return type:

bool

Check to see if self is different enough from b to make us think that self is from a header.

find_conflicts(overlay, conflicts)
Parameters:
Return type:

int

Copy any items from overlay that do not conflict with the values in self. If an element had a previous conflict (flagged via conflicts) it is ignored.

Returns conflicts with any new conflicts added.

find_differences(b, relax_sheet)
Parameters:
  • b (Gnm.Style) – A Gnm.Style

  • relax_sheet (bool) – if True, ignore differences solely caused by being linked into different sheets.

Return type:

int

Determine how two fully-qualified styles differ.

Returns differences as a bitset of Gnm.StyleElement.

generate_attrs_full()
Returns:

a Pango.AttrList with attributes matching self, even attributes where the default would have served.

Return type:

Pango.AttrList

get_align_h()
Returns:

A Gnm.HAlign

Return type:

Gnm.HAlign

get_align_v()
Returns:

A Gnm.VAlign

Return type:

Gnm.VAlign

get_back_color()
Returns:

Gnm.Color used for background.

Return type:

Gnm.Color or None

get_border(elem)
Parameters:

elem (Gnm.StyleElement) – Border element

Returns:

The Gnm.Border for a single border element.

Return type:

Gnm.Border or None

get_cond_style(ix)
Parameters:

ix (int) – The index of the condition for which style is desired

Returns:

the resulting style from applying the condition’s style overlay onto self.

Return type:

Gnm.Style

get_conditions()
Returns:

the currently set conditional style.

Return type:

Gnm.StyleConditions or None

get_contents_hidden()
Returns:

True for hidden, False for not

Return type:

bool

get_contents_locked()
Returns:

True for locked, False for not

Return type:

bool

get_effective_wrap_text()
Returns:

True for wrapping, False for not. This will be True also when either alignment is JUSTIFY.

Return type:

bool

get_font(context)
Parameters:

context (Pango.Context) – Pango.Context

Returns:

Gnm.Font implied by self.

Return type:

Gnm.Font

get_font_bold()
Returns:

True if the style has a bold Gnm.font.

Return type:

bool

get_font_color()
Returns:

Gnm.Color used for Gnm.font.

Return type:

Gnm.Color or None

get_font_italic()
Returns:

True if the style has an italic Gnm.font.

Return type:

bool

get_font_name()
Returns:

the currently set Gnm.font name

Return type:

str

get_font_script()
Returns:

GOffice.FontScript specifying super or subscript

Return type:

GOffice.FontScript

get_font_size()
Returns:

Font size in points

Return type:

float

get_font_strike()
Returns:

True for strikethrough, False for regular

Return type:

bool

get_font_uline()
Returns:

Gnm.Underline specifying type of underlining

Return type:

Gnm.Underline

get_format()
Returns:

GOffice.Format

Return type:

GOffice.Format

Returns:

the associated Gnm.HLink.

Return type:

Gnm.HLink or None

get_indent()
Returns:

Indentation amount

Return type:

int

get_input_msg()
Returns:

the currently set input message.

Return type:

Gnm.InputMsg or None

get_pango_attrs(context, zoom)
Parameters:
Return type:

Pango.AttrList

get_pango_height(context, zoom)
Parameters:
Return type:

int

get_pattern()
Return type:

int

get_pattern_color()
Returns:

Gnm.Color used for pattern.

Return type:

Gnm.Color or None

get_rotation()
Returns:

Rotation in degrees relative to horizontal

Return type:

int

get_shrink_to_fit()
Returns:

True for shrink-to-fit, False for not

Return type:

bool

get_text_dir()
Returns:

A Gnm.TextDir

Return type:

Gnm.TextDir

get_validation()
Return type:

Gnm.Validation or None

get_wrap_text()
Returns:

True for wrapping, False for not. See also Gnm.Style.get_effective_wrap_text.

Return type:

bool

is_complete()
Returns:

True if all elements are set.

Return type:

bool

is_element_set(elem)
Parameters:

elem (Gnm.StyleElement) –

Return type:

bool

Parameters:

r (Gnm.Range) –

Parameters:

sheet (Gnm.Sheet) – the new sheet

Returns:

new style which may or may not be identical to the incoming.

ABSORBS a reference to the style and sets the link GOffice.count to 1.

Where auto pattern color occurs in the style (it may for pattern and borders), it is replaced with the sheet’s auto pattern color. We make sure that we do not modify the style which was passed in to us, but also that we don’t copy more than once. The final argument to the link_xxxxx_color functions tell whether or not to copy.

Return type:

Gnm.Style

merge(overlay)
Parameters:

overlay (Gnm.Style) – Gnm.Style

Applies all active elements of overlay onto self.

merge_element(src, elem)
Parameters:

This function replaces element elem in style self with element elem in style src. (If element elem was already set in style self then the element will first be unset)

new_merged(overlay)
Parameters:

overlay (Gnm.Style) – Gnm.Style

Returns:

A ref to a new Gnm.Style.

Return type:

Gnm.Style

A new Gnm.Style that contains any elements of overlay that are set, and uses self for anything that is not set in overlay.

required_spanflags()
Return type:

Gnm.SpanCalcFlags

What changes are required after applying the supplied style.

set_align_h(a)
Parameters:

a (Gnm.HAlign) – A Gnm.HAlign

set_align_v(a)
Parameters:

a (Gnm.VAlign) – A Gnm.VAlign

set_back_color(col)
Parameters:

col (Gnm.Color) – Gnm.Color

Assigns col as the background of self.

NOTE: the background colour is only visible if Gnm.Style ::pattern > 0

set_border(elem, border)
Parameters:
set_conditions(sc)
Parameters:

sc (Gnm.StyleConditions or None) – Gnm.StyleConditions

This sets conditional style for self.

set_contents_hidden(f)
Parameters:

f (bool) – True for hidden, False for not

set_contents_locked(f)
Parameters:

f (bool) – True for locked, False for not

set_font_bold(bold)
Parameters:

bold (bool) – True for bold, False for regular

set_font_color(col)
Parameters:

col (Gnm.Color) – Gnm.Color

Set the color used for fonts.

set_font_italic(italic)
Parameters:

italic (bool) – True for italic, False for regular

set_font_name(name)
Parameters:

name (str) – the Gnm.font name as a string

set_font_script(script)
Parameters:

script (GOffice.FontScript) – GOffice.FontScript specifying super or subscript

set_font_size(size)
Parameters:

size (float) – Font size in points

set_font_strike(strike)
Parameters:

strike (bool) – True for strikethrough, False for regular

set_font_uline(ul)
Parameters:

ul (Gnm.Underline) – Gnm.Underline specifying type of underlining

set_format(fmt)
Parameters:

fmt (GOffice.Format) – GOffice.Format

set_format_text(fmt)
Parameters:

fmt (str) –

set_from_pango_attribute(attr)
Parameters:

attr (Pango.Attribute) –

Parameters:

lnk (Gnm.HLink or None) – Gnm.HLink

This sets a link for self.

set_indent(i)
Parameters:

i (int) – Indentation amount

set_input_msg(msg)
Parameters:

msg (Gnm.InputMsg or None) – Gnm.InputMsg

This sets an input message for self.

set_pattern(pattern)
Parameters:

pattern (int) – pattern code

set_pattern_color(col)
Parameters:

col (Gnm.Color) – Gnm.Color

Set the color used for pattern.

set_rotation(r)
Parameters:

r (int) – Rotation in degrees relative to horizontal

set_shrink_to_fit(f)
Parameters:

f (bool) – True for shrink-to-fit, False for not

set_text_dir(text_dir)
Parameters:

text_dir (Gnm.TextDir) – A Gnm.TextDir

set_validation(v)
Parameters:

v (Gnm.Validation or None) – Gnm.Validation

set_wrap_text(f)
Parameters:

f (bool) – True for wrapping, False for not

Parameters:

r (Gnm.Range) –

unset_element(elem)
Parameters:

elem (Gnm.StyleElement) –

visible_in_blank()
Returns:

True if the style is visible, i.e., not transparent. Specifically that means if it has a background or a visible border.

Return type:

bool