View Single Post
Old 12-15-2011, 10:37 AM   #12
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Ok, one step forward, two backwards it seems. I found that converting my python date into a QDateTime meant that QTableWidget creates the right sort of editor. However, the next error I get is this:

Traceback (most recent call last):
File "D:\CalibreDev\latest\calibre\src\calibre\gui2\lib rary\delegates.py", line 277, in setEditorData
AttributeError: 'QAbstractTableModel' object has no attribute 'db'

I thought I could fudge this by doing something like this when I populate the table:
self.model().db = self.db

But that ain't doing it for me either. Wondering if I should just write my own CCDateDelegate that takes a db in, so it doesn't have to try to get it from the model...

EDIT - that is definitely what I am going to do. Because I can now see the next problem will be how the editor tries to get its value, since the delegate does some mapping column lookups, none of which I want to have to replicate.

Still, the Calibre class gave me something I can copy/paste from - thanks guys

Last edited by kiwidude; 12-15-2011 at 10:44 AM.
kiwidude is offline   Reply With Quote