Browse Source

nviz2/wxGUI: G_unset_error_routine(), external routine for percent complete messages added (TODO: update gislib)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@32247 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 17 years ago
parent
commit
19e91f3af7
1 changed files with 17 additions and 0 deletions
  1. 17 0
      gui/wxpython/nviz/init.cpp

+ 17 - 0
gui/wxpython/nviz/init.cpp

@@ -24,6 +24,7 @@
 
 static void swap_gl();
 static int print_error(const char *, const int);
+static int print_percent(int);
 static void print_sentence (PyObject*, const int, const char *);
 static PyObject *logStream;
 static int message_id = 1;
@@ -38,6 +39,8 @@ Nviz::Nviz(PyObject *log)
     logStream = log;
 
     G_set_error_routine(&print_error);
+    // TODO
+    // G_set_percent_routine(&print_percent);
 
     GS_libinit();
     /* GVL_libinit(); TODO */
@@ -57,6 +60,10 @@ Nviz::Nviz(PyObject *log)
 */
 Nviz::~Nviz()
 {
+    G_unset_error_routine();
+    // TODO
+    // G_unset_percent_routine();
+
     G_free((void *) data);
 
     data = NULL;
@@ -210,3 +217,13 @@ void print_sentence (PyObject *pyFd, const int type, const char *msg)
 
     message_id++;
 }
+
+int print_percent(int x)
+{
+    char msg[256];
+
+    sprintf(msg, "GRASS_INFO_PERCENT: %d\n", x);
+    PyFile_WriteString(msg, logStream);
+
+    return 0;
+}