Merge pull request #6 from rodrigopedra/master
Verify if any volumes are present
This commit is contained in:
commit
0d8c73f80c
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/.idea
|
||||||
|
/venv
|
28
main.py
28
main.py
@ -331,19 +331,6 @@ class DockerGUI(QMainWindow):
|
|||||||
|
|
||||||
self.refresh_data()
|
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)}")
|
|
||||||
|
|
||||||
def refresh_data(self):
|
def refresh_data(self):
|
||||||
self.refresh_containers()
|
self.refresh_containers()
|
||||||
self.refresh_images()
|
self.refresh_images()
|
||||||
@ -424,13 +411,14 @@ class DockerGUI(QMainWindow):
|
|||||||
self.volumes_tree.clear()
|
self.volumes_tree.clear()
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(["docker", "volume", "ls", "--format", "{{.Name}}\\t{{.Driver}}\\t{{.Mountpoint}}"], stderr=subprocess.STDOUT)
|
output = subprocess.check_output(["docker", "volume", "ls", "--format", "{{.Name}}\\t{{.Driver}}\\t{{.Mountpoint}}"], stderr=subprocess.STDOUT)
|
||||||
volumes = output.decode().strip().split("\n")
|
if output.strip():
|
||||||
for volume in volumes:
|
volumes = output.decode().strip().split("\n")
|
||||||
name, driver, mountpoint = volume.split("\t")
|
for volume in volumes:
|
||||||
item = QTreeWidgetItem([name, driver, mountpoint])
|
name, driver, mountpoint = volume.split("\t")
|
||||||
self.volumes_tree.addTopLevelItem(item)
|
item = QTreeWidgetItem([name, driver, mountpoint])
|
||||||
self.filter_tree(self.volumes_tree, self.volumes_tab.findChild(QLineEdit).text())
|
self.volumes_tree.addTopLevelItem(item)
|
||||||
self.restore_selection(self.volumes_tree, selected_items)
|
self.filter_tree(self.volumes_tree, self.volumes_tab.findChild(QLineEdit).text())
|
||||||
|
self.restore_selection(self.volumes_tree, selected_items)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Error refreshing volumes: {e.output.decode()}")
|
print(f"Error refreshing volumes: {e.output.decode()}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user