It's 3.30.2 release day, upload a tarball and fix that hidden pesky bug that you missed in .1 🦛

Commit 49128525 authored by Morten Welinder's avatar Morten Welinder

Introspection fixes

parent 96abc9d4
......@@ -42,7 +42,7 @@ Sheet: [GObject]
cells(range)
cells_count()
is_cell_empty(col,row)
style_apply_range(range,style)
apply_style(range,style) [1]
style_get(col,row)
props.name
props.workbook
......@@ -208,6 +208,34 @@ GnmStyle: [Boxed structure]
get_effective_text_wrap()
visible_in_blank()
GOFormat: [Boxed structure]
new_from_XL(string)
as_XL()
general
empty
default_date
default_time
default_date_time
default_percentage
default_money
default_accounting
is_invalid
is_general
is_markup
is_text
is_var_width
is_date
is_time
month_before_day
has_hour
has_minute
inc_precision
dec_precision
toggle_1000sep
Gnm (i.e., not in a class):
clipboard_copy_range(sheet,range)
......
......@@ -1783,7 +1783,7 @@ sheet_style_apply_range (Sheet *sheet, GnmRange const *range, GnmStyle *pstyle)
}
/**
* sheet_style_apply_range2: (rename-to sheet_style_apply_range)
* sheet_style_apply_range2: (skip)
* @sheet: #Sheet
* @range: #GnmRange to apply over
* @pstyle: A partial style to apply
......
......@@ -1706,7 +1706,7 @@ sheet_cell_calc_span (GnmCell *cell, GnmSpanCalcFlags flags)
}
/**
* sheet_apply_style:
* sheet_apply_style: (skip)
* @sheet: the sheet in which can be found
* @range: the range to which should be applied
* @mstyle: (transfer full): A #GnmStyle partial style
......@@ -1725,6 +1725,25 @@ sheet_apply_style (Sheet *sheet,
sheet_range_calc_spans (sheet, range, spanflags);
}
/**
* sheet_apply_style_gi: (rename-to sheet_apply_style)
* @sheet: the sheet in which can be found
* @range: the range to which should be applied
* @mstyle: A #GnmStyle partial style
*
* A mid level routine that applies the supplied partial style @style to the
* target @range and performs the necessary respanning and redrawing.
**/
void
sheet_apply_style_gi (Sheet *sheet, GnmRange const *range, GnmStyle *style)
{
GnmSpanCalcFlags spanflags = gnm_style_required_spanflags (style);
gnm_style_ref (style);
sheet_style_apply_range (sheet, range, style);
/* This also redraws the range: */
sheet_range_calc_spans (sheet, range, spanflags);
}
static void
sheet_apply_style_cb (GnmSheetRange *sr,
GnmStyle *style)
......
......@@ -389,6 +389,7 @@ SheetView *sheet_get_view (Sheet const *sheet, WorkbookView const *wbv);
// Introspection support
void sheet_cell_set_value_gi (Sheet *sheet, int col, int row, GnmValue *v);
void sheet_cell_set_text_gi (Sheet *sheet, int col, int row, char const *str);
void sheet_apply_style_gi (Sheet *sheet, GnmRange const *range, GnmStyle *style);
#define SHEET_FOREACH_VIEW(sheet, view, code) \
......
......@@ -36,10 +36,13 @@ As int:
0
1
Formatted value:
Value: 101.25 Format: 0.0000 Rendered: 101.2500
List of cells in sheet:
A1: 10 [bold]
C1: 10
A2: 101.25 [bold]
A2: 101.2500 [bold]
C2: 101.25
A3: =A1+A2
C3: =C1+C2
......
......@@ -11,9 +11,9 @@ wb = Gnm.Workbook.new_with_sheets(1)
# Get sheet. Index starts at 0
sheet = wb.sheet_by_index(0)
print("Name:", sheet.props.name)
print("Number of columns:", sheet.props.columns)
print("Number of rows:", sheet.props.rows)
print("Name: {}".format(sheet.props.name))
print("Number of columns: {}".format (sheet.props.columns))
print("Number of rows: {}".format (sheet.props.rows))
# Store values and expressions is some cells. Coordinates are (col,row)
# both starting at 0. (So what the gui sees as row 1 is 0 here.)
......@@ -40,7 +40,14 @@ st = Gnm.Style.new()
st.set_font_bold(1)
r = Gnm.Range()
r.init(0,0,0,1)
sheet.style_apply_range(r,st)
sheet.apply_style(r,st)
# Set a format for A2
st = Gnm.Style.new()
st.set_format_text("0.0000")
r = Gnm.Range()
r.init(0,1,0,1)
sheet.apply_style(r,st)
# Recalculate all cells that need it
wb.recalc()
......@@ -53,6 +60,13 @@ print("\nAs int:")
for i in range(7):
print(sheet.cell_get_value(0,i).get_as_int())
print("\nFormatted value:")
c = sheet.cell_fetch(0,1)
print("Value: {} Format: {} Rendered: {}".format (c.get_value().get_as_string(),
c.get_format().as_XL(),
c.get_rendered_text()))
print("\nList of cells in sheet:")
for c in sheet.cells(None):
st = sheet.style_get (c.pos.col,c.pos.row)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment