diff --git a/panels/print.py b/panels/print.py
index 151597b6..94a5b6df 100644
--- a/panels/print.py
+++ b/panels/print.py
@@ -229,7 +229,11 @@ class PrintPanel(ScreenPanel):
else:
icon = self._gtk.Image("file", 1.6)
- file.add(icon)
+ img = Gtk.Button()
+ img.set_image(icon)
+ img.connect("clicked", self.confirm_delete_file, f"gcodes/{filepath}")
+
+ file.add(img)
file.add(labels)
if os.path.splitext(filename)[1] in [".gcode", ".g", ".gco"]:
file.add(actions)
@@ -242,6 +246,16 @@ class PrintPanel(ScreenPanel):
"name": name
}
+ def confirm_delete_file(self, widget, filepath):
+ logging.debug(f"Sending delete_file {filepath}")
+ params = {"path": f"{filepath}"}
+ self._screen._confirm_send_action(
+ None,
+ _("Delete File?") + "\n\n" + filepath,
+ "server.files.delete_file",
+ params
+ )
+
def back(self):
if len(self.cur_directory.split('/')) > 1:
self.change_dir(None, '/'.join(self.cur_directory.split('/')[:-1]))
@@ -352,7 +366,8 @@ class PrintPanel(ScreenPanel):
if "size" in fileinfo:
info += _("Size") + f': {self.format_size(fileinfo["size"])}\n'
if "estimated_time" in fileinfo:
- info += _("Print Time") + f': {self.format_time(fileinfo["estimated_time"])}'
+ info += _("Print Time") + f': {self.format_time(fileinfo["estimated_time"])}'
+ info += ""
return info