Add option to restore the old icon

kirbylife 2024-04-04 01:40:00 -06:00
parent 4c9b7da927
commit a026713201
5 changed files with 29 additions and 3 deletions

1
.gitignore vendored 100644
View File

@ -0,0 +1 @@
output/

View File

@ -4,7 +4,7 @@ sourcePath:=$(shell pwd)
output:=$(sourcePath)/output
dependencies=$(shell for file in `cat dependencies.txt`;do echo "-d "$${file};done;)
version:=0.5.0
iteration:=0
iteration:=25
fpmExec:=$(shell echo "$${FPM_BIN:=fpm}")
all: clean build-tmp rpm-i686 rpm-jolla rpm-aarch64

View File

@ -1,10 +1,11 @@
*Mon Feb 13 2023 kirbylife <hola@kirbylife.dev> 0.5.0-7
*Thu Apr 04 2024 kirbylife <hola@kirbylife.dev> 0.5.0-25
- Add SVG support
- Improve performance
- Add resize slider
- Fix irregluar size of icons on the main grid
- Add the option to search a better icon directly on the html page
- Improve a bit the logging
- Add the option to restore the old icon
*Mon Feb 13 2023 kirbylife <hola@kirbylife.dev> 0.4.5-5
- Add aarch64 support

View File

@ -43,6 +43,17 @@ Page {
MenuItem {
text: attrs.Name
}
MenuItem {
text: "Restore the old icon"
onClicked: {
py.addImportPath(Qt.resolvedUrl("../src"))
py.importModule("main", function(){
py.call("main.restore_icon", [attrs], function(success) {
if(success) mainList.reload();
})
})
}
}
}
}

View File

@ -188,7 +188,7 @@ def sailify(raw_str, pattern, size) -> str:
return "data:image/png;base64," + output_base64.decode()
def backup_icon(app):
if not os.path.exists(app["path"] + "backup"):
if not os.path.exists(app["path"] + "_backup"):
backup_path = app["path"] + "_backup"
shutil.copyfile(app["path"], backup_path)
logging.info("Icon backed up on: " + backup_path)
@ -201,3 +201,16 @@ def save_icon(app):
f.write(new_content)
logging.info("Icon saved on: " + app["path"])
return True
def restore_icon(app):
if "old_icon" not in app:
return False
app["Icon"] = app["old_icon"]
del app["old_icon"]
new_content = deparse_file(app)
with open(app["path"], "w") as f:
f.write(new_content)
logging.info("Icon saved on: " + app["path"])
return True