More clean ups and fixes

This commit is contained in:
Andreas Preikschat 2012-05-17 18:35:58 +02:00
parent 5378399302
commit 56c36f355d
3 changed files with 3 additions and 4 deletions

View File

@ -82,6 +82,7 @@ class Settings(QtCore.QSettings):
return setting.toStringList()
if isinstance(defaultValue, QtCore.QPoint):
return setting.toPoint()
# TODO: add <datetime.date>
print u'No!', type(defaultValue)
return setting

View File

@ -185,7 +185,7 @@ class SearchEdit(QtGui.QLineEdit):
A :class:`~PyQt4.QtCore.QString` instance which represents the text
in the line edit.
"""
self.clearButton.setVisible(not text.isEmpty())
self.clearButton.setVisible(bool(text))
def _onClearButtonClicked(self):
"""

View File

@ -98,7 +98,6 @@ class SettingsManager(object):
"""
settings = Settings()
settings.beginGroup(section)
#TODO: check if [0] is needed.
old_count = settings.value(u'%s count' % name, 0)
new_count = len(list)
settings.setValue(u'%s count' % name, new_count)
@ -127,8 +126,7 @@ class SettingsManager(object):
list = []
if list_count:
for counter in range(list_count):
# TODO: Check
item = settings.value(u'%s %d' % (name, counter))
item = settings.value(u'%s %d' % (name, counter), u'')
if item:
list.append(item)
settings.endGroup()