From f54dac6c7077e3b603a9f7f5d43be499dce06e0d Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Fri, 11 Apr 2014 23:43:45 -0400 Subject: [PATCH] cleanup --- pyqtgraph/widgets/TableWidget.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pyqtgraph/widgets/TableWidget.py b/pyqtgraph/widgets/TableWidget.py index a2976911..4eaca231 100644 --- a/pyqtgraph/widgets/TableWidget.py +++ b/pyqtgraph/widgets/TableWidget.py @@ -28,8 +28,6 @@ def _defersort(fn): self.setSortingEnabled(self._sorting) self._sorting = None - - defersort.func_name = fn.func_name + '_defersort' return defersort @@ -63,15 +61,13 @@ class TableWidget(QtGui.QTableWidget): self.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) self.clear() - if 'sortable' not in kwds: - kwds['sortable'] = True - for kwd, val in kwds.items(): - if kwd == 'editable': - self.setEditable(val) - elif kwd == 'sortable': - self.setSortingEnabled(val) - else: - raise TypeError("Invalid keyword argument '%s'" % kwd) + kwds.setdefault('sortable', True) + kwds.setdefault('editable', False) + self.setEditable(kwds.pop('editable')) + self.setSortingEnabled(kwds.pop('sortable')) + + if len(kwds) > 0: + raise TypeError("Invalid keyword arguments '%s'" % kwds.keys()) self._sorting = None