make all columns sortable

This commit is contained in:
Salem Yaslem 2024-10-01 01:50:23 +03:00
parent 1963d02b56
commit 549ca648df

View File

@ -118,6 +118,12 @@ class DockerGUI(QMainWindow):
self.networks_tree = self.create_tree_widget(["ID", "Name", "Driver"])
self.volumes_tree = self.create_tree_widget(["Name", "Driver", "Mountpoint"])
# enable sorting
self.containers_tree.setSortingEnabled(True)
self.images_tree.setSortingEnabled(True)
self.networks_tree.setSortingEnabled(True)
self.volumes_tree.setSortingEnabled(True)
self.containers_tree.itemDoubleClicked.connect(self.open_terminal)
# Add tree widgets to tabs
@ -427,7 +433,6 @@ class DockerGUI(QMainWindow):
item = QTreeWidgetItem([id, repository, tag, size])
self.images_tree.addTopLevelItem(item)
self.sort_tree_widget(self.images_tree, 0, Qt.DescendingOrder)
self.filter_tree(self.images_tree, self.images_tab.findChild(QLineEdit).text())
self.restore_selection(self.images_tree, selected_items)
except subprocess.CalledProcessError as e: