[meld] Remove gnomeglade magic signal connection



commit 118883d148750b3a04480978d11846c59453ed2b
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Sep 7 17:01:51 2013 +1000

    Remove gnomeglade magic signal connection

 meld/filediff.py      |    1 -
 meld/ui/findbar.py    |    1 -
 meld/ui/gnomeglade.py |   39 ---------------------------------------
 3 files changed, 0 insertions(+), 41 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index b785002..8504b78 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -315,7 +315,6 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
 
         self.set_num_panes(num_panes)
         gobject.idle_add( lambda *args: self.load_font()) # hack around Bug 316730
-        gnomeglade.connect_signal_handlers(self)
         self.cursor = CursorDetails()
         self.connect("current-diff-changed", self.on_current_diff_changed)
         for t in self.textview:
diff --git a/meld/ui/findbar.py b/meld/ui/findbar.py
index b5510b0..59c74b8 100644
--- a/meld/ui/findbar.py
+++ b/meld/ui/findbar.py
@@ -30,7 +30,6 @@ class FindBar(gnomeglade.Component):
     def __init__(self, parent):
         gnomeglade.Component.__init__(self, paths.ui_dir("findbar.ui"),
                                       "findbar", ["arrow_left", "arrow_right"])
-        gnomeglade.connect_signal_handlers(self)
         self.textview = None
         self.orig_base_color = self.find_entry.get_style().base[0]
         self.arrow_left.show()
diff --git a/meld/ui/gnomeglade.py b/meld/ui/gnomeglade.py
index d95c052..1b51e69 100644
--- a/meld/ui/gnomeglade.py
+++ b/meld/ui/gnomeglade.py
@@ -16,9 +16,6 @@
 ### Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 ### USA.
 
-import logging
-import re
-
 import gtk
 
 
@@ -80,40 +77,4 @@ class Component(object):
                 lst.append(val)
                 i += 1
 
-# Regular expression to match handler method names patterns
-# on_widget__signal and after_widget__signal.  Note that we use two
-# underscores between the Glade widget name and the signal name.
-handler_re = re.compile(r'^(on|after)_(.*)__(.*)$')
-
-def connect_signal_handlers(obj):
-    log = logging.getLogger(__name__)
-    for attr in dir(obj):
-        match = handler_re.match(attr)
-        if match:
-            when, widgetname, signal = match.groups()
-            method = getattr(obj, attr)
-            assert hasattr(method, '__call__')
-            try:
-                widget = getattr(obj, widgetname)
-            except AttributeError:
-                log.warning("Widget '%s' not found in %s", widgetname, obj)
-                continue
-            if not isinstance(widget,list):
-                widget = [widget]
-            for w in widget:
-                try:
-                    if when == 'on':
-                        w.connect(signal, method)
-                    elif when == 'after':
-                        w.connect_after(signal, method)
-                except TypeError as e:
-                    log.warning("%s in %s %s", e, obj, attr)
-        elif attr.startswith('on_') or attr.startswith('after_'):
-            continue # don't warn until all old code updated
-            # Warn about some possible typos like separating
-            # widget and signal name with _ instead of __.
-            log.warning("Warning: attribute %r not connected as a signal "
-                        "handler", attr)
-
-
 from . import gladesupport


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