gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Apr 25 17:19:37 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/31daba15 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fee8bb3b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/62f157d2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4cca84bb (commit)
	 via  https://github.com/Gnucash/gnucash/commit/00cc5785 (commit)
	from  https://github.com/Gnucash/gnucash/commit/d7a2fa72 (commit)



commit 31daba151c59c7d9aa1b9edbd3c31573fcc46120
Merge: fee8bb3b2 62f157d23
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Apr 25 14:17:28 2020 -0700

    Merge Jean Laroche's '797670_Xtran_editor_crash' into maint.
    
    https://github.com/Gnucash/gnucash/pull/686


commit fee8bb3b2d535e84e6fe2673470428bb5b9fddc6
Merge: d7a2fa72e 00cc57851
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Apr 25 14:13:52 2020 -0700

    Merge Christoph Holtermann's 'python-shell-output-improved' into maint.
    
    https://github.com/Gnucash/gnucash/pull/702

diff --cc gnucash/python/init.py
index 6dabdc6ce,db252b934..bfc319ad5
--- a/gnucash/python/init.py
+++ b/gnucash/python/init.py
@@@ -19,15 -24,17 +23,18 @@@ import pycons.console as con
  # Restore the SIGTTOU handler
  signal.signal(signal.SIGTTOU, old_sigttou)
  
+ # output debug information if gnucash has been started with
+ # gnucash --debug --extra
  if gnc_prefs_is_extra_enabled() and gnc_prefs_is_debugging_enabled():
-     print("Hello from python!")
-     print("test", sys.modules.keys())
+     print("Hello from python!\n")
+     print("sys.modules.keys(): ", sys.modules.keys(), "\n")
+     print("dir(_sw_app_utils): ", dir(_sw_app_utils), "\n")
  
 -   #root = _sw_app_utils.gnc_get_current_root_account()
 +    #session = app_utils.gnc_get_current_session()
 +    #root account can later on be accessed by session.get_book().get_root_account()
  
     #print("test", dir(root), root.__class__)
-     print("test3", dir(gnucash_core_c))
+     print("dir(gnucash_core_c): ", dir(gnucash_core_c))
  
     #acct = Account(instance = root)
  

commit 62f157d2385314798f544396d4beabb263131245
Author: jean <you at example.com>
Date:   Sat Apr 18 10:28:34 2020 -0700

    Added same code to transaction matcher

diff --git a/gnucash/gnome/dialog-sx-editor.c b/gnucash/gnome/dialog-sx-editor.c
index eb559ab1e..ff6704cae 100644
--- a/gnucash/gnome/dialog-sx-editor.c
+++ b/gnucash/gnome/dialog-sx-editor.c
@@ -1124,7 +1124,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent,
     GtkBuilder *builder;
     GtkWidget *button;
     int i;
-    gint id;
+    int id;
     GList *dlgExists = NULL;
 
     static struct widgetSignalCallback
@@ -1211,11 +1211,11 @@ gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent,
     }
 
     id = gnc_register_gui_component( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
-                                NULL, /* no refresh handler */
-                                sxed_close_handler,
-                                sxed );
+                                     NULL, /* no refresh handler */
+                                     sxed_close_handler,
+                                     sxed );
     // This ensure this dialog is closed when the session is closed.
-    gnc_gui_component_set_session (id,gnc_get_current_session());
+    gnc_gui_component_set_session (id, gnc_get_current_session());
 
     g_signal_connect( sxed->dialog, "delete_event",
                       G_CALLBACK(sxed_delete_event), sxed );
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 16aca2779..8851da8b2 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -51,9 +51,10 @@
 #include "import-pending-matches.h"
 #include "gnc-component-manager.h"
 #include "guid.h"
+#include "gnc-session.h"
 
 #define GNC_PREFS_GROUP "dialogs.import.generic.transaction-list"
-
+#define IMPORT_MAIN_MATCHER_CM_CLASS "transaction-matcher-dialog"
 
 struct _main_matcher_info
 {
@@ -923,6 +924,7 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
     GtkStyleContext *stylectxt;
     GdkRGBA color;
     GtkWidget *button;
+    gint id;
 
     info = g_new0 (GNCImportMainMatcher, 1);
     info->pending_matches = gnc_import_PendingMatches_new();
@@ -977,7 +979,14 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
     gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, info);
 
     g_object_unref (G_OBJECT(builder));
-
+    
+    // Register this UI, it needs to be closed when the session is closed.
+    id = gnc_register_gui_component (IMPORT_MAIN_MATCHER_CM_CLASS,
+                                    NULL, /* no refresh handler */
+                                    (GNCComponentCloseHandler)gnc_gen_trans_list_delete,
+                                    info);
+    // This ensure this dialog is closed when the session is closed.
+    gnc_gui_component_set_session (id, gnc_get_current_session());
     return info;
 }
 

commit 4cca84bb32839a0a02dbdcbfeaba5a9221ebccf0
Author: jean <you at example.com>
Date:   Sat Apr 18 10:28:07 2020 -0700

    Bug 797670 - scheduled transaction editor can remain open when switching file, which causes seg fault when later closed

diff --git a/gnucash/gnome/dialog-sx-editor.c b/gnucash/gnome/dialog-sx-editor.c
index 2f2c7c439..eb559ab1e 100644
--- a/gnucash/gnome/dialog-sx-editor.c
+++ b/gnucash/gnome/dialog-sx-editor.c
@@ -62,6 +62,7 @@
 #include "gnc-ui.h"
 #include "gnc-ui-util.h"
 #include "gnucash-sheet.h"
+#include "gnc-session.h"
 
 #include "gnc-split-reg.h"
 
@@ -1123,6 +1124,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent,
     GtkBuilder *builder;
     GtkWidget *button;
     int i;
+    gint id;
     GList *dlgExists = NULL;
 
     static struct widgetSignalCallback
@@ -1208,10 +1210,12 @@ gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent,
                             TRUE, TRUE, 0 );
     }
 
-    gnc_register_gui_component( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
+    id = gnc_register_gui_component( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
                                 NULL, /* no refresh handler */
                                 sxed_close_handler,
                                 sxed );
+    // This ensure this dialog is closed when the session is closed.
+    gnc_gui_component_set_session (id,gnc_get_current_session());
 
     g_signal_connect( sxed->dialog, "delete_event",
                       G_CALLBACK(sxed_delete_event), sxed );

commit 00cc578511166aba64d54fc7964c59bb52bf3429
Author: c-holtermann <mail at c-holtermann.net>
Date:   Mon Apr 20 20:31:59 2020 +0200

    improve output and explain code for python shell

diff --git a/gnucash/python/init.py b/gnucash/python/init.py
index bd8e383dd..db252b934 100644
--- a/gnucash/python/init.py
+++ b/gnucash/python/init.py
@@ -7,8 +7,12 @@ require_version('Gtk', '3.0')
 from gi.repository import Gtk
 import os
 sys.path.append(os.path.dirname(__file__))
+
+# output file location if gnucash has been started with
+# gnucash --extra
 if gnc_prefs_is_extra_enabled():
-    print("woop", os.path.dirname(__file__))
+    print("Python shell init file: %s" % (__file__))
+
 # Importing the console class causes SIGTTOU to be thrown if GnuCash is
 # started in the background.  This causes a hang if it is not handled, 
 # so ignore it for the duration
@@ -20,15 +24,17 @@ import pycons.console as cons
 # Restore the SIGTTOU handler
 signal.signal(signal.SIGTTOU, old_sigttou)
 
+# output debug information if gnucash has been started with
+# gnucash --debug --extra
 if gnc_prefs_is_extra_enabled() and gnc_prefs_is_debugging_enabled():
-    print("Hello from python!")
-    print("test", sys.modules.keys())
-    print("test2", dir(_sw_app_utils))
+    print("Hello from python!\n")
+    print("sys.modules.keys(): ", sys.modules.keys(), "\n")
+    print("dir(_sw_app_utils): ", dir(_sw_app_utils), "\n")
 
    #root = _sw_app_utils.gnc_get_current_root_account()
 
    #print("test", dir(root), root.__class__)
-    print("test3", dir(gnucash_core_c))
+    print("dir(gnucash_core_c): ", dir(gnucash_core_c))
 
    #acct = Account(instance = root)
 



Summary of changes:
 gnucash/gnome/dialog-sx-editor.c            | 12 ++++++++----
 gnucash/import-export/import-main-matcher.c | 13 +++++++++++--
 gnucash/python/init.py                      | 15 +++++++++++----
 3 files changed, 30 insertions(+), 10 deletions(-)



More information about the gnucash-changes mailing list