diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b1960e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +output/ \ No newline at end of file diff --git a/Makefile b/Makefile index ce47c92..1484a93 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 39c21f3..24f24fb 100644 --- a/README.md +++ b/README.md @@ -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 :). diff --git a/changelog.txt b/changelog.txt index e6a0978..72b4a2f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,10 +1,11 @@ -*Mon Feb 13 2023 kirbylife 0.5.0-7 +*Thu Apr 04 2024 kirbylife 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 0.4.5-5 - Add aarch64 support diff --git a/qml/Main.qml b/qml/Main.qml index 34a4c7a..99f1db2 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -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(); + }) + }) + } + } } } diff --git a/src/main.py b/src/main.py index 4caff76..6123034 100644 --- a/src/main.py +++ b/src/main.py @@ -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