[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kate] kate/plugins/pate/src/kate: Restore genration of Actions help
From:       Shaheed Haque <srhaque () theiet ! org>
Date:       2012-11-30 22:10:39
Message-ID: 20121130221039.0CB17A6091 () git ! kde ! org
[Download RAW message or body]

Git commit bfd8e7d51681322b618bb76f60f8de0e995aed1f by Shaheed Haque.
Committed on 30/11/2012 at 21:45.
Pushed by shaheed into branch 'master'.

Restore genration of Actions help

M  +16   -16   kate/plugins/pate/src/kate/__init__.py

http://commits.kde.org/kate/bfd8e7d51681322b618bb76f60f8de0e995aed1f

diff --git a/kate/plugins/pate/src/kate/__init__.py \
b/kate/plugins/pate/src/kate/__init__.py index 0706189..1d52851 100644
--- a/kate/plugins/pate/src/kate/__init__.py
+++ b/kate/plugins/pate/src/kate/__init__.py
@@ -183,7 +183,7 @@ def moduleGetActions(module):
 
     The returned object is [ { function, ( text, icon, shortcut, menu ) }... ].
     """
-    functionsList = [o for o in getmembers(module) if isfunction(o[1])]
+    functionsList = [o for o in getmembers(module) if isinstance(o[1], \
                kate.catchAllHandler)]
     actionsList = [(n, _moduleActionDecompile(o.__dict__['action'])) for (n, o) in \
functionsList if 'action' in o.__dict__]  return actionsList
 
@@ -258,6 +258,21 @@ class _HandledException(Exception):
     def __init__(self, message):
         super(_HandledException, self).__init__(message)
 
+class catchAllHandler(object):
+    '''Standard error handling for plugin actions.'''
+    def __init__(self, f):
+        self.f = f
+
+    def __call__(self):
+        try:
+            return self.f()
+        except _HandledException:
+            raise
+        except Exception as e:
+            txt = "".join(traceback.format_exception(*sys.exc_info()))
+            KMessageBox.error(None, txt, i18n("Error in action \
'{}'").format(self.f.__name__)) +            raise _HandledException(txt)
+
 @_attribute(actions=set())
 def action(text, icon=None, shortcut=None, menu=None):
     ''' Decorator that adds an action to the menu bar. When the item is fired,
@@ -283,21 +298,6 @@ def action(text, icon=None, shortcut=None, menu=None):
     NOTE: Kate may need to be restarted for this decorator to take effect, or
     to remove all traces of the plugin on removal.
     '''
-    class catchAllHandler(object):
-        '''Standard error handling for plugin actions.'''
-        def __init__(self, f):
-            self.f = f
-
-        def __call__(self):
-            try:
-                return self.f()
-            except _HandledException:
-                raise
-            except Exception as e:
-                txt = "".join(traceback.format_exception(*sys.exc_info()))
-                KMessageBox.error(None, txt, i18n("Error in action \
                '{}'").format(self.f.__name__))
-                raise _HandledException(txt)
-
     def decorator(func):
         a = kdeui.KAction(text, None)
         if shortcut is not None:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic