Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactored and fix some error

  • Loading branch information...
commit 5f3f6e0009890a603ebd97a2751ddc82a1018114 1 parent 0a5d854
Pablo Martín authored
7 CHANGES
View
@@ -1,7 +1,9 @@
-0.0.7 (2012-03-??)
+0.0.7 (2012-03-02)
===================
-* ...
+* Fix some errors of the 0.0.6 version (checker plugins)
+* Fix a error of JSON autocompletion
+* Update the readme
0.0.6 (2012-03-02)
===================
@@ -10,6 +12,7 @@
* PEP8 checker plugin
* PyFlakes checker plugin
* JSLint checker plugin
+* Settings to the kate actions: texts, short cuts, menus and icons
0.0.5 (2012-02-28)
===================
35 README.rst
View
@@ -69,12 +69,6 @@ Autocomplete (python)
...
'/PATH/OF/THE/EGGN/namen.egg']
-Parse syntax (python)
----------------------
-
- * Shortcut: Ctrl+6 or when you save the file
- * Pase syntax this file and show a error list, or a dialog say "OK"
-
insert IPDB (python)
--------------------
@@ -106,26 +100,39 @@ PyFlakes (python)
* Use PyFlakes to look for bad code, highlights lines with problems
* It uses `pyflakes <http://pypi.python.org/pypi/pyflakes>`_ so it must be present in the system
-template urls (django)
+Parse syntax (python)
+---------------------
+
+ * Shortcut: Alt+6 or when you save the file
+ * Parse syntax this file and show a error list, or a dialog say "OK"
+
+Refresh marks (python)
----------------------
+
+ * Shortcut: Alt+5
+ * When run pep8, pyflakes, parse syntax or jslint plugin these create marks. If after some of these create marks and after you insert a line breaks, if possible that you must run this plugin to refresh the crazy marks.
+
+
+Template Django urls (django)
+-----------------------------
* Shortcut: Ctrl+Alt+7
* Smart template of the file `urls.py <http://docs.djangoproject.com/en/dev/topics/http/urls/#example>`_
-import views (django)
-----------------------
+Template import views (django)
+------------------------------
* Shortcut: Ctrl+Alt+v
* Insert the tipical imports in a view
-Create form (django)
-----------------------
+Create Django form (django)
+---------------------------
* Shortcut: Ctrl+Alt+F
* Template to form class
-Create model (django)
-----------------------
+Create Django model (django)
+----------------------------
* Shortcut: Ctrl+Alt+M
* Template to model class
@@ -155,6 +162,8 @@ Future Plugins
==============
* Call recursive
+ * Improve autocompletes plugins
+ * Integration with rope
Other repositories of Plugins to Kate
=====================================
2  kate_plugins/autopate.py
View
@@ -146,5 +146,5 @@ def getChildrenInJSON(self, keys, json):
keys_split = keys.split(self.SEPARATOR)
if keys_split and keys_split[0] in json:
keys = self.SEPARATOR.join(keys_split[1:])
- return self.get_children_in_json(keys, json[keys_split[0]].get('children', None))
+ return self.getChildrenInJSON(keys, json[keys_split[0]].get('children', None))
return None
2  kate_plugins/kate_settings_plugins.py
View
@@ -8,7 +8,7 @@
'createForm': {'text': 'Create Django Form', 'shortcut': 'Ctrl+Alt+F', 'menu': 'Edit', 'icon': None},
'createModel': {'text': 'Create Django Model', 'shortcut': 'Ctrl+Alt+M', 'menu': 'Edit', 'icon': None},
'importUrls': {'text': 'Template Django urls', 'shortcut': 'Ctrl+Alt+7', 'menu': 'Edit', 'icon': None},
- 'importViews': {'text': 'Create Django Model', 'shortcut': 'Ctrl+Alt+v', 'menu': 'Edit', 'icon': None},
+ 'importViews': {'text': 'Template import views', 'shortcut': 'Ctrl+Alt+v', 'menu': 'Edit', 'icon': None},
'insertReady': {'text': 'jQuery Ready', 'shortcut': 'Ctrl+J', 'menu': 'Edit', 'icon': None},
'togglePrettyJsonFormat': {'text': 'Pretty Json', 'shortcut': 'Ctrl+Alt+J', 'menu': 'Edit', 'icon': None},
'checkJslint': {'text': 'JSLint', 'shortcut': 'Alt+J', 'menu': 'Edit', 'icon': None},
9 kate_plugins/pyte_plugins/check_plugins/commons.py
View
@@ -4,12 +4,13 @@
old_marks = {}
+
def showOk(message="Ok", time=3, icon='dialog-ok'):
kate.gui.popup(message, time, icon='dialog-ok', minTextWidth=200)
def generateErrorMessage(error):
- message = 'There was an error in this file:'
+ message = ''
for key, value in error.items():
if value:
message = '%s\n * %s: %s' % (message, key, value)
@@ -29,14 +30,13 @@ def showErrors(message, errors, key_mark, doc, time=10, icon='dialog-warning',
key_line='line', max_errors=3):
removeOldMarks(key_mark, doc)
mark_iface = doc.markInterface()
- message_post = ''
for i, error in enumerate(errors):
if i < max_errors:
message += '%s\n' % generateErrorMessage(error)
elif i == max_errors:
message += '\n And others'
mark = kate.KTextEditor.Mark()
- mark.line = error[key_line] - 1
+ mark.line = error[key_line] - 1
mark.type = mark_iface.Error
mark_iface.setMark(mark.line, mark.type)
old_marks[key_mark].append(mark)
@@ -44,4 +44,5 @@ def showErrors(message, errors, key_mark, doc, time=10, icon='dialog-warning',
def canCheckDocument(doc, text_plain=False):
- return not doc or (is_mymetype_python(doc, text_plain) and not doc.isModified())
+ return not doc or (is_mymetype_python(doc, text_plain) and
+ not doc.isModified())
10 kate_plugins/pyte_plugins/check_plugins/parse_plugins.py
View
@@ -5,19 +5,21 @@
from PyQt4 import QtCore
from kate_settings_plugins import kate_plugins_settings
-from utils import is_mymetype_python
-from pyte_plugins.check_plugins.commons import showOk, showErrors, canCheckDocument, removeOldMarks
+
+from pyte_plugins.check_plugins.commons import (canCheckDocument, showOk,
+ removeOldMarks, showErrors)
@kate.action(**kate_plugins_settings['parseCode'])
def parseCode(doc=None):
- if not canCheckDocument(doc, text_plain=True):
+ if not canCheckDocument(doc):
return
doc = doc or kate.activeDocument()
text = unicode(doc.text())
+ text = text.encode('utf-8', 'ignore')
mark_key = '%s-parse-python' % unicode(doc.url().path())
try:
- code = compiler.parse(text)
+ compiler.parse(text)
removeOldMarks(mark_key, doc)
showOk('Parse code Ok')
except SyntaxError, e:
9 kate_plugins/pyte_plugins/check_plugins/pep8_plugins.py
View
@@ -7,7 +7,6 @@
from kate_settings_plugins import kate_plugins_settings
from pyte_plugins.check_plugins import commons
-from utils import is_mymetype_python
class StoreErrorsChecker(pep8.Checker):
@@ -38,7 +37,8 @@ def checkPep8(currentDocument=None):
return
currentDocument = currentDocument or kate.activeDocument()
if currentDocument.isModified():
- kate.gui.popup('You must save the file first', 3, icon='dialog-warning', minTextWidth=200)
+ kate.gui.popup('You must save the file first', 3,
+ icon='dialog-warning', minTextWidth=200)
return
path = unicode(currentDocument.url().path())
mark_key = '%s-pep8' % unicode(currentDocument.url().path())
@@ -65,7 +65,8 @@ def checkPep8(currentDocument=None):
"message": error[3],
})
- commons.showErrors('Pep8 Errors:',errors_to_show, '%s-pep8' % path, currentDocument)
+ commons.showErrors('Pep8 Errors:', errors_to_show,
+ mark_key, currentDocument)
def createSignalCheckDocument(view, *args, **kwargs):
@@ -75,4 +76,4 @@ def createSignalCheckDocument(view, *args, **kwargs):
windowInterface = kate.application.activeMainWindow()
windowInterface.connect(windowInterface,
QtCore.SIGNAL('viewCreated(KTextEditor::View*)'),
- createSignalCheckDocument)
+ createSignalCheckDocument)
2  kate_plugins/pyte_plugins/check_plugins/pyflakes_plugins.py
View
@@ -47,7 +47,7 @@ def checkPyflakes(currentDocument=None):
mark_key = '%s-pyflakes' % path
text = unicode(currentDocument.text())
- errors = pyflakes(text.encode('utf-8'), path)
+ errors = pyflakes(text.encode('utf-8', 'ignore'), path)
errors_to_show = []
if len(errors) == 0:
8 kate_plugins/pyte_plugins/check_plugins/refresh_marks_plugins.py
View
@@ -3,6 +3,7 @@
from kate_settings_plugins import kate_plugins_settings
from pyte_plugins.check_plugins.parse_plugins import parseCode
+from pyte_plugins.check_plugins.pyflakes_plugins import checkPyflakes
from pyte_plugins.check_plugins.pep8_plugins import checkPep8
from jste_plugins.jslint_plugins import checkJslint
@@ -12,6 +13,7 @@ def refreshMarks():
currentDocument = kate.activeDocument()
mark_iface = currentDocument.markInterface()
mark_iface.clearMarks()
- parseCode(currentDocument)
- checkPep8(currentDocument)
- checkJslint(currentDocument)
+ parseCode()
+ checkPyflakes()
+ checkPep8()
+ checkJslint()
5 setup.py
View
@@ -20,10 +20,11 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-
+
+
setup(
name='Kate-plugins',
- version="0.0.6",
+ version="0.0.7",
description="Plugins to Kate editor to develop faster python projects, django projects and something of javascript",
long_description=(read('README.rst') + '\n\n' + read('CHANGES')),
author="Pablo Martin",
Please sign in to comment.
Something went wrong with that request. Please try again.