QPlainTextEdit With In Line Spell Check

Update: Simplified Highlighter.highlightBlock function One thing Qt lacks is an integrated spell check in the text entry components. For a project I’m working on this is necessary. Using python-enchant and the QSyntaxHighlighter I was able to implement this functionality. Here is how to add an in line spell check support to a QPlainTextEdit. #!/usr/bin/env python # -*- coding: utf-8 -*- __license__ = 'MIT' __copyright__ = '2009, John Schember ' __docformat__ = 'restructuredtext en' import re import sys import enchant from PyQt4....

August 22, 2009 · John

Better QPlainTextEdit With Line Numbers

My last post was an implementation of a Qt widget which displays text with line numbers. I found that it has a few limitations. The biggest was a performance penalty when dealing with large documents. I’ve since re-factored and rewritten the class to make the performance acceptable. I’ve also cleaned up the code a bit and added a highlight to the current line. ''' Text widget with support for line numbers ''' from PyQt4....

August 19, 2009 · John

QTextEdit With Line Numbers

Here is a Qt4 widget written in Python that allows for line numbers next to a QTextEdit. Similar to what is seen in a number of text editors such as gedit and kate. from PyQt4.Qt import QFrame, QWidget, QTextEdit, QHBoxLayout, QPainter class LineTextWidget(QFrame): class NumberBar(QWidget): def __init__(self, *args): QWidget.__init__(self, *args) self.edit = None # This is used to update the width of the control. # It is the highest line that is currently visibile....

August 15, 2009 · John

Calibre Two Weeks in Review

This time I missed last weeks week in review because I simply forgot. I’m hoping to keep this to a minimum in the future. The big news is calibre 0.6 has been released. Kovid is now back to his regular (weekly at the least) bug fix releases too. As of now the latest version is 0.6.4 and I get the feeling that 0.6.5 is right around the corner. For a listing of what’s gone into the 0....

August 2, 2009 · John

Calibre Week in Review

There was no week in review last week because I went on vacation this past week. So this week in review combines everything since the last week in review. I’ve made a few bug fixes to some output formats, PDB metadata and FB2 output mainly. The major things I’ve been working on is a bit of restructuring for the GUI and fixing some small bugs. The GUI has had the button in the status bar (jobs, tags, cover flow) moved to a side bar on the right hand side....

July 19, 2009 · John

Calibre Week in Review

This week has been a productive one. I’ve made a lot of small GUI enhancements and did some work on PDF input as well. All of these changes have not made it into trunk yet. This is mainly because Kovid has been away this week. I’ve added auto complete to a number of the input control on the GUI. Authors, Publisher, and Tags all auto complete pretty much everywhere now. The Tags will even auto complete in the table view in the main window....

July 5, 2009 · John

Calibre Week in Review

This week hasn’t seen very much in the way of new features from me. I’ve only added one. This is mainly because I’ve been doing small bug fixes leading up to the beta for 0.6. The new feature, which Kovid helped me to implement, is ejecting the reader from within the GUI. When you mouse over the reader icon in the location list it will show an eject button next to the icon....

June 6, 2009 · John

Calibre Week in Review

A lot of work went into eReader and PML to have it supported better. Also, a new format has been added. The XHTML to PML parser has been completely rewritten. It is based on the XHTML to FB2 parser I wrote for FB2 output. It produces much better looking PML markup and the displayed output looks very close to the original XHTML source. One major advantage of the new parser is that it accounts for XHTML style information and translates that into PML tags....

May 24, 2009 · John

Calibre Week in Review

This week comes with some great new additions. It also comes with some great new challenges. Not to mention more work for next week. eReader output is complete and working. The files produced are the same format as those produced by Dropbook (more on this in a bit). In addition to eReader output I’ve added metadata writing for eReader files. There is one major issue I’ve come across concerning the eReader format....

May 16, 2009 · John

Calibre Week in Review

Device interfaces can now be configured in the GUI. Also, there is a simple framework for creating plugin configuration widgets. I’ve added a metadata reader for the eReader format. However, eReader supports 3 ways to set the metadata in the file. In the pdb header (only supports setting a short title). In the metadata section of the file (supports the most information: title, author, publisher, copyright, isbn). Embedded in the text as a comment....

May 10, 2009 · John