Ronny Pfannschmidt avatar Ronny Pfannschmidt committed 47259ca

finish the language enum patches

Comments (0)

Files changed (7)

cleanup-validator-markup

-# HG changeset patch
-# Parent a90abeb0ee35dabdf3cf47f07451c79adb10bf55
-clean up how ValidationError renders to markup
-
-diff --git a/pida-plugins/python_lint/python_lint.py b/pida-plugins/python_lint/python_lint.py
---- a/pida-plugins/python_lint/python_lint.py
-+++ b/pida-plugins/python_lint/python_lint.py
-@@ -62,7 +62,7 @@ class PythonError(ValidationError, Log):
-     """
-     Validator class for PyLint errrors
-     """
--    def get_markup(self):
-+    def markup_args(self):
-         if self.message_args:
-             try:
-                 if isinstance(self.message_args, (list, tuple)):
-@@ -77,38 +77,9 @@ class PythonError(ValidationError, Log):
-                 message_string = self.message
-         else:
-             message_string = self.message
--        if self.type_ == 'error':
--            typec = self.lookup_color('pida-val-error')
--        elif self.type_ == 'error':
--            typec = self.lookup_color('pida-val-info')
--        elif self.type_ == 'warning':
--            typec = self.lookup_color('pida-val-warning')
--        else:
--            typec = self.lookup_color('pida-val-def')
--        if typec:
--            typec = typec.to_string()
--        else:
--            linecolor = "black"
--        linecolor = self.lookup_color('pida-lineno')
--        if linecolor:
--            linecolor = linecolor.to_string()
--        else:
--            linecolor = "black"
--        markup = ("""<tt><span color="%(linecolor)s">%(lineno)s</span> </tt>"""
--    """<span foreground="%(typec)s" style="italic" weight="bold">%(type)s</span"""
--    """>:<span style="italic">%(subtype)s</span>  -  """
--    """<span size="small" style="italic">%(msg_id)s</span>\n%(message)s""" % 
--                      {'lineno':self.lineno,
--                      'type': self.level.capitalize(),
--                      'subtype': self.kind.capitalize(),
--                      'message': message_string,
--                      'linecolor': linecolor,
--                      'typec': typec,
--                      'msg_id': self.msg_id
--                      })
--        return markup
--    markup = property(get_markup)
--
-+        mapping = ValidationError.markup_args(self)
-+        mapping['message'] = message_string
-+        return mapping
- 
- from logilab.common.ureports import TextWriter
- from logilab.common.textutils import get_csv
-diff --git a/pida/utils/languages.py b/pida/utils/languages.py
---- a/pida/utils/languages.py
-+++ b/pida/utils/languages.py
-@@ -119,6 +119,15 @@ class ValidationError(InitObject):
-     filename = None
-     lineno = None
- 
-+    markup_string = (
-+        '<tt><span color="{linecolor}">{lineno}</span> </tt>'
-+        '<span foreground="{level_color}" style="italic" weight="bold">'
-+        '{level}</span>:'
-+        '<span style="italic">{kind}</span>\n'
-+        '{message}'
-+    )
-+
-+
-     def __str__(self):
-         return '%s:%s: %s' % (self.filename, self.lineno, self.message)
- 
-@@ -131,7 +140,12 @@ class ValidationError(InitObject):
-         # FIXME
-         pass
- 
--    def get_markup(self):
-+
-+    @property
-+    def markup(self):
-+        return self.markup_string.format(**self.markup_args())
-+
-+    def markup_args(self):
-         mapping = {
-             VALIDATOR_LEVEL.ERROR: 'pida-val-error',
-             VALIDATOR_LEVEL.INFO: 'pida-val-info',
-@@ -139,18 +153,14 @@ class ValidationError(InitObject):
-         }
-         typec = mapping.get(self.kind, 'pida-val-def')
- 
--        markup = ("""<tt><span color="%(linecolor)s">%(lineno)s</span> </tt>"""
--    """<span foreground="%(typec)s" style="italic" weight="bold">%(type)s</span"""
--    """>:<span style="italic">%(subtype)s</span>\n%(message)s""" % 
--                      {'lineno':self.lineno, 
--                      'type': self.level.capitalize(),
--                      'subtype': self.kind.capitalize(),
--                      'message':self.message,
--                      'linecolor': color_to_string(self.lookup_color('pida-lineno')),
--                      'typec': color_to_string(typec),
--                      })
--        return markup
--    markup = property(get_markup)
-+        return {
-+            'lineno': self.lineno,
-+            'level': self.level.capitalize(),
-+            'level_color': color_to_string(typec),
-+            'kind': self.kind.capitalize(),
-+            'message': self.message,
-+            'linecolor': color_to_string(self.lookup_color('pida-lineno')),
-+        }
- 
- 
- 

kill-completer-types-enum

-# HG changeset patch
-# User Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
-# Date 1280876358 -7200
-# Node ID dc2797856c153b649049583ebef79122fcfe43fd
-# Parent 70668252cb974184036347b7f8736aea8f152251
-replace LANG_COMPLETER_TYPES with a symbol bag
-
-diff --git a/pida-plugins/python/python.py b/pida-plugins/python/python.py
---- a/pida-plugins/python/python.py
-+++ b/pida-plugins/python/python.py
-@@ -37,7 +37,8 @@ from pida.core.languages import (Languag
-     Completer, LanguageServiceFeaturesConfig, LanguageInfo, Definer, 
-     Documentator, External)
- 
--from pida.utils.languages import (LANG_COMPLETER_TYPES,
-+from pida.utils.languages import (
-+    COMPLETER,
-     LANG_VALIDATOR_TYPES, LANG_VALIDATOR_SUBTYPES, LANG_OUTLINER_TYPES, 
-     LANG_PRIO, Definition, Suggestion, Documentation, ValidationError)
- 
-@@ -342,22 +343,15 @@ class PythonCompleter(Completer):
-                 r = Suggestion(c.name)
-                 #'variable', 'class', 'function', 'imported' , 'paramter'
-                 if keyword.iskeyword(c.name):
--                    r.type_ = LANG_COMPLETER_TYPES.KEYWORD
--                elif c.type == 'variable':
--                    r.type_ = LANG_COMPLETER_TYPES.VARIABLE
--                elif c.type == 'class':
--                    r.type_ = LANG_COMPLETER_TYPES.CLASS
--                elif c.type == 'builtin':
--                    r.type_ = LANG_COMPLETER_TYPES.BUILTIN
--                elif c.type == 'function':
--                    r.type_ = LANG_COMPLETER_TYPES.FUNCTION
--                elif c.type == 'parameter':
--                    r.type_ = LANG_COMPLETER_TYPES.PARAMETER
-+                    r.type_ = COMPLETER.KEYWORD
-+                elif c.type in ('variable','class', 'builtin',
-+                                'function', 'parameter',):
-+                    r.type_ = getattr(COMPLETER, c.type.upper())
-                 elif c.type == None:
-                     if c.kind == "parameter_keyword":
--                        r.type_ = LANG_COMPLETER_TYPES.PARAMETER
-+                        r.type_ = COMPLETER.PARAMETER
-                 else:
--                    r.type_ = LANG_COMPLETER_TYPES.UNKNOWN
-+                    r.type_ = COMPLETER.UNKNOWN
-                 yield r
- 
- class PythonDefiner(Definer):
-diff --git a/pida-plugins/python_lint/python_lint.py b/pida-plugins/python_lint/python_lint.py
---- a/pida-plugins/python_lint/python_lint.py
-+++ b/pida-plugins/python_lint/python_lint.py
-@@ -21,7 +21,7 @@ from pida.core.options import OptionsCon
- from pida.core.log import Log
- 
- from pida.core.languages import (LanguageService, Validator, External)
--from pida.utils.languages import (LANG_COMPLETER_TYPES,
-+from pida.utils.languages import (
-     LANG_VALIDATOR_TYPES, LANG_VALIDATOR_SUBTYPES, LANG_PRIO,
-    Definition, Suggestion, Documentation, ValidationError)
- 
-diff --git a/pida/core/languages.py b/pida/core/languages.py
---- a/pida/core/languages.py
-+++ b/pida/core/languages.py
-@@ -15,7 +15,7 @@ from pida.core.document import Document
- from pida.core.projects import Project
- from pida.core.service import Service
- from pida.core.features import FeaturesConfig
--from pida.utils.languages import (LANG_COMPLETER_TYPES,
-+from pida.utils.languages import (
-     LANG_VALIDATOR_TYPES, LANG_VALIDATOR_SUBTYPES, LANG_PRIO,
-     Suggestion, Definition, ValidationError, Documentation)
- from pida.utils.path import get_relative_path
-diff --git a/pida/ui/completer.py b/pida/ui/completer.py
---- a/pida/ui/completer.py
-+++ b/pida/ui/completer.py
-@@ -7,8 +7,10 @@
- import gtk
- import gobject
- import os
--from pida.utils.languages import LANG_COMPLETER_TYPES
-+from pida.utils.languages import COMPLETER
- 
-+
-+#XXX: register as stock icons
- def _load_pix(fn):
-     return gtk.gdk.pixbuf_new_from_file(
-         os.path.join(os.path.dirname(__file__),
-@@ -16,19 +18,19 @@ def _load_pix(fn):
- 
- 
- _PIXMAPS = {
--    LANG_COMPLETER_TYPES.UNKNOWN:     _load_pix('element-event-16.png'),
--    LANG_COMPLETER_TYPES.ATTRIBUTE:   _load_pix('source-attribute.png'),
--    LANG_COMPLETER_TYPES.CLASS:       _load_pix('source-class.png'),
--    LANG_COMPLETER_TYPES.FUNCTION:    _load_pix('source-attribute.png'), # FIXME
--    LANG_COMPLETER_TYPES.METHOD:      _load_pix('source-attribute.png'),
--    LANG_COMPLETER_TYPES.MODULE:      _load_pix('source-method.png'),
--    LANG_COMPLETER_TYPES.PROPERTY:    _load_pix('source-property.png'),
--    LANG_COMPLETER_TYPES.EXTRAMETHOD: _load_pix('source-extramethod.png'),
--    LANG_COMPLETER_TYPES.VARIABLE:    _load_pix('source-attribute.png'), # FIXME
--    LANG_COMPLETER_TYPES.IMPORT:      _load_pix('source-import.png'),
--    LANG_COMPLETER_TYPES.PARAMETER:   _load_pix('source-attribute.png'), # FIXME
--    LANG_COMPLETER_TYPES.BUILTIN:     _load_pix('source-attribute.png'), # FIXME
--    LANG_COMPLETER_TYPES.KEYWORD:     _load_pix('source-attribute.png'), # FIXME
-+    COMPLETER.UNKNOWN:     _load_pix('element-event-16.png'),
-+    COMPLETER.ATTRIBUTE:   _load_pix('source-attribute.png'),
-+    COMPLETER.CLASS:       _load_pix('source-class.png'),
-+    COMPLETER.FUNCTION:    _load_pix('source-attribute.png'), # FIXME
-+    COMPLETER.METHOD:      _load_pix('source-attribute.png'),
-+    COMPLETER.MODULE:      _load_pix('source-method.png'),
-+    COMPLETER.PROPERTY:    _load_pix('source-property.png'),
-+    COMPLETER.EXTRAMETHOD: _load_pix('source-extramethod.png'),
-+    COMPLETER.VARIABLE:    _load_pix('source-attribute.png'), # FIXME
-+    COMPLETER.IMPORT:      _load_pix('source-import.png'),
-+    COMPLETER.PARAMETER:   _load_pix('source-attribute.png'), # FIXME
-+    COMPLETER.BUILTIN:     _load_pix('source-attribute.png'), # FIXME
-+    COMPLETER.KEYWORD:     _load_pix('source-attribute.png'), # FIXME
- }
- 
- 
-@@ -39,10 +41,7 @@ class SuggestionsList(gtk.ListStore):
-     @staticmethod
-     def from_dbus(args):
-         rv = list(args)
--        if args[0] in _PIXMAPS:
--            rv[0] = _PIXMAPS[args[0]]
--        else:
--            rv[0] = _PIXMAPS[LANG_COMPLETER_TYPES.UNKNOWN]
-+        rv[0] = _PIXMAPS.get(args[0], _PIXMAPS[COMPLETER.UNKNOWN])
-         return rv
- 
- class PidaCompleterWindow(gtk.Window):
-@@ -379,8 +378,8 @@ if __name__ == "__main__":
-     i = 0
-     for x in ['ase', 'assdf', 'Asdf', 'zasd', 'Zase', 'form', 'in', 'of', 'BLA',
-               'taT', 'tUt', 'df', 'asdf', 'asdfa', 'sd', 'sdfsf', 'ssdfsdf', 'sd']:
--        l.append(SuggestionsList.from_dbus((i, x)))
--        i = i + 1%7
-+        l.append(SuggestionsList.from_dbus((COMPLETER[i], x)))
-+        i = (i + 1)%7
- 
-     p.set_model(l)
- 
-diff --git a/pida/utils/languages.py b/pida/utils/languages.py
---- a/pida/utils/languages.py
-+++ b/pida/utils/languages.py
-@@ -8,9 +8,11 @@ List of general Language classes.
- 
- """
- from .addtypes import Enumeration
-+from .symbols import Symbols
- from .path import get_line_from_file
- from .descriptors import cached_property
- 
-+import itertools
- 
- 
- #!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-@@ -20,12 +22,23 @@ from .descriptors import cached_property
- #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 
- 
-+COMPLETER = Symbols('completer', [
-+    'unknown',
-+    'attribute',
-+    'class',
-+    'method',
-+    'function',
-+    'module',
-+    'property',
-+    'extramethod',
-+    'variable',
-+    'import',
-+    'parameter',
-+    'builtin',
-+    'keyword',
-+    'snippet',
-+])
- 
--# completer types
--LANG_COMPLETER_TYPES = Enumeration('LANG_COMPLETER_TYPES',
--    ('UNKNOWN', 'ATTRIBUTE', 'CLASS', 'METHOD', 'FUNCTION', 'MODULE', 
--    'PROPERTY', 'EXTRAMETHOD', 'VARIABLE', 'IMPORT', 'PARAMETER', 'BUILTIN', 
--    'KEYWORD', 'SNIPPET'))
- 
- 
- # main types
-@@ -237,7 +250,7 @@ class Suggestion(unicode):
-     """
-     Suggestions are returned by an Completer class
-     """
--    type_ = LANG_TYPES.UNKNOWN
-+    type_ = COMPLETER.UNKNOWN
-     doc = None
-     docpath = None
-     signature = None

kill-outliner-types-enum

-# HG changeset patch
-# User Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
-# Date 1280876358 -7200
-# Node ID d2deb6f3af308ed68f2952d00e9a6c533cf5c978
-# Parent 67c254c58f20267d279479e02de51171cfe7b0d0
-replace the LANG_TYPES enum with the OUTLINER symbol bag
-
-diff --git a/pida-plugins/ctags/ctags.py b/pida-plugins/ctags/ctags.py
---- a/pida-plugins/ctags/ctags.py
-+++ b/pida-plugins/ctags/ctags.py
-@@ -37,7 +37,7 @@ from pida.core.options import OptionsCon
- from pida.core.languages import (LanguageService, Outliner, Validator,
-     Completer, LanguageServiceFeaturesConfig, LanguageInfo, Definer, Documentator)
- 
--from pida.utils.languages import (LANG_PRIO, LANG_OUTLINER_TYPES, OutlineItem )
-+from pida.utils.languages import LANG_PRIO, OutlineItem
- 
- # locale
- from pida.core.locale import Locale
-@@ -282,19 +282,21 @@ class CtagsOutliner(Outliner):
- 		v	variable        
-         """
-         def v2t(i):
--            if i == 'm': return LANG_OUTLINER_TYPES.MEMBER
--            if i == 'c': return LANG_OUTLINER_TYPES.CLASS
--            if i == 'd': return LANG_OUTLINER_TYPES.DEFINE
--            if i == 'e': return LANG_OUTLINER_TYPES.ENUMERATION
--            if i == 'f': return LANG_OUTLINER_TYPES.FUNCTION
--            if i == 'g': return LANG_OUTLINER_TYPES.ENUMERATION_NAME
--            if i == 'n': return LANG_OUTLINER_TYPES.NAMESPACE
--            if i == 'p': return LANG_OUTLINER_TYPES.PROTOTYPE
--            if i == 's': return LANG_OUTLINER_TYPES.STRUCTURE
--            if i == 't': return LANG_OUTLINER_TYPES.TYPEDEF
--            if i == 'u': return LANG_OUTLINER_TYPES.UNION
--            if i == 'v': return LANG_OUTLINER_TYPES.VARIABLE
--            return LANG_OUTLINER_TYPES.UNKNOWN
-+            mapping = {
-+                'm': 'member',
-+                'c': 'class',
-+                'd': 'define',
-+                'e': 'enumeration',
-+                'f': 'function',
-+                'g': 'enumeration_name',
-+                'n': 'namespace',
-+                'p': 'prototype',
-+                's': 'structure',
-+                't': 'typedef',
-+                'u': 'union',
-+                'v': 'variable',
-+            }
-+            return mapping.get(i, 'unknown')
- 
-         if len(tokrow) == 4 and isinstance(tokrow[3], int):
-             return tokrow[3]
-@@ -304,8 +306,8 @@ class CtagsOutliner(Outliner):
-                 return v2t(i)# most common case: just one char
-             elif i[:4] == "kind":
-                 return v2t(i[5:])
--            return LANG_OUTLINER_TYPES.UNKNOWN
--        return LANG_OUTLINER_TYPES.UNKNOWN
-+            return 'unknown'
-+        return 'unknown'
- 
- 
-     def _get_container_name(self, tokrow):
-@@ -327,15 +329,9 @@ class CtagsOutliner(Outliner):
-         """ class, enumerations, structs and unions are considerer containers.
-             See Issue 13 for some issues we had with this.
-         """
--        if self._get_type(tokrow) in (
--            LANG_OUTLINER_TYPES.CLASS,
--            LANG_OUTLINER_TYPES.ENUMERATION_NAME,
--            LANG_OUTLINER_TYPES.STRUCTURE,
--            LANG_OUTLINER_TYPES.UNION,
--            LANG_OUTLINER_TYPES.TYPEDEF): 
--                return True
--        return False
--            
-+        return self._get_type(tokrow) in (
-+            'class', 'enumeration_name',
-+            'structure', 'union', 'typedef')
-         # remove temp file
-         #os.remove(tmpfile)
- 
-diff --git a/pida-plugins/python/python.py b/pida-plugins/python/python.py
---- a/pida-plugins/python/python.py
-+++ b/pida-plugins/python/python.py
-@@ -39,7 +39,6 @@ from pida.core.languages import (Languag
- 
- from pida.utils.languages import (
-     COMPLETER, VALIDATOR_LEVEL, VALIDATOR_KIND,
--    LANG_OUTLINER_TYPES, 
-     LANG_PRIO, Definition, Suggestion, Documentation, ValidationError)
- 
- # services
-@@ -132,14 +131,10 @@ class PythonOutliner(Outliner):
-     description = _("A very deep and precises, but slow outliner")
- 
- 
--    filter_type = (LANG_OUTLINER_TYPES.IMPORT,
--                    LANG_OUTLINER_TYPES.BUILTIN,
--                    LANG_OUTLINER_TYPES.METHOD,
--                    LANG_OUTLINER_TYPES.FUNCTION,
--                    LANG_OUTLINER_TYPES.PROPERTY,
--                    LANG_OUTLINER_TYPES.ATTRIBUTE,
--                    LANG_OUTLINER_TYPES.SUPERMETHOD,
--                    )
-+    filter_type = (
-+        'import', 'builtin', 'method', 'function',
-+        'property', 'attribute', 'supermethod',
-+        )
- 
-     def get_outline(self):
-         from rope.base.exceptions import RopeError
-diff --git a/pida-plugins/python/ropebrowser.py b/pida-plugins/python/ropebrowser.py
---- a/pida-plugins/python/ropebrowser.py
-+++ b/pida-plugins/python/ropebrowser.py
-@@ -14,7 +14,7 @@ from pida.core.projects import Project a
- from rope.base.project import Project, get_no_project
- from rope.base import pynames, pyobjects, builtins
- 
--from pida.utils.languages import LANG_OUTLINER_TYPES, OutlineItem
-+from pida.utils.languages import OutlineItem
- from itertools import count
- 
- OUTLINE_COUNTER = count()
-@@ -70,7 +70,7 @@ class TreeOptions(object):
-     position = 0
-     has_children = False
-     icon_name = 'source-property'
--    filter_type =  LANG_OUTLINER_TYPES.UNKNOWN
-+    filter_type = 'unknown'
- 
-     def __init__(self, treeitem, obj):
-         pass
-@@ -91,7 +91,7 @@ class FunctionOptions(TreeOptions):
-     icon_name = 'source-function'
-     type_color = '#900000'
-     position = 2
--    filter_type = LANG_OUTLINER_TYPES.UNKNOWN
-+    filter_type = 'unknown'
- 
-     def __init__(self, item, obj):
-         decs = []
-@@ -126,13 +126,13 @@ class EvaluatedOptions(TreeOptions):
-     type_name = 'p'
-     icon_name = 'source-property'
-     type_color = '#900090'
--    filter_type = LANG_OUTLINER_TYPES.PROPERTY
-+    filter_type = 'property'
- 
- class MethodOptions(FunctionOptions):
- 
-     type_name = 'm'
-     icon_name = 'source-method'
--    filter_type = LANG_OUTLINER_TYPES.METHOD
-+    filter_type = 'method'
- 
- 
- class SuperMethodOptions(MethodOptions):
-@@ -140,7 +140,7 @@ class SuperMethodOptions(MethodOptions):
-     type_name = '(m)'
-     icon_name = 'source-extramethod'
-     position = 6
--    filter_type = LANG_OUTLINER_TYPES.SUPERMETHOD
-+    filter_type = 'supermethod'
- 
- 
- class ClassMethodOptions(MethodOptions):
-@@ -188,7 +188,7 @@ class AssignedOptions(TreeOptions):
-     icon_name = 'source-attribute'
-     type_color = '#009000'
-     position = 5
--    filter_type = LANG_OUTLINER_TYPES.ATTRIBUTE
-+    filter_type = 'attribute'
- 
- 
- class BuiltinOptions(TreeOptions):
-@@ -197,7 +197,7 @@ class BuiltinOptions(TreeOptions):
-     icon_name = None
-     type_color = '#999999'
-     position = 7
--    filter_type = LANG_OUTLINER_TYPES.BUILTIN
-+    filter_type = 'builtin'
- 
- 
- class ImportedOptions(TreeOptions):
-@@ -206,7 +206,7 @@ class ImportedOptions(TreeOptions):
-     icon_name = 'source-import'
-     type_color = '#999999'
-     position = 8
--    filter_type = LANG_OUTLINER_TYPES.IMPORT
-+    filter_type = 'import'
- 
- 
- def get_option_for_item(item, node, obj, parent_obj=None):
-diff --git a/pida-plugins/rst/rst.py b/pida-plugins/rst/rst.py
---- a/pida-plugins/rst/rst.py
-+++ b/pida-plugins/rst/rst.py
-@@ -13,7 +13,7 @@ from collections import defaultdict
- # PIDA imports
- from pida.core.languages import LanguageService, Outliner, Validator
- from pida.utils.languages import (
--    LANG_PRIO, LANG_OUTLINER_TYPES,
-+    LANG_PRIO,
-     VALIDATOR_LEVEL, VALIDATOR_KIND,
-     OutlineItem, ValidationError,
- )
-@@ -248,8 +248,7 @@ class RSTOutliner(Outliner):
-     name = "rst outliner"
-     description = _("An outliner for ReStructuredText")
- 
--    section_types = (LANG_OUTLINER_TYPES.SECTION,
--                     LANG_OUTLINER_TYPES.PARAGRAPH)
-+    section_types = ('section', 'paragraph')
- 
-     def get_outline(self):
-         self.doc_items = RSTTokenList()
-@@ -281,7 +280,7 @@ class RSTOutliner(Outliner):
-                   isinstance(node, nodes.figure)):
-                 new_item = True
-                 name = node.attributes['uri']
--                type = LANG_OUTLINER_TYPES.UNKNOWN
-+                type = 'unknown'
-                 is_container = False
-                 # nodes with options have no line attribute
-                 linenumber = node.line or node.parent.line
-diff --git a/pida/services/language/outlinefilter.py b/pida/services/language/outlinefilter.py
---- a/pida/services/language/outlinefilter.py
-+++ b/pida/services/language/outlinefilter.py
-@@ -1,56 +1,56 @@
--from pida.utils.languages import LANG_OUTLINER_TYPES
-+from pida.utils.languages import OUTLINER
- 
- FILTERMAP = {
--    LANG_OUTLINER_TYPES.IMPORT: {
-+    OUTLINER.IMPORT: {
-         "name": "import",
-         "alias": "include",
-         "display": "Imports",
-         "icon": "source-import",
-         "default": True 
-     },
--    LANG_OUTLINER_TYPES.BUILTIN: {
-+    OUTLINER.BUILTIN: {
-         "name": "builtin",
-         "alias": "",
-         "display": "Builtins",
-         "icon": "source-module",
-         "default": True
-     },
--    LANG_OUTLINER_TYPES.ATTRIBUTE: {
-+    OUTLINER.ATTRIBUTE: {
-         "name": "attribute",
-         "alias": "",
-         "display": "Attributes",
-         "icon": "source-attribute",
-         "default": True
-     },
--    LANG_OUTLINER_TYPES.METHOD: {
-+    OUTLINER.METHOD: {
-         "name": "method",
-         "alias": "",
-         "display": "Methods",
-         "icon": "source-method",
-         "default": True
-     },
--    LANG_OUTLINER_TYPES.PROPERTY: {
-+    OUTLINER.PROPERTY: {
-         "name": "property",
-         "alias": "",
-         "display": "Properties",
-         "icon": "source-property",
-         "default": True
-     },
--    LANG_OUTLINER_TYPES.FUNCTION: {
-+    OUTLINER.FUNCTION: {
-         "name": "function",
-         "alias": "",
-         "display": "Functions",
-         "icon": "source-function",
-         "default": True
-     },
--    LANG_OUTLINER_TYPES.SUPERMETHOD: {
-+    OUTLINER.SUPERMETHOD: {
-         "name": "import",
-         "alias": "include",
-         "display": "Super methods",
-         "icon": "source-extramethod",
-         "default": True 
-     },
--    LANG_OUTLINER_TYPES.SUPERPROPERTY: {
-+    OUTLINER.SUPERPROPERTY: {
-         "name": "import",
-         "alias": "include",
-         "display": "Super properties",
-diff --git a/pida/services/language/views.py b/pida/services/language/views.py
---- a/pida/services/language/views.py
-+++ b/pida/services/language/views.py
-@@ -517,7 +517,7 @@ class BrowserView(PidaView):
-                 )
-             for f in self.filter_map:
-                 tool_button = gtk.ToggleToolButton()
--                tool_button.set_name(str(f))
-+                tool_button.set_data('pida/outliner', f)
-                 tool_button.set_active(self.filter_map[f])
-                 #FIXME no tooltip on win32
-                 if not on_windows:
-@@ -539,7 +539,8 @@ class BrowserView(PidaView):
-         self.options_vbox.show_all()
- 
-     def on_filter_toggled(self, but, outliner):
--        self.filter_map[int(but.get_name())] = not self.filter_map[int(but.get_name())]
-+        name = but.get_data('pida/outliner')
-+        self.filter_map[name] = not self.filter_map[name]
-         #self.set_outliner(outliner, self.document)
-         self.filter_model.refilter()
- 
-diff --git a/pida/utils/languages.py b/pida/utils/languages.py
---- a/pida/utils/languages.py
-+++ b/pida/utils/languages.py
-@@ -51,14 +51,13 @@ VALIDATOR_LEVEL = Symbols('validation le
- 
- # validation sub types
- 
--LANG_TYPES = Enumeration('LANG_TYPES',
-- ('', 'UNKNOWN', 
-- 'ATTRIBUTE', 'BUILTIN', 'CLASS', 'DEFINE', 'ENUMERATION',
-- 'ENUMERATION_NAME', 'FUNCTION', 'IMPORT', 'MEMBER', 'METHOD', 'PROPERTY',
-- 'PROTOTYPE', 'STRUCTURE', 'SUPERMETHOD', 'SUPERPROPERTY', 'TYPEDEF', 'UNION',
-- 'VARIABLE', 'NAMESPACE', 'ELEMENT', 'SECTION', 'CHAPTER', 'PARAGRAPH'))
-+OUTLINER = Symbols('outline',
-+ ('unknown',
-+ 'attribute', 'builtin', 'class', 'define', 'enumeration',
-+ 'enumeration_name', 'function', 'import', 'member', 'method', 'property',
-+ 'prototype', 'structure', 'supermethod', 'superproperty', 'typedef', 'union',
-+ 'variable', 'namespace', 'element', 'section', 'chapter', 'paragraph'))
- 
--LANG_OUTLINER_TYPES = LANG_TYPES
- 
- LANG_PRIO = Enumeration('LANG_PRIORITIES',
- (
-@@ -72,29 +71,29 @@ LANG_PRIO = Enumeration('LANG_PRIORITIES
- 
- 
- LANG_IMAGE_MAP = {
--    LANG_TYPES.ATTRIBUTE: 'source-attribute',
--    LANG_TYPES.BUILTIN: 'source-attribute',
--    LANG_TYPES.CLASS: 'source-class',
--    LANG_TYPES.DEFINE: 'source-define',
--    LANG_TYPES.ENUMERATION: 'source-enum',
--    LANG_TYPES.ENUMERATION_NAME: 'source-enumarator',
--    LANG_TYPES.FUNCTION: 'source-function',
--    LANG_TYPES.IMPORT: 'source-import',
--    LANG_TYPES.MEMBER: 'source-member',
--    LANG_TYPES.METHOD: 'source-method',
--    LANG_TYPES.PROTOTYPE: 'source-interface',
--    LANG_TYPES.PROPERTY: 'source-property',
--    LANG_TYPES.METHOD: 'source-method',
--    LANG_TYPES.SUPERMETHOD: 'source-extramethod',
-+    OUTLINER.ATTRIBUTE: 'source-attribute',
-+    OUTLINER.BUILTIN: 'source-attribute',
-+    OUTLINER.CLASS: 'source-class',
-+    OUTLINER.DEFINE: 'source-define',
-+    OUTLINER.ENUMERATION: 'source-enum',
-+    OUTLINER.ENUMERATION_NAME: 'source-enumarator',
-+    OUTLINER.FUNCTION: 'source-function',
-+    OUTLINER.IMPORT: 'source-import',
-+    OUTLINER.MEMBER: 'source-member',
-+    OUTLINER.METHOD: 'source-method',
-+    OUTLINER.PROTOTYPE: 'source-interface',
-+    OUTLINER.PROPERTY: 'source-property',
-+    OUTLINER.METHOD: 'source-method',
-+    OUTLINER.SUPERMETHOD: 'source-extramethod',
-     #FIXME: superproperty icon
--    LANG_TYPES.SUPERPROPERTY: 'source-property',
--    LANG_TYPES.TYPEDEF: 'source-typedef',
--    LANG_TYPES.UNION: 'source-union',
--    LANG_TYPES.VARIABLE: 'source-variable',
--    LANG_TYPES.SECTION: 'source-section',
--    LANG_TYPES.PARAGRAPH: 'source-paragraph',
--    LANG_TYPES.NAMESPACE: 'source-namespace',
--    LANG_TYPES.ELEMENT: 'source-element',
-+    OUTLINER.SUPERPROPERTY: 'source-property',
-+    OUTLINER.TYPEDEF: 'source-typedef',
-+    OUTLINER.UNION: 'source-union',
-+    OUTLINER.VARIABLE: 'source-variable',
-+    OUTLINER.SECTION: 'source-section',
-+    OUTLINER.PARAGRAPH: 'source-paragraph',
-+    OUTLINER.NAMESPACE: 'source-namespace',
-+    OUTLINER.ELEMENT: 'source-element',
- }
- 
- 
-@@ -159,7 +158,7 @@ class OutlineItem(InitObject):
-     """
-     Outlines are returned by an Outliner class
-     """
--    type = LANG_TYPES.UNKNOWN
-+    type = OUTLINER.UNKNOWN
-     name = ''
-     parent = None
-     id = None
-@@ -196,7 +195,7 @@ class OutlineItem(InitObject):
- 
- class Definition(InitObject):
-     """Returned by a Definer instance"""
--    type = LANG_TYPES.UNKNOWN
-+    type = OUTLINER.UNKNOWN
-     file_name = None
-     offset = None
-     length = None

kill-validator-types-subtypes-enums

-# HG changeset patch
-# User Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
-# Date 1280876358 -7200
-# Node ID 15126c8358813d60d0a73d3e5965774bf14a2de0
-# Parent ee8ff69d6892f053e2ca214ed0811a055be8fbc7
-switch the validator enums for VALIDATOR_LEVEL and VALIDATOR_KIND symbol bags
-
-diff --git a/pida-plugins/python/python.py b/pida-plugins/python/python.py
---- a/pida-plugins/python/python.py
-+++ b/pida-plugins/python/python.py
-@@ -38,8 +38,8 @@ from pida.core.languages import (Languag
-     Documentator, External)
- 
- from pida.utils.languages import (
--    COMPLETER,
--    LANG_VALIDATOR_TYPES, LANG_VALIDATOR_SUBTYPES, LANG_OUTLINER_TYPES, 
-+    COMPLETER, VALIDATOR_LEVEL, VALIDATOR_KIND,
-+    LANG_OUTLINER_TYPES, 
-     LANG_PRIO, Definition, Suggestion, Documentation, ValidationError)
- 
- # services
-@@ -223,51 +223,13 @@ def _create_exception_validation(e):
-     msg.lineno = lineno
-     msg.message_args = (line,)
-     msg.message = '<tt>%%s</tt>\n<tt>%s^</tt>' % (' ' * (offset - 2))
--    msg.type_ = LANG_VALIDATOR_TYPES.ERROR
-+    msg.type_ = 'error'
-     if isinstance(e, SyntaxError):
--        msg.subtype = LANG_VALIDATOR_SUBTYPES.SYNTAX
-+        msg.kind = 'syntax'
-     else:
--        msg.subtype = LANG_VALIDATOR_SUBTYPES.INDENTATION
-+        msg.kind = 'indentation'
-     return [msg]
- 
--class PythonError(ValidationError):
--    def get_markup(self):
--        args = [('<b>%s</b>' % arg) for arg in self.message_args]
--        message_string = self.message % tuple(args)
--        if self.type_ == LANG_VALIDATOR_TYPES.ERROR:
--            typec = self.lookup_color('pida-val-error')
--        elif self.type_ == LANG_VALIDATOR_TYPES.INFO:
--            typec = self.lookup_color('pida-val-info')
--        elif self.type_ == LANG_VALIDATOR_TYPES.WARNING:
--            typec = self.lookup_color('pida-val-warning')
--        else:
--            typec = self.lookup_color('pida-val-def')
--        
--        if typec:
--            typec = typec.to_string()
--        else:
--            typec = "black"
--        
--        linecolor = self.lookup_color('pida-lineno')
--        if linecolor:
--            linecolor = linecolor.to_string()
--        else:
--            linecolor = "black"
--        
--        markup = ("""<tt><span color="%(linecolor)s">%(lineno)s</span> </tt>"""
--    """<span foreground="%(typec)s" style="italic" weight="bold">%(type)s</span"""
--    """>:<span style="italic">%(subtype)s</span>\n%(message)s""" % 
--                      {'lineno':self.lineno, 
--                      'type':_(LANG_VALIDATOR_TYPES.whatis(self.type_).capitalize()),
--                      'subtype':_(LANG_VALIDATOR_SUBTYPES.whatis(
--                                    self.subtype).capitalize()),
--                      'message':message_string,
--                      'linecolor': linecolor,
--                      'typec': typec,
--                      })
--        return markup
--    markup = property(get_markup)
--
- class PythonValidator(Validator):
- 
-     priority = LANG_PRIO.GOOD
-@@ -286,33 +248,34 @@ class PythonValidator(Validator):
-             w = Checker(tree, filename)
-             messages = w.messages
-         for m in messages:
--            type_ = getattr(m, 'type_', LANG_VALIDATOR_TYPES.UNKNOWN)
--            subtype = getattr(m, 'subtype', LANG_VALIDATOR_SUBTYPES.UNKNOWN)
- 
-             #FIXME add pyflakes 0.3 types
-             #FIXME make mapping
-             if isinstance(m, pyflakes.messages.UnusedImport):
--                type_ = LANG_VALIDATOR_TYPES.INFO
--                subtype = LANG_VALIDATOR_SUBTYPES.UNUSED
-+                level = VALIDATOR_LEVEL.INFO
-+                kind = VALIDATOR_KIND.UNUSED
-             elif isinstance(m, pyflakes.messages.RedefinedWhileUnused):
--                type_ = LANG_VALIDATOR_TYPES.WARNING
--                subtype = LANG_VALIDATOR_SUBTYPES.REDEFINED
-+                level = VALIDATOR_LEVEL.WARNING
-+                kind = VALIDATOR_KIND.REDEFINED
-             elif isinstance(m, pyflakes.messages.ImportStarUsed):
--                type_ = LANG_VALIDATOR_TYPES.WARNING
--                subtype = LANG_VALIDATOR_SUBTYPES.BADSTYLE
-+                level = VALIDATOR_LEVEL.WARNING
-+                kind = VALIDATOR_KIND.BADSTYLe
-             elif isinstance(m, pyflakes.messages.UndefinedName):
--                type_ = LANG_VALIDATOR_TYPES.ERROR
--                subtype = LANG_VALIDATOR_SUBTYPES.UNDEFINED
-+                level = VALIDATOR_LEVEL.ERROR
-+                kind = VALIDATOR_KIND.UNDEFINED
-             elif isinstance(m, pyflakes.messages.DuplicateArgument):
--                type_ = LANG_VALIDATOR_TYPES.ERROR
--                subtype = LANG_VALIDATOR_SUBTYPES.DUPLICATE
-+                type_ = VALIDATOR_LEVEL.ERROR
-+                kind = VALIDATOR_KIND.DUPLICATE
-+            else:
-+                level = VALIDATOR_LEVEL.UNKNOWN
-+                kind = VALIDATOR_KIND.UNKNOWN
- 
--            ve = PythonError(
-+            ve = ValidationError(
-                 message=m.message,
-                 message_args=m.message_args,
-                 lineno=m.lineno,
--                type_=type_,
--                subtype=subtype,
-+                level=level,
-+                kind=kind,
-                 filename=filename
-                 )
-             yield ve
-diff --git a/pida-plugins/python_lint/python_lint.py b/pida-plugins/python_lint/python_lint.py
---- a/pida-plugins/python_lint/python_lint.py
-+++ b/pida-plugins/python_lint/python_lint.py
-@@ -22,7 +22,6 @@ from pida.core.log import Log
- 
- from pida.core.languages import (LanguageService, Validator, External)
- from pida.utils.languages import (
--    LANG_VALIDATOR_TYPES, LANG_VALIDATOR_SUBTYPES, LANG_PRIO,
-    Definition, Suggestion, Documentation, ValidationError)
- 
- # locale
-@@ -90,16 +89,15 @@ except ImportError:
- #         pass
- 
- SUBTYPE_MAPPING = {
--'W0511': LANG_VALIDATOR_SUBTYPES.FIXME,
--'W0622': LANG_VALIDATOR_SUBTYPES.REDEFINED,
--'W0611': LANG_VALIDATOR_SUBTYPES.UNUSED,
--'W0612': LANG_VALIDATOR_SUBTYPES.UNUSED,
--'E1101': LANG_VALIDATOR_SUBTYPES.UNDEFINED,
--'W0201': LANG_VALIDATOR_SUBTYPES.UNDEFINED,
--'W0212': LANG_VALIDATOR_SUBTYPES.PROTECTION,
--'W0703': LANG_VALIDATOR_SUBTYPES.DANGEROUS,
--'W0107': LANG_VALIDATOR_SUBTYPES.UNUSED,
--
-+    'W0511': 'fixme',
-+    'W0622': 'redefined',
-+    'W0611': 'unused',
-+    'W0612': 'unused',
-+    'E1101': 'undefined',
-+    'W0201': 'undefined',
-+    'W0212': 'protection',
-+    'W0703': 'dangerous',
-+    'W0107': 'unused',
- }
- 
- 
-@@ -122,11 +120,11 @@ class PythonError(ValidationError, Log):
-                 message_string = self.message
-         else:
-             message_string = self.message
--        if self.type_ == LANG_VALIDATOR_TYPES.ERROR:
-+        if self.type_ == 'error':
-             typec = self.lookup_color('pida-val-error')
--        elif self.type_ == LANG_VALIDATOR_TYPES.INFO:
-+        elif self.type_ == 'error':
-             typec = self.lookup_color('pida-val-info')
--        elif self.type_ == LANG_VALIDATOR_TYPES.WARNING:
-+        elif self.type_ == 'warning':
-             typec = self.lookup_color('pida-val-warning')
-         else:
-             typec = self.lookup_color('pida-val-def')
-@@ -144,10 +142,9 @@ class PythonError(ValidationError, Log):
-     """>:<span style="italic">%(subtype)s</span>  -  """
-     """<span size="small" style="italic">%(msg_id)s</span>\n%(message)s""" % 
-                       {'lineno':self.lineno,
--                      'type':_(LANG_VALIDATOR_TYPES.whatis(self.type_).capitalize()),
--                      'subtype':_(LANG_VALIDATOR_SUBTYPES.whatis(
--                                    self.subtype).capitalize()),
--                      'message':message_string,
-+                      'type': self.level.capitalize(),
-+                      'subtype': self.kind.capitalize(),
-+                      'message': message_string,
-                       'linecolor': linecolor,
-                       'typec': typec,
-                       'msg_id': self.msg_id
-@@ -225,26 +222,26 @@ class PidaLinter(PyLinter, Log):
-             return        
-         # update stats
-         if msg_id[0] == 'I':
--            ty = LANG_VALIDATOR_TYPES.INFO
--            sty = LANG_VALIDATOR_SUBTYPES.UNKNOWN
-+            ty = 'info'
-+            sty = 'unknown'
-         elif msg_id[0] == 'C':
--            ty = LANG_VALIDATOR_TYPES.INFO
--            sty = LANG_VALIDATOR_SUBTYPES.BADSTYLE
-+            ty = 'info'
-+            sty = 'badstyle'
-         elif msg_id[0] == 'R':
--            ty = LANG_VALIDATOR_TYPES.WARNING
--            sty = LANG_VALIDATOR_SUBTYPES.BADSTYLE
-+            ty = 'info'
-+            sty = 'badstyle'
-         elif msg_id[0] == 'W':
--            ty = LANG_VALIDATOR_TYPES.WARNING
--            sty = LANG_VALIDATOR_SUBTYPES.UNKNOWN
-+            ty = 'warning'
-+            sty = 'unknown'
-         elif msg_id[0] == 'E':
--            ty = LANG_VALIDATOR_TYPES.ERROR
--            sty = LANG_VALIDATOR_SUBTYPES.UNKNOWN
-+            ty = 'error'
-+            sty = 'unknown'
-         elif msg_id[0] == 'F':
--            ty = LANG_VALIDATOR_TYPES.FATAL
--            sty = LANG_VALIDATOR_SUBTYPES.UNKNOWN
-+            ty = 'fatal'
-+            sty = 'unknown'
-         else:
--            ty = LANG_VALIDATOR_TYPES.UNKNOWN
--            sty = LANG_VALIDATOR_SUBTYPES.UNKNOWN
-+            ty = 'unknown'
-+            sty = 'unknown'
- 
-         #msg_cat = MSG_TYPES[msg_id[0]]
-         #self.stats[msg_cat] += 1
-@@ -269,8 +266,8 @@ class PidaLinter(PyLinter, Log):
-             path = node.root().file
-         # add the message
-         cmsg = PythonError( message = msg,
--                            type_ = ty,
--                            subtype = sty,
-+                            level = ty,
-+                            kind = sty,
-                             filename = path,
-                             message_args = args or (),
-                             lineno = line or 1,
-diff --git a/pida-plugins/rst/rst.py b/pida-plugins/rst/rst.py
---- a/pida-plugins/rst/rst.py
-+++ b/pida-plugins/rst/rst.py
-@@ -12,9 +12,11 @@ from collections import defaultdict
- 
- # PIDA imports
- from pida.core.languages import LanguageService, Outliner, Validator
--from pida.utils.languages import (LANG_PRIO,
--    LANG_OUTLINER_TYPES, OutlineItem,
--    LANG_VALIDATOR_TYPES, LANG_VALIDATOR_SUBTYPES, ValidationError)
-+from pida.utils.languages import (
-+    LANG_PRIO, LANG_OUTLINER_TYPES,
-+    VALIDATOR_LEVEL, VALIDATOR_KIND,
-+    OutlineItem, ValidationError,
-+)
- from pida.services.language import DOCTYPES
- 
- # docutils imports
-@@ -312,20 +314,20 @@ class RSTValidator(Validator):
-     name = "rst validator"
-     description = _("A validator for ReStructuredText")
- 
--    subtype = LANG_VALIDATOR_SUBTYPES.SYNTAX
-+    kind = VALIDATOR_KIND.SYNTAX
- 
-     def get_validations(self):
-         self.rstplugin = RSTPlugin(self.svc)
-         self.doctree = self.rstplugin.parse_rst(self.document)
-         if self.doctree:
-             for msg in self.doctree.parse_messages :
--                message, type_, filename, lineno = self._parse_error(msg)
-+                message, level, filename, lineno = self._parse_error(msg)
-                 # TODO need to filter out duplicates with no lineno set
-                 # not sure why this happens...
-                 if lineno:
-                     yield ValidationError (message=message,
--                                           type_=type_,
--                                           subtype=self.subtype,
-+                                           level=level,
-+                                           kind=self.kind,
-                                            filename=filename,
-                                            lineno=lineno)
- 
-@@ -335,9 +337,7 @@ class RSTValidator(Validator):
-         message = textwrap.fill(msg.children[0].children[0].data, width)
-         # docutils defines the following error levels:
-         #     "info/1", '"warning"/"2" (default), "error"/"3", "severe"/"4"
--        type_ = (LANG_VALIDATOR_TYPES.INFO, LANG_VALIDATOR_TYPES.WARNING,
--                 LANG_VALIDATOR_TYPES.ERROR, LANG_VALIDATOR_TYPES.FATAL
--                )[msg['level'] - 1]
-+        type_ = VALIDATOR_LEVEL[msg['level']]
-         filename = msg.source
-         lineno = msg.line
-         return (message, type_, filename, lineno)
-diff --git a/pida/core/languages.py b/pida/core/languages.py
---- a/pida/core/languages.py
-+++ b/pida/core/languages.py
-@@ -16,7 +16,7 @@ from pida.core.projects import Project
- from pida.core.service import Service
- from pida.core.features import FeaturesConfig
- from pida.utils.languages import (
--    LANG_VALIDATOR_TYPES, LANG_VALIDATOR_SUBTYPES, LANG_PRIO,
-+    COMPLETER, LANG_PRIO,
-     Suggestion, Definition, ValidationError, Documentation)
- from pida.utils.path import get_relative_path
- # locale
-diff --git a/pida/utils/languages.py b/pida/utils/languages.py
---- a/pida/utils/languages.py
-+++ b/pida/utils/languages.py
-@@ -41,14 +41,13 @@ COMPLETER = Symbols('completer', [
- 
- 
- 
--# main types
--LANG_VALIDATOR_TYPES = Enumeration('LANG_TYPES',
--    ('UNKNOWN', 'INFO', 'WARNING', 'ERROR', 'FATAL'))
-+VALIDATOR_KIND = Symbols('validation errors',
-+    ('unknown', 'syntax', 'indentation', 'undefined', 'redefined', 'badstyle',
-+     'duplicate', 'unused', 'fixme', 'protection', 'dangerous'))
- 
--# validation sub types
--LANG_VALIDATOR_SUBTYPES = Enumeration('LANG_VALIDATION_ERRORS',
--    ('UNKNOWN', 'SYNTAX', 'INDENTATION', 'UNDEFINED', 'REDEFINED', 'BADSTYLE',
--     'DUPLICATE', 'UNUSED', 'FIXME', 'PROTECTION', 'DANGEROUS'))
-+VALIDATOR_LEVEL = Symbols('validation level',
-+    ('unknown', 'info', 'warning', 'error', 'fatal'))
-+
- 
- # validation sub types
- 
-@@ -116,8 +115,8 @@ class ValidationError(InitObject):
-     """Message a Validator should return"""
-     message = ''
-     message_args = None
--    type_ = LANG_VALIDATOR_TYPES.UNKNOWN
--    subtype = LANG_VALIDATOR_SUBTYPES.UNKNOWN
-+    level = VALIDATOR_LEVEL.UNKNOWN
-+    kind = VALIDATOR_KIND.UNKNOWN
-     filename = None
-     lineno = None
- 
-@@ -134,41 +133,25 @@ class ValidationError(InitObject):
-         pass
- 
-     def get_markup(self):
--        if self.type_ == LANG_VALIDATOR_TYPES.ERROR:
--            typec = self.lookup_color('pida-val-error')
--        elif self.type_ == LANG_VALIDATOR_TYPES.INFO:
--            typec = self.lookup_color('pida-val-info')
--        elif self.type_ == LANG_VALIDATOR_TYPES.WARNING:
--            typec = self.lookup_color('pida-val-warning')
--        else:
--            typec = self.lookup_color('pida-val-def')
--        
-+        mapping = {
-+            VALIDATOR_LEVEL.ERROR: 'pida-val-error',
-+            VALIDATOR_LEVEL.INFO: 'pida-val-info',
-+            VALIDATOR_LEVEL.WARNING: 'pida-val-warning',
-+        }
-+        typec = mapping.get(self.kind, 'pida-val-def')
-+
-         markup = ("""<tt><span color="%(linecolor)s">%(lineno)s</span> </tt>"""
-     """<span foreground="%(typec)s" style="italic" weight="bold">%(type)s</span"""
-     """>:<span style="italic">%(subtype)s</span>\n%(message)s""" % 
-                       {'lineno':self.lineno, 
--                      'type':_(LANG_VALIDATOR_TYPES.whatis(self.type_).capitalize()),
--                      'subtype':_(LANG_VALIDATOR_SUBTYPES.whatis(
--                                    self.subtype).capitalize()),
-+                      'type': self.level.capitalize(),
-+                      'subtype': self.kind.capitalize(),
-                       'message':self.message,
-                       'linecolor': color_to_string(self.lookup_color('pida-lineno')),
-                       'typec': color_to_string(typec),
-                       })
-         return markup
-     markup = property(get_markup)
--#     def get_markup(self):
--#         #args = [('<b>%s</b>' % arg) for arg in msg.message_args]
--#         #message_string = self.message % tuple(args)
--#         #msg.name = msg.__class__.__name__
--#         markup = ('<tt>%s </tt><i>%s:%s</i>\n%s' % 
--#                       (self.lineno, 
--#                       LANG_VALIDATOR_TYPES.whatis(self.type_).capitalize(),
--#                       LANG_VALIDATOR_SUBTYPES.whatis(self.subtype).capitalize(),
--#                       self.message))
--#         return markup
--#     
--#     markup = property(get_markup)
--
- 
- 
- 

pylint-kill-skeleton

-# HG changeset patch
-# Parent 9710722280a755991ffd49dbad4e1592629f80ea
-kill some skeleton code from pylint
-
-diff --git a/pida-plugins/python_lint/python_lint.py b/pida-plugins/python_lint/python_lint.py
---- a/pida-plugins/python_lint/python_lint.py
-+++ b/pida-plugins/python_lint/python_lint.py
-@@ -44,49 +44,6 @@ except ImportError:
-     pylint = None
-     BaseReporter = object
- 
--# class SkeletonEventsConfig(EventsConfig):
--#
--#     def subscribe_all_foreign(self):
--#         self.subscribe_foreign('buffer', 'document-changed',
--#                     self.on_document_changed)
--#
--#     def on_document_changed(self, document):
--#         pass
--#
--#
--# class SkeletonFeaturesConfig(FeaturesConfig):
--#
--#     def subscribe_all_foreign(self):
--#         pass
--#
--#
--# class SkeletonOptionsConfig(OptionsConfig):
--#
--#     def create_options(self):
--#         self.create_option(
--#             'Skeleton_for_executing',
--#             _('Skeleton Executable for executing'),
--#             str,
--#             'Skeleton',
--#             _('The Skeleton executable when executing a module'),
--#         )
--#
--#
--# class SkeletonActionsConfig(ActionsConfig):
--#
--#     def create_actions(self):
--#         self.create_action(
--#             'execute_Skeleton',
--#             TYPE_NORMAL,
--#             _('Execute Skeleton Module'),
--#             _('Execute the current Skeleton module in a shell'),
--#             gtk.STOCK_EXECUTE,
--#             self.on_Skeleton_execute,
--#         )
--#
--#     def on_Skeleton_execute(self, action):
--#         #self.svc.execute_current_document()
--#         pass
- 
- SUBTYPE_MAPPING = {
-     'W0511': 'fixme',
-symbols-util
-kill-completer-types-enum
-kill-validator-types-subtypes-enums
-kill-outliner-types-enum
-pylint-kill-skeleton
-cleanup-validator-markup
 core-pdbus-pyxml-introspect #+dbus
 pida-remote-cleanup
 non-optional-core-pdbus #+dbus #-stable

symbols-util

-# HG changeset patch
-# Parent b51f85401eb94624b0ae37ec36c28097fdcbceb5
-create pida.utils.symbol as collection of ordered string constants/enums
-
-diff --git a/pida/utils/symbols.py b/pida/utils/symbols.py
-new file mode 100644
---- /dev/null
-+++ b/pida/utils/symbols.py
-@@ -0,0 +1,31 @@
-+
-+
-+class Symbols(object):
-+
-+    def __init__(self, name, items):
-+        self.items = {}
-+        self.name = name
-+        for index, value in enumerate(items):
-+            if not value.islower():
-+                raise ValueError('%s is not lower')
-+            self.items[index] = value
-+            self.items[value] = index
-+            setattr(self, value.upper(), value)
-+
-+    def key(self, item):
-+        """
-+        :param str item: one of the symbols
-+
-+        key function for sorting a list of symbols
-+        everything str thats not in this symbol bag gets sorted last
-+        """
-+        return self.items.get(item.lower(), len(self.items))
-+
-+    def __contains__(self, key):
-+        return key.lower() in self.items
-+
-+    def __getitem__(self, item):
-+        return self.items[item]
-+
-+    def __iter__(self):
-+        raise TypeError("a bag of symbols is not iterable")
-diff --git a/tests/utils/test_symbols.py b/tests/utils/test_symbols.py
-new file mode 100644
---- /dev/null
-+++ b/tests/utils/test_symbols.py
-@@ -0,0 +1,35 @@
-+from pida.utils.symbols import Symbols
-+from py.test import raises
-+
-+
-+def pytest_funcarg__table(request):
-+    return Symbols('test', 'ab')
-+
-+
-+def test_attrs(table):
-+    assert table.A == 'a'
-+    assert table.B == 'b'
-+
-+def test_content(table):
-+    assert table['a'] == 0
-+    assert table['b'] == 1
-+    assert table[0] == 'a'
-+    assert table[1] == 'b'
-+
-+def test_needs_lower():
-+    raises(ValueError, Symbols, 'name', ['Foo'])
-+
-+def test_contains(table):
-+    assert 'a' in table
-+    assert 'A' in table
-+
-+def test_order():
-+    t = Symbols('test', 'ba')
-+    l = ['c', 'a', 'b']
-+    l.sort(key=t.key)
-+    #XXX: None sorts before anything else
-+    assert l == ['b', 'a', 'c']
-+
-+def test_not_iterable(table):
-+    with raises(TypeError):
-+        list(table)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.