use iteritems

This commit is contained in:
Andreas Preikschat 2011-05-07 16:14:34 +02:00
parent 738729e779
commit 3824c33607
2 changed files with 6 additions and 3 deletions

View File

@ -87,7 +87,8 @@ class BaseModel(object):
Creates an instance of a class and populates it, returning the instance
"""
instance = cls()
[instance.__setattr__(key, kwargs[key]) for key in kwargs]
for key, value in kwargs.iteritems():
instance.__setattr__(key, value)
return instance

View File

@ -140,7 +140,8 @@ class OpenLPToolbar(QtGui.QToolBar):
``widgets``
The list of names of widgets to be hidden.
"""
[self.actions[widget].setVisible(False) for widget in widgets]
for widget in widgets:
self.actions[widget].setVisible(False)
def makeWidgetsVisible(self, widgets):
"""
@ -149,7 +150,8 @@ class OpenLPToolbar(QtGui.QToolBar):
``widgets``
The list of names of widgets to be shown.
"""
[self.actions[widget].setVisible(True) for widget in widgets]
for widget in widgets:
self.actions[widget].setVisible(True)
def addPushButton(self, image_file=None, text=u''):
"""