[gnumeric] Introspection: add gi.overrides module for Gnm.py



commit 53bf4f808e97d14961c2d053121aaafcf090c405
Author: Morten Welinder <terra gnome org>
Date:   Thu Apr 26 20:55:48 2018 -0400

    Introspection: add gi.overrides module for Gnm.py
    
    This isn't installed yet.  It therefore won't get loaded unless the
    test .pl wrappers are used.

 Makefile.am                                  |    2 +-
 configure.ac                                 |    1 +
 introspection/.gitignore                     |    3 ++
 introspection/Makefile.am                    |    3 ++
 README-introspection => introspection/README |    3 +-
 introspection/gi/overrides/Gnm.py            |   41 ++++++++++++++++++++++++++
 introspection/gi/overrides/__init__.py       |    1 +
 test/GnumericTest.pm                         |    7 ++++-
 8 files changed, 58 insertions(+), 3 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index badcdc7..8ba3bb4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = . po po-functions src plugins icons @COMPONENT_DIR@ templates doc tools schemas test
+SUBDIRS = . po po-functions src plugins icons @COMPONENT_DIR@ templates doc tools schemas test introspection
 
 XML_I18N_XML_KIND = --pass-through
 
diff --git a/configure.ac b/configure.ac
index 78e60dc..00e0a45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1172,6 +1172,7 @@ icons/48x48/actions/Makefile
 icons/48x48/apps/Makefile
 icons/256x256/Makefile
 icons/256x256/apps/Makefile
+introspection/Makefile
 src/Makefile
 src/dialogs/Makefile
 src/widgets/Makefile
diff --git a/introspection/.gitignore b/introspection/.gitignore
new file mode 100644
index 0000000..ec52e3c
--- /dev/null
+++ b/introspection/.gitignore
@@ -0,0 +1,3 @@
+Makefile.in
+Makefile
+*~
diff --git a/introspection/Makefile.am b/introspection/Makefile.am
new file mode 100644
index 0000000..9cfedb5
--- /dev/null
+++ b/introspection/Makefile.am
@@ -0,0 +1,3 @@
+EXTRA_DIST = README                    \
+       gi/overrides/Gnm.py             \
+       gi/overrides/__init__.py
diff --git a/README-introspection b/introspection/README
similarity index 99%
rename from README-introspection
rename to introspection/README
index 49c411b..b9887d4 100644
--- a/README-introspection
+++ b/introspection/README
@@ -189,7 +189,8 @@ PasteFlags: [Enum]
   NO_RECALC
   FLIP_H
   FLIP_V
-  ALL_TYPES
+  ALL_CELL
+  ALL_SHEET
   DEFAULT
 
 
diff --git a/introspection/gi/overrides/Gnm.py b/introspection/gi/overrides/Gnm.py
new file mode 100644
index 0000000..b7f164e
--- /dev/null
+++ b/introspection/gi/overrides/Gnm.py
@@ -0,0 +1,41 @@
+from ..overrides import override
+from ..module import get_introspection_module
+
+Gnm = get_introspection_module('Gnm')
+
+__all__ = []
+
+# ----------------------------------------------------------------------------
+
+class Range(Gnm.Range):
+    def __new__(cls,start_col=0,start_row=0,end_col=None,end_row=None):
+        if end_col is None: end_col = start_col 
+        if end_row is None: end_row = start_row 
+        r = Gnm.Range.__new__(cls)
+        r.init(start_col,start_row,end_col,end_row)
+        return r
+
+    def __init__(cls,*argv):
+        pass
+
+    def __str__(self):
+        return self.as_string()
+    
+Range = override(Range)
+__all__.append('Range')
+
+# ----------------------------------------------------------------------------
+
+def _valuetype_str(vt):
+    return vt.value_name
+
+Gnm.ValueType.__str__ = _valuetype_str
+
+class Value(Gnm.Value):
+    def __str__(self):
+        return self.type_of().value_name + ":" + self.get_as_string()
+
+Value = override(Value)
+__all__.append('Value')
+
+# ----------------------------------------------------------------------------
diff --git a/introspection/gi/overrides/__init__.py b/introspection/gi/overrides/__init__.py
new file mode 100644
index 0000000..08fa199
--- /dev/null
+++ b/introspection/gi/overrides/__init__.py
@@ -0,0 +1 @@
+# Nothing to see here
diff --git a/test/GnumericTest.pm b/test/GnumericTest.pm
index 3cd3d8c..ba33fa2 100644
--- a/test/GnumericTest.pm
+++ b/test/GnumericTest.pm
@@ -275,9 +275,9 @@ sub test_command {
     print STDERR "# $cmd\n" if $verbose;
     my $output = `$cmd 2>&1`;
     my $err = $?;
+    &dump_indented ($output);
     die "Failed command: $cmd\n" if $err;
 
-    &dump_indented ($output);
     local $_ = $output;
     if (&$test ($output)) {
        print STDERR "Pass\n";
@@ -900,6 +900,11 @@ sub setup_python_environment {
     $v = 'LD_LIBRARY_PATH';
     $dir = "$top_builddir/src/.libs";
     $ENV{$v} = ($ENV{$v} || '') eq '' ? $dir : $dir . ':' . $ENV{$v};
+
+    $ENV{'PYTHONPATH'} = "$topsrc/introspection";
+    
+    # Don't litter
+    $ENV{'PYTHONDONTWRITEBYTECODE'} = 1;
 }
 
 # -----------------------------------------------------------------------------


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]