Skip to content

Commit f4f89bb

Browse files
committed
[processing] resurrects matrix parameter
1 parent dc564fb commit f4f89bb

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

python/plugins/processing/gui/FixedTableDialog.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ def __init__(self, param, table):
6363
self.btnRemove.clicked.connect(lambda: self.removeRows())
6464
self.btnRemoveAll.clicked.connect(lambda: self.removeRows(True))
6565

66-
if self.param.fixedNumOfRows:
66+
if self.param.hasFixedNumberRows():
6767
self.btnAdd.setEnabled(False)
6868
self.btnRemove.setEnabled(False)
6969
self.btnRemoveAll.setEnabled(False)
7070

7171
self.populateTable(table)
7272

7373
def populateTable(self, table):
74-
cols = len(self.param.cols)
74+
cols = len(self.param.headers())
7575
rows = len(table)
7676
model = QStandardItemModel(rows, cols)
7777

7878
# Set headers
79-
model.setHorizontalHeaderLabels(self.param.cols)
79+
model.setHorizontalHeaderLabels(self.param.headers())
8080

8181
# Populate table
8282
for i in range(rows):
@@ -101,7 +101,7 @@ def reject(self):
101101
def removeRows(self, removeAll=False):
102102
if removeAll:
103103
self.tblView.model().clear()
104-
self.tblView.model().setHorizontalHeaderLabels(self.param.cols)
104+
self.tblView.model().setHorizontalHeaderLabels(self.param.headers())
105105
else:
106106
indexes = sorted(self.tblView.selectionModel().selectedRows())
107107
self.tblView.setUpdatesEnabled(False)

python/plugins/processing/gui/FixedTablePanel.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ def __init__(self, param, parent=None):
4646

4747
self.param = param
4848
self.table = []
49-
for i in range(param.numRows):
49+
for i in range(param.numberRows()):
5050
self.table.append(list())
51-
for j in range(len(param.cols)):
51+
for j in range(len(param.headers())):
5252
self.table[i].append('0')
5353

5454
self.leText.setText(
55-
self.tr('Fixed table {0}x{1}').format(param.numRows, len(param.cols)))
55+
self.tr('Fixed table {0}x{1}').format(param.numberRows(), len(param.headers())))
5656

5757
self.btnSelect.clicked.connect(self.showFixedTableDialog)
5858

@@ -63,4 +63,4 @@ def showFixedTableDialog(self):
6363
self.table = dlg.rettable
6464

6565
self.leText.setText(self.tr('Fixed table {0}x{1}').format(
66-
len(self.table), len(self.param.cols)))
66+
len(self.table), len(self.param.headers())))

python/plugins/processing/gui/wrappers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,8 @@ def create_wrapper_from_class(param, dialog, row=0, col=0):
16071607
wrapper = MapLayerWidgetWrapper
16081608
elif param.type() == 'range':
16091609
wrapper = RangeWidgetWrapper
1610+
elif param.type() == 'matrix':
1611+
wrapper = FixedTableWidgetWrapper
16101612
else:
16111613
assert False, param.type()
16121614
return wrapper(param, dialog, row, col)

0 commit comments

Comments
 (0)