Skip to content

Commit

Permalink
Disable editing of matrix entries when showing matrix.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlyongemallo committed Oct 30, 2023
1 parent c58be39 commit 0f3a681
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zxlive/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from typing import Callable, Optional, TypedDict

from PySide6.QtCore import (QByteArray, QEvent, QFile, QFileInfo, QIODevice,
QSettings, QTextStream)
QSettings, QTextStream, Qt)
from PySide6.QtGui import QAction, QCloseEvent, QIcon, QKeySequence
from PySide6.QtWidgets import (QDialog, QFormLayout, QMainWindow, QMessageBox,
QTableWidget, QTableWidgetItem, QTabWidget,
Expand Down Expand Up @@ -471,7 +471,9 @@ def format_str(c: complex) -> str:
table.setColumnCount(matrix.shape[1])
for i in range(matrix.shape[0]):
for j in range(matrix.shape[1]):
table.setItem(i, j, QTableWidgetItem(format_str(matrix[i,j])))
entry = QTableWidgetItem(format_str(matrix[i, j]))
entry.setFlags(entry.flags() & ~Qt.ItemIsEditable)
table.setItem(i, j, entry)
table.resizeColumnsToContents()
table.resizeRowsToContents()
dialog.setLayout(QVBoxLayout())
Expand Down

0 comments on commit 0f3a681

Please sign in to comment.