cache_btn()

This commit is contained in:
Abhiraj Roy (iconized)
2024-04-25 16:08:38 +05:30
committed by GitHub
parent 47e553f6ef
commit b6e4aea78f

View File

@@ -85,7 +85,7 @@ def permissions(dst):
subprocess.call(["chown", "-R", sudo_username + ":" + group, dst], shell=False) subprocess.call(["chown", "-R", sudo_username + ":" + group, dst], shell=False)
except Exception as e: except Exception as e:
logger.error( logger.error(
"Exception occured in LOC68: %s" % e "[Exception] permissions() : %s" % e
) )
# NOTE: Creating Log, Export and Config Directory: # NOTE: Creating Log, Export and Config Directory:
@@ -152,7 +152,7 @@ try:
logger.addHandler(ch) logger.addHandler(ch)
logger.addHandler(tfh) logger.addHandler(tfh)
except Exception as e: except Exception as e:
print("[ERROR] Exception in LOC109: %s" % e) print("Found Exception in LOC109: %s" % e)
# NOTE : On app close create package file # NOTE : On app close create package file
def _on_close_create_package_file(): def _on_close_create_package_file():
try: try:
@@ -174,7 +174,7 @@ def _on_close_create_package_file():
for line in process.stdout: for line in process.stdout:
f.write("%s" %line) f.write("%s" %line)
except Exception as e: except Exception as e:
logger.error("[ERROR] Exception in LOC158: %s" % e) logger.error("[Exception] _on_close_create_package_file(): %s" % e)
# NOTE: Global Functions # NOTE: Global Functions
def _get_position(lists, value): def _get_position(lists, value):
@@ -208,7 +208,7 @@ def sync_package_db():
"-Sy", "-Sy",
] ]
logger.info( logger.info(
"Synchronizing Package Database..." "[INFO] Synchronizing Package Database..."
) )
process_sync = subprocess.run( process_sync = subprocess.run(
sync_str, sync_str,
@@ -226,7 +226,7 @@ def sync_package_db():
return out return out
except Exception as e: except Exception as e:
logger.error( logger.error(
"[ERROR] Exception in LOC206: %s" % e "[Exception] sync_package_db() : %s" % e
) )
def sync_file_db(): def sync_file_db():
@@ -236,7 +236,7 @@ def sync_file_db():
"-Fy", "-Fy",
] ]
logger.info( logger.info(
"Synchronizing File Database..." "[INFO] Synchronizing File Database..."
) )
process_sync = subprocess.run( process_sync = subprocess.run(
sync_str, sync_str,
@@ -255,7 +255,7 @@ def sync_file_db():
return out return out
except Exception as e: except Exception as e:
logger.error( logger.error(
"[ERROR] Exception in LOC234: %s" % e "[Exception] sync_file_db() : %s" % e
) )
# NOTE: Installation & Uninstallation Process # NOTE: Installation & Uninstallation Process
@@ -1897,4 +1897,17 @@ def get_pacman_process():
except Exception as e: except Exception as e:
logger.error( logger.error(
"Found Exception in LOC1888: %s" % e "Found Exception in LOC1888: %s" % e
) )
def cache_btn():
# fraction = 1 / len(packages)
packages.sort()
number = 1
for pkg in packages:
logger.debug(str(number) + "/" + str(len(packages)) + ": Caching " + pkg)
cache(pkg, path_dir_cache)
number = number + 1
# progressbar.timeout_id = GLib.timeout_add(50, progressbar.update, fraction)
logger.debug("Caching applications finished")