1
# -*- coding: utf-8 -*-
2
# Copyright (c) 2013 by Pablo Martín <goinnn@gmail.com>
4
# This software is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU Lesser General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
9
# This software is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU Lesser General Public License for more details.
14
# You should have received a copy of the GNU Lesser General Public License
15
# along with this software. If not, see <http://www.gnu.org/licenses/>.
19
from PyKDE4.kdecore import i18n
20
from libkatepate.menu import move_menu_submenu, separated_menu
23
PY_CHECKERS = i18n("Checkers")
26
'insertIPDB': {'text': 'ipdb', 'shortcut': 'Ctrl+I',
27
'menu': PY_MENU, 'icon': 'tools-report-bug'},
28
'insertInit': {'text': i18n('__init__ method'), 'shortcut': 'Ctrl+,',
29
'menu': PY_MENU, 'icon': None},
30
'insertSuper': {'text': i18n('call super'), 'shortcut': 'Alt+,',
31
'menu': PY_MENU, 'icon': None},
32
'callRecursive': {'text': i18n('call recursive'), 'shortcut': 'Ctrl+Alt+,',
33
'menu': PY_MENU, 'icon': None},
34
'checkAll': {'text': i18n('Check all'), 'shortcut': 'Alt+5',
35
'menu': PY_CHECKERS, 'icon': None},
36
'checkPyflakes': {'text': 'Pyflakes', 'shortcut': 'Alt+7',
37
'menu': PY_CHECKERS, 'icon': None},
38
'parseCode': {'text': i18n('Syntax Errors'), 'shortcut': 'Alt+6',
39
'menu': PY_CHECKERS, 'icon': None},
40
'checkPep8': {'text': 'Pep8', 'shortcut': 'Alt+8',
41
'menu': PY_CHECKERS, 'icon': None},
44
KATE_CONFIG = {'name': 'python_utils',
45
'fullName': i18n('Python Utils'),
46
'icon': 'text-x-python'}
48
_PEP8_CHECK_WHEN_SAVE = 'PythonUtils:checkPEP8WhenSave'
49
_IGNORE_PEP8_ERRORS = 'PythonUtils:ignorePEP8Errors'
50
_PYFLAKES_CHECK_WHEN_SAVE = 'PythonUtils:checkPyFlakesWhenSave'
51
_PARSECODE_CHECK_WHEN_SAVE = 'PythonUtils:checkParseCode'
52
_IPDB_SNIPPET = 'PythonUtils:ipdbSnippet'
54
DEFAULT_CHECK_PEP8_WHEN_SAVE = True
57
DEFAULT_IGNORE_PEP8_ERRORS = pep8.DEFAULT_IGNORE
59
DEFAULT_IGNORE_PEP8_ERRORS = ''
60
DEFAULT_CHECK_PYFLAKES_WHEN_SAVE = True
61
DEFAULT_PARSECODE_CHECK_WHEN_SAVE = True
62
DEFAULT_IPDB_SNIPPET = "import ipdb; ipdb.set_trace()"
64
TEXT_INIT = """\tdef __init__(self, *args, **kwargs):
65
\t\tsuper(%s, self).__init__(*args, **kwargs)
67
TEXT_SUPER = """%ssuper(%s, %s).%s(%s)\n"""
68
TEXT_RECURSIVE_CLASS = """%s%s.%s(%s)\n"""
69
TEXT_RECURSIVE_NO_CLASS = """%s%s(%s)\n"""
74
py_menu_slug = PY_MENU.lower()
75
py_checkers_slug = PY_CHECKERS.lower()
76
separated_menu(py_menu_slug)
77
move_menu_submenu(py_menu_slug, py_checkers_slug)
80
# kate: space-indent on; indent-width 4;