aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-11-26 14:30:43 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-12-20 21:16:14 -0300
commit320b49b221ae2881c2aa4ca962ce0e2faa7e41c2 (patch)
tree83757af187374803b4a6eb72402e0d6d037db304 /examples
parent3961786952cad98529ed30fae9370b197abbdd8e (diff)
Fixed part of icons example.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/widgets/icons/icons.py28
1 files changed, 9 insertions, 19 deletions
diff --git a/examples/widgets/icons/icons.py b/examples/widgets/icons/icons.py
index e137e11..6882c42 100755
--- a/examples/widgets/icons/icons.py
+++ b/examples/widgets/icons/icons.py
@@ -58,19 +58,15 @@ class ImageDelegate(QtGui.QItemDelegate):
def setEditorData(self, editor, index):
comboBox = editor
- if not comboBox:
- return
-
- pos = comboBox.findText(index.model().data(index),
- QtCore.Qt.MatchExactly)
- comboBox.setCurrentIndex(pos)
+ if comboBox:
+ pos = comboBox.findText(index.model().data(index),
+ QtCore.Qt.MatchExactly)
+ comboBox.setCurrentIndex(pos)
def setModelData(self, editor, model, index):
comboBox = editor
- if not comboBox:
- return
-
- model.setData(index, comboBox.currentText())
+ if comboBox:
+ model.setData(index, comboBox.currentText())
def emitCommitData(self):
self.commitData.emit(self.sender())
@@ -185,10 +181,7 @@ class MainWindow(QtGui.QMainWindow):
"in different modes (active, normal, disabled and selected) "
"and states (on and off) based on a set of images.")
- def changeStyle(self, checked):
- if not checked:
- return
-
+ def changeStyle(self):
action = self.sender()
style = QtGui.QStyleFactory.create(action.data())
if not style:
@@ -216,10 +209,7 @@ class MainWindow(QtGui.QMainWindow):
metric_value = style.pixelMetric(metric)
button.setText(label % (metric_value, metric_value))
- def changeSize(self, checked=True):
- if not checked:
- return
-
+ def changeSize(self):
if self.otherRadioButton.isChecked():
extent = self.otherSpinBox.value()
else:
@@ -272,7 +262,7 @@ class MainWindow(QtGui.QMainWindow):
self.previewArea.setIcon(icon)
def addImage(self):
- fileNames = QtGui.QFileDialog.getOpenFileNames(self, "Open Images",
+ fileNames, filters = QtGui.QFileDialog.getOpenFileNames(self, "Open Images",
'', "Images (*.png *.xpm *.jpg);;All Files (*)")
for fileName in fileNames: