mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-02 02:38:30 +02:00
added a empty cache button in the advanced menu
This commit is contained in:
parent
4a19aff206
commit
6017c20aed
3 changed files with 15 additions and 2 deletions
|
@ -117,6 +117,8 @@
|
||||||
"PRE-PATCHS": "pre-patchs",
|
"PRE-PATCHS": "pre-patchs",
|
||||||
"CALCULATING_HASH_FOR": "Calculating hash for",
|
"CALCULATING_HASH_FOR": "Calculating hash for",
|
||||||
"WARNING_NOT_ROOT": "The application require root permission. You should start the application with 'sudo'. Continue anyway ?",
|
"WARNING_NOT_ROOT": "The application require root permission. You should start the application with 'sudo'. Continue anyway ?",
|
||||||
"WARNING_INSTALLER_PERMISSION": "The application need writing and execution permissions to its own files. You can use 'sudo chmod 777 -R <installer-path>' to fix that. Continue anyway ?"
|
"WARNING_INSTALLER_PERMISSION": "The application need writing and execution permissions to its own files. You can use 'sudo chmod 777 -R <installer-path>' to fix that. Continue anyway ?",
|
||||||
|
"WARNING_EMPTY_CACHE": "By emptying the cache, you will gain %.2fGB, but reinstalling a mod will be take way longer. Continue ?",
|
||||||
|
"EMPTY_CACHE": "Empty the cache"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -118,6 +118,8 @@
|
||||||
"PRE-PATCHS": "pre-patchs",
|
"PRE-PATCHS": "pre-patchs",
|
||||||
"CALCULATING_HASH_FOR": "Calcule du hash pour",
|
"CALCULATING_HASH_FOR": "Calcule du hash pour",
|
||||||
"WARNING_NOT_ROOT": "Cette application nécessite les permissions root. Vous devriez lancer l'application avec 'sudo'. Continuer quand même ?",
|
"WARNING_NOT_ROOT": "Cette application nécessite les permissions root. Vous devriez lancer l'application avec 'sudo'. Continuer quand même ?",
|
||||||
"WARNING_INSTALLER_PERMISSION": "Cette application nécessite les permissions d'écriture et d'exécution sur ses propres fichiers. Vous pouvez utiliser 'sudo chmod 777 -R <installer-path>' pour corriger cela. Continuer quand même ?"
|
"WARNING_INSTALLER_PERMISSION": "Cette application nécessite les permissions d'écriture et d'exécution sur ses propres fichiers. Vous pouvez utiliser 'sudo chmod 777 -R <installer-path>' pour corriger cela. Continuer quand même ?",
|
||||||
|
"WARNING_EMPTY_CACHE": "En vidant le cache, vous allez gagner %.2fGo, mais réinstaller un mod sera beaucoup plus long. Continuer ?",
|
||||||
|
"EMPTY_CACHE": "Vider le cache"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -161,6 +161,7 @@ class Menu(tkinter.Menu):
|
||||||
command=lambda: mystuff.Window(self.root.mod_config, self.root.options)
|
command=lambda: mystuff.Window(self.root.mod_config, self.root.options)
|
||||||
)
|
)
|
||||||
self.threads_used = self.ThreadsUsed(self)
|
self.threads_used = self.ThreadsUsed(self)
|
||||||
|
self.add_command(label=_("EMPTY_CACHE"), command=self.empty_cache)
|
||||||
|
|
||||||
self.add_separator()
|
self.add_separator()
|
||||||
|
|
||||||
|
@ -171,6 +172,14 @@ class Menu(tkinter.Menu):
|
||||||
command=lambda: self.root.options.developer_mode.set(self.variable_developer_mode.get())
|
command=lambda: self.root.options.developer_mode.set(self.variable_developer_mode.get())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def empty_cache():
|
||||||
|
cache_path: Path = Path("./.cache/")
|
||||||
|
cache_size: int = sum(file.stat().st_size / Go for file in cache_path.rglob("*"))
|
||||||
|
|
||||||
|
if messagebox.askokcancel(_("WARNING"), _("WARNING_EMPTY_CACHE") % cache_size):
|
||||||
|
shutil.rmtree("./.cache/", ignore_errors=True)
|
||||||
|
|
||||||
class ThreadsUsed(tkinter.Menu):
|
class ThreadsUsed(tkinter.Menu):
|
||||||
def __init__(self, master: tkinter.Menu):
|
def __init__(self, master: tkinter.Menu):
|
||||||
super().__init__(master, tearoff=False)
|
super().__init__(master, tearoff=False)
|
||||||
|
|
Loading…
Reference in a new issue