Skip to content

Commit

Permalink
Merge pull request #155 from dlyongemallo/matrix_disable_edit
Browse files Browse the repository at this point in the history
Disable editing of matrix entries when showing matrix.
  • Loading branch information
RazinShaikh authored Oct 30, 2023
2 parents c58be39 + 0f3a681 commit 9328602
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 9328602

Please sign in to comment.