Helpviewer/QtHelpFiltersDialog.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2677
3d4277929fb3
parent 2999
28c75409a78f
child 3145
a9de05d4a22f
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
10 from __future__ import unicode_literals # __IGNORE_WARNING__ 10 from __future__ import unicode_literals # __IGNORE_WARNING__
11 11
12 import sqlite3 12 import sqlite3
13 13
14 from PyQt4.QtCore import pyqtSlot, Qt 14 from PyQt4.QtCore import pyqtSlot, Qt
15 from PyQt4.QtGui import QDialog, QTreeWidgetItem, QListWidgetItem, QInputDialog, QLineEdit 15 from PyQt4.QtGui import QDialog, QTreeWidgetItem, QListWidgetItem, \
16 QInputDialog, QLineEdit
16 from PyQt4.QtHelp import QHelpEngineCore 17 from PyQt4.QtHelp import QHelpEngineCore
17 18
18 from .Ui_QtHelpFiltersDialog import Ui_QtHelpFiltersDialog 19 from .Ui_QtHelpFiltersDialog import Ui_QtHelpFiltersDialog
19 20
20 21
21 class QtHelpFiltersDialog(QDialog, Ui_QtHelpFiltersDialog): 22 class QtHelpFiltersDialog(QDialog, Ui_QtHelpFiltersDialog):
22 """ 23 """
23 Class implementing a dialog to manage the QtHelp filters 24 Class implementing a dialog to manage the QtHelp filters.
24 """ 25 """
25 def __init__(self, engine, parent=None): 26 def __init__(self, engine, parent=None):
26 """ 27 """
27 Constructor 28 Constructor
28 29
64 def on_filtersList_currentItemChanged(self, current, previous): 65 def on_filtersList_currentItemChanged(self, current, previous):
65 """ 66 """
66 Private slot to update the attributes depending on the current filter. 67 Private slot to update the attributes depending on the current filter.
67 68
68 @param current reference to the current item (QListWidgetitem) 69 @param current reference to the current item (QListWidgetitem)
69 @param previous reference to the previous current item (QListWidgetItem) 70 @param previous reference to the previous current item
71 (QListWidgetItem)
70 """ 72 """
71 checkedList = [] 73 checkedList = []
72 if current is not None: 74 if current is not None:
73 checkedList = self.__filterMap[current.text()] 75 checkedList = self.__filterMap[current.text()]
74 for index in range(0, self.attributesList.topLevelItemCount()): 76 for index in range(0, self.attributesList.topLevelItemCount()):
164 except sqlite3.DatabaseError: 166 except sqlite3.DatabaseError:
165 pass # ignore database errors 167 pass # ignore database errors
166 168
167 for attr in self.__removedAttributes: 169 for attr in self.__removedAttributes:
168 self.__db.execute( 170 self.__db.execute(
169 "DELETE FROM FilterAttributeTable WHERE Name = '{0}'".format(attr)) 171 "DELETE FROM FilterAttributeTable WHERE Name = '{0}'"
172 .format(attr))
170 self.__db.commit() 173 self.__db.commit()
171 self.__db.close() 174 self.__db.close()
172 175
173 @pyqtSlot() 176 @pyqtSlot()
174 def on_buttonBox_accepted(self): 177 def on_buttonBox_accepted(self):

eric ide

mercurial