Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Code and repository cleaning

  • Loading branch information...
commit effbdc7b6c1849ed4c64d993f5d281b792722d89 1 parent 4e5469b
@khertan authored
Showing with 92 additions and 24 deletions.
  1. +40 −0 .gitignore
  2. +7 −6 README.md
  3. +24 −11 khtsimpletext/__init__.py
  4. BIN  khtsimpletext/pygments/__init__.pyc
  5. BIN  khtsimpletext/pygments/cmdline.pyc
  6. BIN  khtsimpletext/pygments/console.pyc
  7. BIN  khtsimpletext/pygments/filter.pyc
  8. BIN  khtsimpletext/pygments/filters/__init__.pyc
  9. BIN  khtsimpletext/pygments/formatter.pyc
  10. BIN  khtsimpletext/pygments/formatters/__init__.pyc
  11. BIN  khtsimpletext/pygments/formatters/_mapping.pyc
  12. BIN  khtsimpletext/pygments/formatters/bbcode.pyc
  13. BIN  khtsimpletext/pygments/formatters/html.pyc
  14. BIN  khtsimpletext/pygments/formatters/img.pyc
  15. BIN  khtsimpletext/pygments/formatters/latex.pyc
  16. BIN  khtsimpletext/pygments/formatters/other.pyc
  17. BIN  khtsimpletext/pygments/formatters/rtf.pyc
  18. BIN  khtsimpletext/pygments/formatters/svg.pyc
  19. BIN  khtsimpletext/pygments/formatters/terminal.pyc
  20. BIN  khtsimpletext/pygments/formatters/terminal256.pyc
  21. BIN  khtsimpletext/pygments/lexer.pyc
  22. BIN  khtsimpletext/pygments/lexers/__init__.pyc
  23. BIN  khtsimpletext/pygments/lexers/_asybuiltins.pyc
  24. BIN  khtsimpletext/pygments/lexers/_clbuiltins.pyc
  25. BIN  khtsimpletext/pygments/lexers/_luabuiltins.pyc
  26. BIN  khtsimpletext/pygments/lexers/_mapping.pyc
  27. BIN  khtsimpletext/pygments/lexers/_phpbuiltins.pyc
  28. BIN  khtsimpletext/pygments/lexers/_vimbuiltins.pyc
  29. BIN  khtsimpletext/pygments/lexers/agile.pyc
  30. BIN  khtsimpletext/pygments/lexers/asm.pyc
  31. BIN  khtsimpletext/pygments/lexers/compiled.pyc
  32. BIN  khtsimpletext/pygments/lexers/dotnet.pyc
  33. BIN  khtsimpletext/pygments/lexers/functional.pyc
  34. BIN  khtsimpletext/pygments/lexers/math.pyc
  35. BIN  khtsimpletext/pygments/lexers/other.pyc
  36. BIN  khtsimpletext/pygments/lexers/parsers.pyc
  37. BIN  khtsimpletext/pygments/lexers/special.pyc
  38. BIN  khtsimpletext/pygments/lexers/templates.pyc
  39. BIN  khtsimpletext/pygments/lexers/text.pyc
  40. BIN  khtsimpletext/pygments/lexers/web.pyc
  41. BIN  khtsimpletext/pygments/plugin.pyc
  42. BIN  khtsimpletext/pygments/scanner.pyc
  43. BIN  khtsimpletext/pygments/style.pyc
  44. BIN  khtsimpletext/pygments/styles/__init__.pyc
  45. BIN  khtsimpletext/pygments/styles/autumn.pyc
  46. BIN  khtsimpletext/pygments/styles/borland.pyc
  47. BIN  khtsimpletext/pygments/styles/bw.pyc
  48. BIN  khtsimpletext/pygments/styles/colorful.pyc
  49. BIN  khtsimpletext/pygments/styles/default.pyc
  50. BIN  khtsimpletext/pygments/styles/emacs.pyc
  51. BIN  khtsimpletext/pygments/styles/friendly.pyc
  52. BIN  khtsimpletext/pygments/styles/fruity.pyc
  53. BIN  khtsimpletext/pygments/styles/manni.pyc
  54. BIN  khtsimpletext/pygments/styles/monokai.pyc
  55. BIN  khtsimpletext/pygments/styles/murphy.pyc
  56. BIN  khtsimpletext/pygments/styles/native.pyc
  57. BIN  khtsimpletext/pygments/styles/pastie.pyc
  58. BIN  khtsimpletext/pygments/styles/perldoc.pyc
  59. BIN  khtsimpletext/pygments/styles/tango.pyc
  60. BIN  khtsimpletext/pygments/styles/trac.pyc
  61. BIN  khtsimpletext/pygments/styles/vim.pyc
  62. BIN  khtsimpletext/pygments/styles/vs.pyc
  63. BIN  khtsimpletext/pygments/token.pyc
  64. BIN  khtsimpletext/pygments/unistring.pyc
  65. BIN  khtsimpletext/pygments/util.pyc
  66. +0 −5 khtsimpletext/qml/EditPage.qml
  67. +15 −0 khtsimpletext/qml/main.qml
  68. +6 −2 make.py
View
40 .gitignore
@@ -0,0 +1,40 @@
+# Compiled source #
+###################
+*.com
+*.class
+*.dll
+*.exe
+*.o
+*.so
+*.pyc
+*.pyo
+
+# Packages #
+############
+# it's better to unpack these files and commit the raw source
+# git has its own built in compression methods
+*.7z
+*.dmg
+*.gz
+*.iso
+*.jar
+*.rar
+*.tar
+*.zip
+*.deb
+*.changes
+*.dsc
+
+# Logs and databases #
+######################
+*.log
+*.sql
+*.sqlite
+
+# OS generated files #
+######################
+.DS_Store*
+ehthumbs.db
+Icon?
+Thumbs.db
+
View
13 README.md
@@ -7,21 +7,21 @@ a simple text editor for harmattan specially designed for n9 and n950 device. Cu
* Delete / Rename file
* Markdown Preview
* Copy / Move file
- * Preferences for changing font
- * Syntax highlighting for many languages
+ * Preferences for changing font family and size
+ * Syntax highlighting for many languages
I've also planned to implement other features :
* Auto save feature
+ * Add a gui for preferences
+ * Rewrite folderModel to show hidden files
-Know bugs :
-
- * add hidden file in the folder model
Some screenshots of an older version :
![KhtSimpleText Screenshot 1][4]
![KhtSimpleText Screenshot 2][5]
![KhtSimpleText Screenshot 3][6]
+![KhtSimpleText Screenshot 4][8]
Of course for more informations (source, bugtracker, ...) : [KhtSimpleText][7]
@@ -29,4 +29,5 @@ Of course for more informations (source, bugtracker, ...) : [KhtSimpleText][7]
[4]:http://khertan.net/medias/khtsimpletext_screenshot_1.png
[5]:http://khertan.net/medias/khtsimpletext_screenshot_2.png
[6]:http://khertan.net/medias/khtsimpletext_screenshot_3.png
-[7]:http://khertan.net/KhtSimpleText
+[7]:http://khertan.net/KhtSimpleText
+[8]:http://khertan.net/medias/khtsimpletext_screenshot_3.png
View
35 khtsimpletext/__init__.py
@@ -128,7 +128,12 @@ def _colorIt(self, text):
return
self._set_text(highlight(text, lexer, HtmlFormatter(full=True)))
self._set_colored(True)
- except:
+ except pygments.util.ClassNotFound:
+ self._set_text(text)
+ self._set_colored(False)
+ except Exception, e:
+ print e
+ self.on_error.emit(str(e))
self._set_text(text)
self._set_colored(False)
@@ -175,8 +180,12 @@ def _stripTags(self,content):
def write(self, data):
if self._colored:
data = self._stripTags(data)
- with open(self.filepath, 'wb') as fh:
- fh.write(data.encode('utf-8'))
+ try:
+ with open(self.filepath, 'wb') as fh:
+ fh.write(data.encode('utf-8'))
+ except Exception, e:
+ print e
+ self.on_error.emit(str(e))
def _get_text(self):
return self._text
@@ -223,8 +232,8 @@ def newFolder(self,path):
def rename(self,pathdir,oldname,newname):
try:
pathdir = os.path.dirname(QUrl(pathdir).path())
- oldpath = QUrl(oldname).path()
- newpath = QUrl(newname).path()
+ #oldpath = QUrl(oldname).path()
+ #newpath = QUrl(newname).path()
os.rename(os.path.join(pathdir, oldname),os.path.join(pathdir, newname))
return True
except:
@@ -277,14 +286,18 @@ def __init__(self):
self.setApplicationName("KhtSimpleText")
self.view = QtDeclarative.QDeclarativeView()
- self.view.rootContext().setContextProperty("argv", sys.argv)
- self.view.rootContext().setContextProperty("__version__", __version__)
- self.view.rootContext().setContextProperty("Settings", Settings())
- self.view.rootContext().setContextProperty("QmlDirReaderWriter", QmlDirReaderWriter())
- self.view.rootContext().setContextProperty('Document', Document())
+ self.aDocument = Document()
+ self.rootContext = self.view.rootContext()
+ self.rootContext.setContextProperty("argv", sys.argv)
+ self.rootContext.setContextProperty("__version__", __version__)
+ self.rootContext.setContextProperty("Settings", Settings())
+ self.rootContext.setContextProperty("QmlDirReaderWriter", QmlDirReaderWriter())
+ self.rootContext.setContextProperty('Document', self.aDocument)
self.view.setSource(QUrl.fromLocalFile(
os.path.join(os.path.dirname(__file__), 'qml', 'main.qml')))
+ self.rootObject = self.view.rootObject()
+ self.aDocument.on_error.connect(self.rootObject.onError)
self.view.showFullScreen()
if __name__ == '__main__':
- sys.exit(KhtSimpleText().exec_())
+ sys.exit(KhtSimpleText().exec_())
View
BIN  khtsimpletext/pygments/__init__.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/cmdline.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/console.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/filter.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/filters/__init__.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatter.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/__init__.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/_mapping.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/bbcode.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/html.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/img.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/latex.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/other.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/rtf.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/svg.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/terminal.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/formatters/terminal256.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexer.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/__init__.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/_asybuiltins.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/_clbuiltins.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/_luabuiltins.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/_mapping.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/_phpbuiltins.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/_vimbuiltins.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/agile.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/asm.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/compiled.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/dotnet.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/functional.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/math.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/other.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/parsers.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/special.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/templates.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/text.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/lexers/web.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/plugin.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/scanner.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/style.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/__init__.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/autumn.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/borland.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/bw.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/colorful.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/default.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/emacs.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/friendly.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/fruity.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/manni.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/monokai.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/murphy.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/native.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/pastie.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/perldoc.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/tango.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/trac.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/vim.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/styles/vs.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/token.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/unistring.pyc
Binary file not shown
View
BIN  khtsimpletext/pygments/util.pyc
Binary file not shown
View
5 khtsimpletext/qml/EditPage.qml
@@ -11,11 +11,6 @@ Page {
property bool modified;
property bool colored;
- signal refresh();
-
- onRefresh: {
- }
-
onFilePathChanged: {
if (filePath !== '') {
console.log('FilePathChanger');
View
15 khtsimpletext/qml/main.qml
@@ -107,6 +107,21 @@ PageStackWindow {
anchors.horizontalCenter: parent.horizontalCenter
}
+ function onError(errMsg) {
+ errorEditBanner.text = errMsg;
+ errorEditBanner.show();
+ }
+
+ InfoBanner{
+ id:errorEditBanner
+ text: ''
+ timerShowTime: 15000
+ timerEnabled:true
+ anchors.top: parent.top
+ anchors.topMargin: 60
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
showStatusBar: true
QueryDialog {
View
8 make.py
@@ -28,6 +28,10 @@
__build__ = '1'
__author__ = "Benoît HERVIER (khertan)"
__mail__ = "khertan@khertan.net"
+__upgrade__ = '''Implement MarkDown preview
+Syntax Highlighting (not in realtime due to qml limitation)
+Fix loading of large text
+Add a busy cursor when loading text'''
if __name__ == "__main__":
try:
@@ -40,7 +44,7 @@
p.version = khtsimpletext.__version__
p.buildversion = __build__
p.description="A plain text editor for Harmattan devices (n950, n9)"
- p.upgrade_description="Implement MarkDown preview"
+ p.upgrade_description=__upgrade__
p.author=__author__
p.maintainer=__author__
p.email=__mail__
@@ -76,4 +80,4 @@
p["/opt"] = files
print p.generate(build_binary=True,build_src=False)
- print p.generate(build_binary=False,build_src=True)
+ print p.generate(build_binary=False,build_src=True)
Please sign in to comment.
Something went wrong with that request. Please try again.