Add option to restore the old icon

master
kirbylife 2024-04-04 01:40:00 -06:00
parent 4c9b7da927
commit 6b00e85941
6 changed files with 32 additions and 5 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

@ -32,10 +32,11 @@ Make your webapps icons in the app box look better with the rest of your native
- [x] Add SVG support
- [x] Add option to modify the size of the original icon to fit better
- [x] Make all icons in the main grid the same size
- [ ] Add option to request favicon
- [ ] Add option to restore the original icon
- [x] Add option to request favicon
- [x] Add option to restore the original icon
- [ ] Add option to modify name and link
- [ ] Improve the shitty icon (maybe)
- [ ] Add translations
- [ ] ...
Contributors are welcome :).

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