Is there a way to remove filters from the filter panel?

8 views
Skip to first unread message

Yuval Greenfield

unread,
Jan 23, 2012, 7:54:05 AM1/23/12
to sql...@googlegroups.com
I noticed the API only lists "add_filter". I'd like to clear the whole filter list or remove them one by one programmatically.

Is there a way to do this in sqlkit? I noticed there isn't even a way to do it in the GUI.

Yuval

Alessandro Dentella

unread,
Jan 23, 2012, 10:28:05 AM1/23/12
to sql...@googlegroups.com

not at the moment. The reason is not very deep... I just didn't need it.

After reading you mail I tried to add that feature and I'm half way in the
attached patch. Filter panel has a gtk.Table that holds a collection of rows
one for each filter. The 3/4 widgets are build by FilterWidget but the
filtering function are segregated in FilterTool that is furtherly
specialized according to the type (bolean, text, numeric...).

In the attached patch I added the destroy method to FilterWidget and to
FilterTool and a clear() method to FilterPanel. The missing step is to add a
del_filter() methos to FilterPanel. it's a little bit more complex with the
data structure I store in FilterPanel as there's no univoque relation from
the filtering field to the FilterTool as there is also the possibility to
have more than one FilterTool/FilterWidget for the same field.

I don't currently have time to do much more, but if you want to elaborate my
patch you can easily get to what you need. At a minimum you can add the
possibility to delete the field from the GUI (I'd suggest in that case to
make the right-click on the field name a popup menu with entries: add
another filter on this field/delete this filter). Another nice-to have would
be a menu entry to the clear() method.

To add a way to programmatically change the FilterPanel we need to add a
biunivoque relationship between and even in that case we should agree to a
way to select that particular FlterTool. Suppose you have 2 filters on the
same field: e.g. year < 2010 // year > 2000. What syntax would be suitable
to delete one or the other? It may be not that worthy...


sandro
*:-)

--
Sandro Dentella *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy

filter-del.diff
Reply all
Reply to author
Forward
0 new messages