[gnumeric] Introspection: add col/row manipulations
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Introspection: add col/row manipulations
- Date: Sun, 15 Apr 2018 17:13:37 +0000 (UTC)
commit d29fccd72ca1d1cbf48a2b6d180d421daf81e23a
Author: Morten Welinder <terra gnome org>
Date: Sun Apr 15 13:13:10 2018 -0400
Introspection: add col/row manipulations
README-introspection | 11 ++++++++++-
src/sheet.c | 22 ++++++++++++++++++++--
test/t3001-introspection-simple.py | 4 ++++
3 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/README-introspection b/README-introspection
index 9d39f3f..34bed27 100644
--- a/README-introspection
+++ b/README-introspection
@@ -17,7 +17,6 @@ be useful in this setting and actually work.
This is incomplete. In particular, I'll have to look at
* Expressions other than via text
* Installing a gi override module for more pythony structure handling
-* Column/Row size manipulation
-----------------------------------------------------------------------------
Note: the Python version of type names excludes the Gnm prefix.
@@ -59,6 +58,16 @@ Sheet: [GObject]
is_cell_empty(col,row)
apply_style(range,style) [1]
style_get(col,row)
+ col_is_hidden(col)
+ row_is_hidden(row)
+ col_get_info(col)
+ row_get_info(row)
+ col_set_size_pts(col,pts)
+ row_set_size_pts(row,pts)
+ col_set_size_pixels(col,pix)
+ row_set_size_pixels(row,pix)
+ col_size_fit_pixels(col,startrow,endrow,ignorestrings)
+ row_size_fit_pixels(row,startcol,endcol,ignorestrings)
props.name
props.workbook
props.rtl
diff --git a/src/sheet.c b/src/sheet.c
index 262548e..898ade4 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -3830,8 +3830,10 @@ sheet_colrow_get (Sheet const *sheet, int colrow, gboolean is_cols)
/**
* sheet_col_fetch:
+ * @col: column number
*
- * Returns an allocated column: either an existing one, or a fresh copy
+ * Returns: (transfer none): The #ColRowInfo for column @col. This result
+ * will not be the default #ColRowInfo and may be changed.
*/
ColRowInfo *
sheet_col_fetch (Sheet *sheet, int pos)
@@ -3844,8 +3846,10 @@ sheet_col_fetch (Sheet *sheet, int pos)
/**
* sheet_row_fetch:
+ * @row: row number
*
- * Returns an allocated row: either an existing one, or a fresh copy
+ * Returns: (transfer none): The #ColRowInfo for row @row. This result
+ * will not be the default #ColRowInfo and may be changed.
*/
ColRowInfo *
sheet_row_fetch (Sheet *sheet, int pos)
@@ -3864,6 +3868,13 @@ sheet_colrow_fetch (Sheet *sheet, int colrow, gboolean is_cols)
return sheet_row_fetch (sheet, colrow);
}
+/**
+ * sheet_col_get_info:
+ * @col: column number
+ *
+ * Returns: (transfer none): The #ColRowInfo for column @col. The may be
+ * the default #ColRowInfo for columns and should not be changed.
+ */
ColRowInfo const *
sheet_col_get_info (Sheet const *sheet, int col)
{
@@ -3874,6 +3885,13 @@ sheet_col_get_info (Sheet const *sheet, int col)
return &sheet->cols.default_style;
}
+/**
+ * sheet_row_get_info:
+ * @row: column number
+ *
+ * Returns: (transfer none): The #ColRowInfo for row @row. The may be
+ * the default #ColRowInfo for rows and should not be changed.
+ */
ColRowInfo const *
sheet_row_get_info (Sheet const *sheet, int row)
{
diff --git a/test/t3001-introspection-simple.py b/test/t3001-introspection-simple.py
index d2e4f90..dccefbf 100755
--- a/test/t3001-introspection-simple.py
+++ b/test/t3001-introspection-simple.py
@@ -60,6 +60,10 @@ sheet.apply_style(r,st)
# Recalculate all cells that need it
wb.recalc()
+# Resize column A to fit values in it
+pixels = sheet.col_size_fit_pixels(0,0,sheet.props.rows-1,1)
+sheet.col_set_size_pixels(0,pixels)
+
print("\nAs string:")
for i in range(7):
print(sheet.cell_get_value(0,i).get_as_string())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]