~ubuntu-branches/ubuntu/vivid/kate/vivid-proposed

« back to all changes in this revision

Viewing changes to addons/pate/src/plugins/python_utils/python_settings.py

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
# Copyright (c) 2013 by Pablo Martín <goinnn@gmail.com>
 
3
#
 
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.
 
8
#
 
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.
 
13
#
 
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/>.
 
16
 
 
17
import kate
 
18
 
 
19
from PyKDE4.kdecore import i18n
 
20
from libkatepate.menu import move_menu_submenu, separated_menu
 
21
 
 
22
PY_MENU = "Python"
 
23
PY_CHECKERS = i18n("Checkers")
 
24
 
 
25
KATE_ACTIONS = {
 
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},
 
42
}
 
43
 
 
44
KATE_CONFIG = {'name': 'python_utils',
 
45
               'fullName': i18n('Python Utils'),
 
46
               'icon': 'text-x-python'}
 
47
 
 
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'
 
53
 
 
54
DEFAULT_CHECK_PEP8_WHEN_SAVE = True
 
55
try:
 
56
    import pep8
 
57
    DEFAULT_IGNORE_PEP8_ERRORS = pep8.DEFAULT_IGNORE
 
58
except ImportError:
 
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()"
 
63
 
 
64
TEXT_INIT = """\tdef __init__(self, *args, **kwargs):
 
65
\t\tsuper(%s, self).__init__(*args, **kwargs)
 
66
"""
 
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"""
 
70
 
 
71
 
 
72
@kate.init
 
73
def move_menus():
 
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)
 
78
 
 
79
 
 
80
# kate: space-indent on; indent-width 4;