This commit is contained in:
N0\A
2025-10-23 19:31:41 +02:00
parent cc7304b321
commit 6d0b14b187
2 changed files with 33 additions and 0 deletions

27
core/updater.py Normal file
View File

@@ -0,0 +1,27 @@
from git import Repo
from pathlib import Path
REPO_URL = "https://github.com/n0va-bot/CLARA"
REPO_DIR = Path(__file__).parent
def update_repository():
try:
repo = Repo(REPO_DIR)
current_branch = repo.active_branch
print(f"Fetching latest changes from {current_branch}...")
origin = repo.remotes.origin
origin.fetch()
print(f"Pulling changes for branch {current_branch}...")
origin.pull()
print("Repository updated successfully.")
return True
except Exception as e:
print(f"Error updating repository: {e}")
return False
if __name__ == "__main__":
REPO_DIR = Path(__file__).parent / ".."
update_repository()

View File

@@ -7,6 +7,7 @@ from core.file_search import find
from core.web_search import MullvadLetaWrapper from core.web_search import MullvadLetaWrapper
from core.discord_presence import presence from core.discord_presence import presence
from core.app_launcher import list_apps, launch, App from core.app_launcher import list_apps, launch, App
from core.updater import update_repository
ASSET = Path(__file__).parent / "assets" / "2ktan.png" ASSET = Path(__file__).parent / "assets" / "2ktan.png"
@@ -351,6 +352,7 @@ class MainWindow(QtWidgets.QMainWindow):
right_menu.addAction("Search Files", self.start_file_search) right_menu.addAction("Search Files", self.start_file_search)
right_menu.addAction("Search Web", self.start_web_search) right_menu.addAction("Search Web", self.start_web_search)
right_menu.addSeparator() right_menu.addSeparator()
right_menu.addAction("Check for updates", self.update_git)
if restart: if restart:
right_menu.addAction("Restart", self.restart_application) right_menu.addAction("Restart", self.restart_application)
right_menu.addAction("Hide/Show", self.toggle_visible) right_menu.addAction("Hide/Show", self.toggle_visible)
@@ -446,6 +448,10 @@ class MainWindow(QtWidgets.QMainWindow):
finally: finally:
QtWidgets.QApplication.restoreOverrideCursor() QtWidgets.QApplication.restoreOverrideCursor()
def update_git(self):
update_repository()
self.restart_application()
def restart_application(self): def restart_application(self):
subprocess.Popen([sys.executable] + sys.argv) subprocess.Popen([sys.executable] + sys.argv)
QtWidgets.QApplication.quit() QtWidgets.QApplication.quit()