verify if any volumes are present
This commit is contained in:
parent
152ce4296b
commit
1512d3cd26
27
main.py
27
main.py
@ -302,19 +302,7 @@ class DockerGUI(QMainWindow):
|
||||
subprocess.run(["docker", "volume", "rm", volume_name])
|
||||
|
||||
self.refresh_data()
|
||||
|
||||
self.volumes_tree.clear()
|
||||
try:
|
||||
output = subprocess.check_output(["docker", "volume", "ls", "--format", "{{.Name}}\\t{{.Driver}}\\t{{.Mountpoint}}"], stderr=subprocess.STDOUT)
|
||||
volumes = output.decode().strip().split("\n")
|
||||
for volume in volumes:
|
||||
name, driver, mountpoint = volume.split("\t")
|
||||
item = QTreeWidgetItem([name, driver, mountpoint])
|
||||
self.volumes_tree.addTopLevelItem(item)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error refreshing volumes: {e.output.decode()}")
|
||||
except Exception as e:
|
||||
print(f"Unexpected error refreshing volumes: {str(e)}")
|
||||
self.refresh_volumes()
|
||||
|
||||
def refresh_data(self):
|
||||
self.refresh_containers()
|
||||
@ -370,12 +358,13 @@ class DockerGUI(QMainWindow):
|
||||
self.volumes_tree.clear()
|
||||
try:
|
||||
output = subprocess.check_output(["docker", "volume", "ls", "--format", "{{.Name}}\\t{{.Driver}}\\t{{.Mountpoint}}"], stderr=subprocess.STDOUT)
|
||||
volumes = output.decode().strip().split("\n")
|
||||
for volume in volumes:
|
||||
name, driver, mountpoint = volume.split("\t")
|
||||
item = QTreeWidgetItem([name, driver, mountpoint])
|
||||
self.volumes_tree.addTopLevelItem(item)
|
||||
self.restore_selection(self.volumes_tree, selected_items)
|
||||
if output.strip():
|
||||
volumes = output.decode().strip().split("\n")
|
||||
for volume in volumes:
|
||||
name, driver, mountpoint = volume.split("\t")
|
||||
item = QTreeWidgetItem([name, driver, mountpoint])
|
||||
self.volumes_tree.addTopLevelItem(item)
|
||||
self.restore_selection(self.volumes_tree, selected_items)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error refreshing volumes: {e.output.decode()}")
|
||||
except Exception as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user