except FileNotFoundError as e:
print(e)
+ def delete_attachment(self, item):
+ try:
+ os.unlink(os.path.join(self.directory.name, "attachment", os.path.basename(item)))
+ except Exception as e:
+ print(e)
+
def delete_sign(self):
try:
os.unlink(os.path.join(self.directory.name, "certificate.pem"))
os.unlink(os.path.join(self.directory.name, "signature.p7m"))
except Exception as e:
- raise(e)
+ print(e)
def is_signed(self):
return(os.path.exists(os.path.join(self.directory.name, "certificate.pem")) and (os.path.exists(os.path.join(self.directory.name, "signature.p7m"))))
print(e)
def remove_attachment(self):
- self.input_attachment.takeItem(self.input_attachment.currentRow())
+ index=self.input_attachment.currentRow()
+ if(index>=0):
+ self.current_file.delete_attachment(self.input_attachment.item(index).text())
+ self.input_attachment.takeItem(index)
+ else:
+ QMessageBox.warning(self, "Select item", "Please select an attachment to remove.")
def save_attachment(self):
try: