Editor: a better QTextEdit
Writing an editor is reinventing the wheel. I know that. I tell myself Marave is a fine wheel, with distinct features, and I think that is true, but, if you are reinventing the wheel, there's no need to reinvent the axle and the spoke, too.
So, I refactored the stuff that I think a text editor must provide into a nice library, so the next time someone must invent a wheel, he can use Marave's neat spokes and axles:
So, introducing Editor, the most-obviously named class ever! It's a text editing widget for PyQt with extra features, which you can use as a drop-in replacement for a QTextEdit or QPlainTextEdit.
Right now, it lives inside Marave's SVN but it may even move out someday.
Here are its features:
-
Syntax highlighting
And I don't mean "in theory", like QTextEdit and company do! Editor can highlight a bunch of languages, because it uses GNU source highlight via Lorenzo Bettini's Source Highlight Qt.
-
Spell checking
If you have PyEnchant installed and the right dictionaries, it will do online spellchecking.
-
Search and Search+Replace widgets
The Editor class can give you nice widgets for search or search and replace already hooked with the editor widget, so you can add them to your app's UI easily.
-
new/open/save/saveas methods:
Don't implement opening/saving, etc yourself! That's always the same code!
Hopefully this will be helpful for someone else :-)
Nice. FYI: I worked on a QPlainTextEdit widget, too. Some preview videos are available at http://www.youtube.com/view...
Code will be released soon (after I cleaned up some stuff).
Whoa, that's seriously impressive widgetry!
I've been working for a project called Prymatex for a month or so, the main goal is to produce a programmer text editor compatible with TextMate's bundle set, released unnder GNU GPL (TextMate is propietary code, but the syntax, commands, templates, etc. are not). Although it's a GPL editor, it has lots of thing that need to be polished.
Right now we're struggling with cytpes and Oniguruma, but there's a lot to be done regarding to QTextEdit and I belive your code will be very helpful. Are you going to mantain the project and maybe become an alternative to QScinitlla o C++'s QCodeEdit?
Thanks for sharing :)
OMG, CodeAide seems awesome!
How hard would it be to implement multiple selections with QtTextEdit? ( ala http://sublime.akalias.net/... )
QTextEdit already supports multiple selections, AFAIK, there's just no UI to actually use them. I'll take a look at that link in a moment to see if I understood you corretly (right now, I need to make pizza!)
this is really interesting viewpoint on the subject i might add
Man ... Beautiful . Amazing ... I will bookmark your website and use the your RSS feed also