[meld] gtktemplate: fix prototype tested on debian



commit 6d7c7b7de3668adc83d0f966cf8695b4348ef00a
Author: Vasily Galkin <galkin-vv ya ru>
Date:   Tue Jan 8 15:36:40 2019 +0300

    gtktemplate: fix prototype tested on debian
    
    It looks that when init_template lambda attaching
    was changed from class to instance in
    https://gitlab.gnome.org/GNOME/pygobject/commit/05c3b8dc91f5d51bd30bbe58963a4454b447b707
    it argument list should change too.
    I tested with printfs that when if it is called for class attaching
    it receives self as "s", and for instance attaching - no arguments
    
    This change fixes "missing 1 required positional argument: 's'" exception
    
    After that meld opens but with empty window.
    It looks to be related to the fact that MeldWindow tried to call
    MeldWindow.init_template class method
    resulting in second-time call of actual method,
    since only instance method was replaced to empty in first call,
    not the class one
    (I think that the first call is from "newer" python-gi 3.30.4-1
    and second call from meld itself)
    
    Changing this to instance method solves this problem,
    however I didn't tested on older python-gi
    
    Digging a bit more, I found that the "Format as patch" dialog UI
    - the 3-pane radiobuttons and reversing checkbox doesn't work.
    The checkbox can be fixed by a simple addition of @Template.Callback()
    but the radiobuttons don't

 meld/meldwindow.py      | 2 +-
 meld/patchdialog.py     | 1 +
 meld/ui/_gtktemplate.py | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index 67b4b39f..87825b7c 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -50,7 +50,7 @@ class MeldWindow(Gtk.ApplicationWindow):
     def __init__(self):
         super().__init__()
 
-        MeldWindow.init_template(self)
+        self.init_template()
 
         actions = (
             ("FileMenu", None, _("_File")),
diff --git a/meld/patchdialog.py b/meld/patchdialog.py
index 1e9fdc5c..75e187e9 100644
--- a/meld/patchdialog.py
+++ b/meld/patchdialog.py
@@ -81,6 +81,7 @@ class PatchDialog(Gtk.Dialog):
         self.left_patch = radiobutton == self.left_radiobutton
         self.update_patch()
 
+    @Template.Callback()
     def on_reverse_checkbutton_toggled(self, checkbutton):
         self.reverse_patch = checkbutton.get_active()
         self.update_patch()
diff --git a/meld/ui/_gtktemplate.py b/meld/ui/_gtktemplate.py
index 8067de5c..72e3f36d 100644
--- a/meld/ui/_gtktemplate.py
+++ b/meld/ui/_gtktemplate.py
@@ -101,7 +101,7 @@ def register_template(cls):
 
 
 def init_template(self, cls, base_init_template):
-    self.init_template = lambda s: None
+    self.init_template = lambda: None
 
     if self.__class__ is not cls:
         raise TypeError(


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