def actionSum(self): row_first = 0 row_last = 0 row_cur = 0 col_first = 0 col_last = 0 col_cur = 0 selected = self.table.selectedItems() if selected: first = selected[0] last = selected[-1] row_first = self.table.row(first) row_last = self.table.row(last) col_first = self.table.column(first) col_last = self.table.column(last) current = self.table.currentItem() if current: row_cur = self.table.row(current) col_cur = self.table.column(current) cell1 = encode_pos(row_first, col_first) cell2 = encode_pos(row_last, col_last) out = encode_pos(row_cur, col_cur) ok, cell1, cell2, out = self.runInputDialog( self.tr("Sum cells"), self.tr("First cell:"), self.tr("Last cell:"), unichr(0x03a3), self.tr("Output to:"), cell1, cell2, out) if ok: row, col = decode_pos(out) self.table.item(row, col).setText(self.tr("sum %s %s" % (cell1, cell2)))
def actionSum(self): row_first = 0 row_last = 0 row_cur = 0 col_first = 0 col_last = 0 col_cur = 0 selected = self.table.selectedItems() if selected: first = selected[0] last = selected[-1] row_first = self.table.row(first) row_last = self.table.row(last) col_first = self.table.column(first) col_last = self.table.column(last) current = self.table.currentItem() if current: row_cur = self.table.row(current) col_cur = self.table.column(current) cell1 = encode_pos(row_first, col_first) cell2 = encode_pos(row_last, col_last) out = encode_pos(row_cur, col_cur) ok, cell1, cell2, out = self.runInputDialog("Sum cells", "First cell:", "Last cell:", u"\N{GREEK CAPITAL LETTER SIGMA}", "Output to:", cell1, cell2, out) if ok: row, col = decode_pos(out) self.table.item(row, col).setText("sum %s %s" % (cell1, cell2))
def actionMath_helper(self, title, op): cell1 = "C1" cell2 = "C2" out = "C3" current = self.table.currentItem() if current: out = encode_pos(self.table.currentRow(), self.table.currentColumn()) ok, cell1, cell2, out = self.runInputDialog(title, "Cell 1", "Cell 2", op, "Output to:", cell1, cell2, out) if ok: row, col = decode_pos(out) self.table.item(row, col).setText("%s %s %s" % (op, cell1, cell2))
def actionSum(self): row_first = 0 row_last = 0 row_cur = 0 col_first = 0 col_last = 0 col_cur = 0 selected = self.table.selectedItems() if selected: first = selected[0] last = selected[-1] row_first = self.table.row(first) row_last = self.table.row(last) col_first = self.table.column(first) col_last = self.table.column(last) current = self.table.currentItem() if current: row_cur = self.table.row(current) col_cur = self.table.column(current) cell1 = encode_pos(row_first, col_first) cell2 = encode_pos(row_last, col_last) out = encode_pos(row_cur, col_cur) ok, cell1, cell2, out = self.runInputDialog( "Sum cells", "First cell:", "Last cell:", u"\N{GREEK CAPITAL LETTER SIGMA}", "Output to:", cell1, cell2, out, ) if ok: row, col = decode_pos(out) self.table.item(row, col).setText("sum %s %s" % (cell1, cell2))
def updateStatus(self, item): if item and item == self.table.currentItem(): self.statusBar().showMessage(item.data(QtCore.Qt.StatusTipRole), 1000) self.cellLabel.setText(self.tr("Cell: (%s)" % encode_pos(self.table.row(item), self.table.column(item))))