Skip to content

Commit b5fbb25

Browse files
committed
remove ID column from load plan dialog
1 parent 6e1f10b commit b5fbb25

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

arho_feature_template/gui/dialogs/load_plan_dialog.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class LoadPlanDialog(QDialog, LoadPlanDialogBase): # type: ignore
5757
search_line_edit: QLineEdit
5858
button_box: QDialogButtonBox
5959

60-
ID_COLUMN = 4
60+
# ID_COLUMN = 4
6161

6262
def __init__(self, parent, connection_names: list[str]):
6363
super().__init__(parent)
@@ -79,14 +79,14 @@ def __init__(self, parent, connection_names: list[str]):
7979
self.plan_table_view.setSelectionBehavior(QTableView.SelectRows)
8080

8181
self.model = QStandardItemModel()
82-
self.model.setColumnCount(5)
82+
self.model.setColumnCount(4)
8383
self.model.setHorizontalHeaderLabels(
8484
[
8585
"Nimi",
86-
"Tuottajan kaavatunnus",
8786
"Kaavalaji",
8887
"Kaavan elinkaaren tila",
89-
"ID",
88+
"Tuottajan kaavatunnus",
89+
# "ID",
9090
]
9191
)
9292

@@ -97,9 +97,9 @@ def __init__(self, parent, connection_names: list[str]):
9797
# self.plan_table_view.setSortingEnabled(True)
9898

9999
header = self.plan_table_view.horizontalHeader()
100-
for i in range(4):
100+
for i in range(3):
101101
header.setSectionResizeMode(i, QHeaderView.ResizeToContents)
102-
header.setSectionResizeMode(4, QHeaderView.Stretch)
102+
header.setSectionResizeMode(3, QHeaderView.Stretch)
103103

104104
# Show plans for the first connections by default
105105
# NOTE: Could be changed to the previously used connection if/when plugin can remember it
@@ -124,12 +124,13 @@ def load_plans(self):
124124
self.model.appendRow(
125125
[
126126
QStandardItem(name or ""),
127-
QStandardItem(producers_plan_identifier or ""),
128127
QStandardItem(plan_type or ""),
129128
QStandardItem(lifecycle_status or ""),
130-
QStandardItem(id_ or ""),
129+
QStandardItem(producers_plan_identifier or ""),
130+
# QStandardItem(id_ or ""),
131131
]
132132
)
133+
self.model.item(i, 0).setData(id_, Qt.UserRole)
133134
if active_plan_id == id_:
134135
row_to_select = i
135136

@@ -191,7 +192,7 @@ def on_selection_changed(self):
191192
selection = self.plan_table_view.selectionModel().selectedRows()
192193
if selection:
193194
selected_row = selection[0].row()
194-
self._selected_plan_id = self.plan_table_view.model().index(selected_row, self.ID_COLUMN).data()
195+
self._selected_plan_id = self.plan_table_view.model().index(selected_row, 0).data(Qt.UserRole)
195196
self.button_box.button(QDialogButtonBox.Ok).setEnabled(True)
196197
else:
197198
self._selected_plan_id = None

0 commit comments

Comments
 (0)